skillfed

imagesize

Get image size from headers (BMP/PNG/JPEG/JPEG2000/GIF/TIFF/SVG/Netpbm/WebP/AVIF/HEIC/HEIF)

imagesize Permissive license MIT Active 253 v2.0.0 released

Install

imagesize on PyPI

pip

pip install imagesize

uv

uv add imagesize

poetry

poetry add imagesize

Package 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Multimedia :: Graphics

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.
image size extractionget image dimensionsimage metadata parserDPI detectionimage header analysisfast image infopure python image reader

Similar packages