Aspect ratio calculations.
Project description
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aspect_ratio_too-0.2.0.tar.gz.
File metadata
- Download URL: aspect_ratio_too-0.2.0.tar.gz
- Upload date:
- Size: 70.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12369c5caecb370158d942cca39251971a09c1ea17b050892fc6c22df643658d
|
|
| MD5 |
94da179e62a576ac5ecc66d5f498e050
|
|
| BLAKE2b-256 |
ee553345a5328d8789cb5369c10b451fe0fe6004c8d1e6ea3cf63809c01cfed6
|
File details
Details for the file aspect_ratio_too-0.2.0-py3-none-any.whl.
File metadata
- Download URL: aspect_ratio_too-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfa296c2983f51ee183fa55bbe6b77fec663c31a442e9db131e17ad697e844fc
|
|
| MD5 |
c589417d7538ec8244b4ffd095bfbd94
|
|
| BLAKE2b-256 |
7f973506a8968b417a690cc921c4287690bd34269bbc58cb28942752d19cbfb0
|