--- id: imagesize version: "2.0.0" license: MIT license_treatment: permissive maintenance: active --- # imagesize — Get image size from headers (BMP/PNG/JPEG/JPEG2000/GIF/TIFF/SVG/Netpbm/WebP/AVIF/HEIC/HEIF) License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install imagesize uv add imagesize poetry add imagesize ## Description 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... ## AI interpretation — verify before relying 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. 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. [View on SkillFed](https://skillfed.io/packages/imagesize) · [View on PyPI](https://pypi.org/project/imagesize/)