https://github.com/mirukana/whratio
Calculate integer and decimal aspect ratio for dimensions
https://github.com/mirukana/whratio
aspect-ratio calculator cli dimensions height image python python-2 python-3 python-module video width
Last synced: 2 months ago
JSON representation
Calculate integer and decimal aspect ratio for dimensions
- Host: GitHub
- URL: https://github.com/mirukana/whratio
- Owner: mirukana
- License: lgpl-3.0
- Created: 2018-04-04T19:06:15.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-20T02:10:25.000Z (over 6 years ago)
- Last Synced: 2025-03-26T08:13:05.949Z (3 months ago)
- Topics: aspect-ratio, calculator, cli, dimensions, height, image, python, python-2, python-3, python-module, video, width
- Language: Python
- Size: 39.1 KB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# whratio
[](https://pepy.tech/project/whratio)
[](https://pypi.python.org/pypi/whratio)
[](https://pypi.python.org/pypi/whratio)Calculate integer and decimal aspect ratio for dimensions.
## CLI examples
```sh
$ whratio 1024 768
4 3 1.3333333333333333
``````sh
$ whratio -d -n 2 256 196
1.31
``````sh
whratio -WH 2560 1080 | tr " " :
64:27
```## Python package examples
```python3
>>> 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](https://pip.pypa.io/en/stable/installing/):
```sh
# pip3 install whratio
```