Skip to content

Calculate integer and decimal aspect ratio for dimensions

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Notifications You must be signed in to change notification settings

mirukana/whratio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

whratio

PyPI downloads PyPI version PyPI pyversions

Calculate integer and decimal aspect ratio for dimensions.

CLI examples

    $ whratio 1024 768
    4 3 1.3333333333333333
    $ whratio -d -n 2 256 196
    1.31
    whratio -WH 2560 1080 | tr " " :
    64:27

Python package examples

    >>> import whratio

    >>> whratio.as_int(1920, 1080)
    (16, 9)

    >>> whratio.as_float(1920, 1080)
    1.7777777777777777

    >>> round(whratio.as_float(1920, 1080), 2)
    1.78

Installation

Using pip:

    # pip3 install whratio

Releases

No releases published

Packages

No packages published