python-pixel-sizes
Usage
from pixel_sizes import SIZES
SIZES['Full HD'].width # 1920
SIZES['Full HD'].height # 1080
SIZES['Full HD'].aspect_ratio() # 16/9 == 1.7777777777777777
SIZES['Full HD'].aspect_ratio_fraction() # (16, 9)
SIZES['Full HD'].rotate() # Size(width=1080, height=1920)
SIZES['Full HD'].scale(2) # Size(width=3840, height=2160)
API
Size
| Attribute / Method | Description |
|---|---|
width: int |
Width in pixels |
height: int |
Height in pixels |
aspect_ratio() -> float |
Width / height as a float |
aspect_ratio_fraction() -> tuple[int, int] |
Aspect ratio reduced to lowest terms, e.g. (16, 9) |
rotate() -> Size |
New Size with width and height swapped |
scale(factor: int | float) -> Size |
New Size multiplied by factor |
SIZES
A read-only mapping of type Mapping[str, Size] containing named display
resolutions. Attempting to assign or delete entries raises TypeError.
Representative keys (full list in source):
"480p", "720p", "1080p", "Full HD", "HD 1080p",
"WQHD", "4K UHD", "8K UHD", ...
Iterate all available names:
from pixel_sizes import SIZES
list(SIZES.keys())
Development
This repository uses lefthook to run the same checks as CI locally, so problems surface before they reach CI.
# Install dependencies
uv sync
# Install the Git hooks (once; requires lefthook on your PATH)
lefthook install
Once installed, the hooks run automatically:
- pre-commit:
uv run poe check - pre-push:
uv run poe checkanduv run poe test
You can also run the checks manually:
uv run poe check
uv run poe test
CI still runs the full matrix (see .github/workflows/); the hooks only bring that
feedback earlier on your machine.
LICENSE
The 3-Clause BSD License. See also LICENSE file.
Metadata
Release files for pixel-sizes 0.4.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 | Provenance | Actions |
|---|---|---|---|---|
| pixel_sizes-0.4.0.tar.gz | 51.9 kB | With provenance | Details for pixel_sizes-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pixel_sizes-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for pixel_sizes-0.4.0-py3-none-any.whl |
Total release size: 58.8 kB
Release files / pixel_sizes-0.4.0.tar.gz
| Download URL | pixel_sizes-0.4.0.tar.gz |
|---|---|
| Size | 51.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d8211a32a7ad0387377f743f9120f51bdae92979218c69fdb58e83aa93630bb
|
|
BLAKE2b-256 checksum How to use checksums |
2e560082040445e220716d11b9dce5f2cfe16a1af780b5479e61a7882f96a46e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / pixel_sizes-0.4.0-py3-none-any.whl
| Download URL | pixel_sizes-0.4.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7c4936636ab22b5d1b1cb89af2527f1329560590b57bf1876dc3048758eafbd
|
|
BLAKE2b-256 checksum How to use checksums |
1e7a366dc18eb9f17d79cb322c3ba033bf43da9e2da2b5f6ae2c7ee288194b04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for pixel-sizes 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pixel_sizes-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.