imagesize
Get image size from headers (BMP/PNG/JPEG/JPEG2000/GIF/TIFF/SVG/Netpbm/WebP/AVIF/HEIC/HEIF)
Install
imagesize on PyPI
pip
pip install imagesizeuv
uv add imagesizepoetry
poetry add imagesizePackage facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<3.15,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 163 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: imagesize-2.0.0-py2.py3-none-any.whl
About imagesize
from the package's own PyPI description — quoted content, verbatim
imagesize
.. image:: https://github.com/shibukawa/imagesize_py/actions/workflows/ci.yml/badge.svg :target: https://github.com/shibukawa/imagesize_py/actions/workflows/ci.yml
.. image:: https://img.shields.io/pypi/v/imagesize.svg :target: https://pypi.org/project/imagesize/ :alt: PyPI version
.. image:: https://img.shields.io/pypi/pyversions/imagesize.svg :target: https://pypi.org/project/imagesize/ :alt: Supported Python versions
.. image:: https://img.shields.io/pypi/l/imagesize.svg :target: https://github.com/shibukawa/imagesize_py/blob/main/LICENSE.rst :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...
Read as markdown · JSON record · Source repository · Homepage
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
Analyzes image file headers to extract size, DPI, and metadata (rotation, color depth, channels) for JPEG, PNG, GIF, TIFF, SVG, WebP, BMP, AVIF, HEIC, and HEIF formats without loading pixel data.
Installs with zero runtime dependencies and low friction. Actively maintained with a recent release (163 days ago) and continuous CI/CD; repo shows 253 stars and current Python 3.10–3.14 support.
MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
Usage
pip install imagesize
import imagesize
width, height = imagesize.get('test.png')
print(width, height)
info = imagesize.get_info('test.png')
print(info.width, info.height, info.xdpi, info.ydpi)
Requires Python 3.10 or later (supports up to 3.14).
Verdict: A lightweight, actively maintained pure-Python library for rapid image metadata extraction. Zero dependencies, permissive MIT license, no known vulnerabilities, and top-1000 popularity make it a low-risk choice for projects needing fast header parsing without the overhead of image processing libraries.
Needs verification
- Whether the package handles corrupted or truncated image files gracefully beyond the documented (-1, -1) return values.
- Performance characteristics with very large files or streams beyond the 125 kB benchmark cited.
Similar packages
permissive · top 1,000 on PyPI
pdf2imagepermissive · top 1,000 on PyPI
qrcodepermissive · top 1,000 on PyPI
ImageIOpermissive · top 1,000 on PyPI
tifffilepermissive · top 1,000 on PyPI
html5libpermissive · top 1,000 on PyPI
pytesseractpermissive · top 1,000 on PyPI
xlsxwriterpermissive · top 1,000 on PyPI
fastavropermissive · top 1,000 on PyPI
pillowpermissive · top 100 on PyPI