Aspect Ratio Too
Overview
Aspect ratio calculations.
Installation
uv add aspect-ratio-too
For CLI use, install optional extras:
uv add "aspect-ratio-too[cli]"
Usage
Know the aspect ratio you want but do not know the corresponding width/height? Try this:
from aspect_ratio_too import AspectRatioCalculator
arc = AspectRatioCalculator(16, 9)
# Get (width/height) tuple
arc.width_to_dimensions(1920) # (1920, 1080)
arc.height_to_dimensions(1080) # (1920, 1080)
arc.width_to_height(1920) # 1080
arc.height_to_width(1080) # 1920
Or calculate the aspect ratio given known pixel dimensions:
from aspect_ratio_too import aspect_ratio, aspect_ratio_str
aspect_ratio(1920, 1080) # 1.7777777777777777
aspect_ratio_str(1920, 1080) # 16:9
CLI
aspect-ratio ratio 1920 1080
aspect-ratio ratio-str 1920 1080
aspect-ratio width-to-height 16 9 1920
aspect-ratio height-to-width 16 9 1080
aspect-ratio width-to-dimensions 16 9 1920
aspect-ratio height-to-dimensions 16 9 1080
Development
just --list
just env
just uv-install-dev
just pip-install-editable
Testing
just pytest
just coverage
just open-coverage
For quick local quality checks:
just check
Issues
If you experience any issues, please create one in the issue tracker.
History
All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
0.2.0 (2026-04-22)
- Added an
aspect-ratioCLI wrapper command. - Added optional
clidependencies (clickandrich) so library-only installs do not require CLI packages. - Added CLI command coverage in tests and packaging script entrypoint wiring.
0.1.1 (2023-06-22)
- Update packaging method to
pyproject.toml.
0.0.1 (2022-11-07)
- First release
Metadata
Release files for aspect-ratio-too 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aspect_ratio_too-0.2.0.tar.gz | 70.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aspect_ratio_too-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.0 kB
Release files / aspect_ratio_too-0.2.0.tar.gz
| Download URL | aspect_ratio_too-0.2.0.tar.gz |
|---|---|
| Size | 70.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12369c5caecb370158d942cca39251971a09c1ea17b050892fc6c22df643658d
|
|
BLAKE2b-256 checksum How to use checksums |
ee553345a5328d8789cb5369c10b451fe0fe6004c8d1e6ea3cf63809c01cfed6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.1
|
Release files / aspect_ratio_too-0.2.0-py3-none-any.whl
| Download URL | aspect_ratio_too-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bfa296c2983f51ee183fa55bbe6b77fec663c31a442e9db131e17ad697e844fc
|
|
BLAKE2b-256 checksum How to use checksums |
7f973506a8968b417a690cc921c4287690bd34269bbc58cb28942752d19cbfb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.1
|