Skip to main content

Aspect ratio calculations.

Project description

Aspect Ratio Too

Coverage

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-ratio CLI wrapper command.
  • Added optional cli dependencies (click and rich) 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aspect_ratio_too-0.2.0.tar.gz (70.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aspect_ratio_too-0.2.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

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

Hashes for aspect_ratio_too-0.2.0.tar.gz
Algorithm Hash digest
SHA256 12369c5caecb370158d942cca39251971a09c1ea17b050892fc6c22df643658d
MD5 94da179e62a576ac5ecc66d5f498e050
BLAKE2b-256 ee553345a5328d8789cb5369c10b451fe0fe6004c8d1e6ea3cf63809c01cfed6

See more details on using hashes here.

File details

Details for the file aspect_ratio_too-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aspect_ratio_too-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfa296c2983f51ee183fa55bbe6b77fec663c31a442e9db131e17ad697e844fc
MD5 c589417d7538ec8244b4ffd095bfbd94
BLAKE2b-256 7f973506a8968b417a690cc921c4287690bd34269bbc58cb28942752d19cbfb0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page