Skip to main content

Calculate integer and decimal aspect ratio for dimensions.

Project description

whratio

Downloads

Calculate integer and decimal aspect ratio for dimensions.

Python module examples

    >>> from whratio import *

    >>> ratio_float(640, 480)
    1.33

    >>> ratio_float(1920, 1080, ndigits=4)
    1.7778

    >>> ratio_int(1920, 1080)
    (16, 9)

CLI examples

    whratio 1024 768

Returns 4 3 1.33 (integer 4:3, decimal 1.33).

    whratio 100 200 | cut -d' ' -f3

Get the 3rd value of 1 2 0.5 (decimal ratio 0.5) on POSIX systems.

    whratio 1920 1080 | awk '{print $1":"$2}'

Format integer ratio as 16:9 on POSIX systems.

Installation

Requires Python 2 or 3.

From pip:

    sudo pip install whratio

Manually:

    git clone https://github.com/mirukan/whratio
    cd whratio
    sudo python setup.py install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whratio-1.1.3-1.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distributions

whratio-1.1.3.post1-py3.6.egg (4.6 kB view hashes)

Uploaded Source

whratio-1.1.3.post1-py2.py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 2 Python 3

whratio-1.1.3.post1-py2.7.egg (4.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page