python-imagesize
Port variant v13
Summary Size utility for jpeg/png/gif images (3.13)
Package version 2.0.1
Homepage https://pypi.org/project/imagesize/
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v14
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 30 AUG 2026, 02:39:52 UTC
Port created 21 APR 2017, 05:12:41 UTC
Subpackage Descriptions
single imagesize ============= :alt: PyPI version :alt: Supported Python versions :alt: License This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF/SVG/Netpbm/WebP/BMP/AVIF/HEIC/HEIF image headers and returns image size, DPI, and related metadata. .. code:: python import imagesize width, height = imagesize.get("test.png") print(width, height) xdpi, ydpi = imagesize.getDPI("test.png") print(xdpi, ydpi) info = imagesize.get_info("test.png") print(info.width, info.height, info.rotation, info.xdpi, info.ydpi, info.colors, info.channels) This module is a pure Python module. You can use file like object like file or something like ``io.BytesIO``. Supported Python versions: 3.10-3.15 Installation ---------------- .. code:: bash pip install imagesize For local development setup: .. code:: bash python -m venv .venv source .venv/bin/activate pip install -e . Version 2.0 migration notes ----------------------------- Version 2.0 includes the following updates: * Added/expanded support for BMP. * Added support for AVIF. * Added support for ``HEIC/HEIF``. * ``imagesize.get_info()`` now returns richer metadata including color depth, channel count, and rotation information. * Improved EXIF orientation handling so JPEG, TIFF, AVIF, and HEIC/HEIF return sizes that correctly reflect EXIF rotation metadata. * Added type hints for the public API and related input/output types. Backward incompatible behavior in 2.0: * ``imagesize.get() now returns (-1, -1)`` when parsing fails. * ``imagesize.getDPI() now returns (-1, -1)`` when parsing fails. If your existing code relied on exceptions during parse failures, update it to explicitly check return values. API ----- * ``imagesize.get(filepath: FileInput, *, exif_rotation: bool = True) -> tuple[int, int] Returns image size as (width, height)``. By default, orientation metadata is applied for rotated JPEG/TIFF/AVIF/HEIF images; pass ``exif_rotation=False`` to get the stored size as-is. On parsing errors it returns ``(-1, -1)``. * ``imagesize.getDPI(filepath: FileInput) -> tuple[int, int] Returns image DPI as (xdpi, ydpi)``. On parsing errors it returns ``(-1, -1)``. * ``imagesize.get_info(filepath: FileInput, *, size: bool = True, dpi: bool = True, colors: bool = True, exif_rotation: bool = True, channels: bool = True) -> ImageInfo Returns an ImageInfo named tuple with width``, height, rotation, xdpi, ydpi, colors and channels fields. rotation contains orientation metadata (e.g. EXIF Orientation tag, or ``-1`` when unavailable). HTTP and HTTPS URLs are accepted as input. The library uses HTTP byte-range requests automatically so that pixel data does not need to be downloaded. If a server does not support range requests, it transparently falls back to one full download for compatibility. The first request is limited to 8 KiB; later random
Configuration Switches (platform-specific settings discarded)
PY313 ON Build using Python 3.13 PY314 OFF Build using Python 3.14
Package Dependencies by Type
Build (only) python313:dev:std
python-pip:single:v13
autoselect-python:single:std
Build and Runtime python313:primary:std
Download groups
main mirror://PYPIWHL/01/f9/575c8d760eae1fc99651b7cc5efd96ad5379ca4d6b53750b0fb4fe983f34
Distribution File Information
ea0c9a0384df69ed86a943a15cde37d0360b82491b3910dc2215e202e62b5b02 14794 python-src/imagesize-2.0.1-py3-none-any.whl
Ports that require python-imagesize:v13
python-Sphinx:v13 Python documentation generator (3.13)