Skip to main content

Aspect ratio calculations.

Project description

Aspect Ratio Too

Overview

Aspect ratio calculations.

Installation

pip install aspect-ratio-too

Development

make env
make reqs
pip install -e .

Testing

pytest

Usage

Know the aspect ratio you want but don't 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 know 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

Issues

If you experience any issues, please create an issue on Bitbucket.

History

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

aspect_ratio_too-0.1.1-py2.py3-none-any.whl (4.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file aspect_ratio_too-0.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for aspect_ratio_too-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f6148c098aab83ee9ac065b0cd33b4194c553bac194742cb212eeb6be0fe4453
MD5 aa923fc9ceaf636d5226adff76d02890
BLAKE2b-256 92194fe9a0c58cc62445e154aac498c6b95188004a0fc27c819da8d507150add

See more details on using hashes here.

Supported by

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