Calculate integer and decimal aspect ratio for dimensions.
Project description
whratio
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
Release history Release notifications | RSS feed
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)
Built Distributions
whratio-1.1.3.post1-py3.6.egg
(4.6 kB
view hashes)
whratio-1.1.3.post1-py2.7.egg
(4.6 kB
view hashes)
Close
Hashes for whratio-1.1.3.post1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a8fda99dd34a217e8eba8e53cb088bbd9f4102dcd16f254b3709a7b5caa0310 |
|
MD5 | 3dafe60550df1bd80cc33e25303f5d7c |
|
BLAKE2b-256 | 1e0b05a4c4aa6f74625036381bff6858db98a762c1e3011bbdd44994c5bd78df |