pyoxipng
Python wrapper for multithreaded .png image file optimizer oxipng
What it is and what it does
pyoxipng is a Python wrapper around a multithreaded PNG optimizer written in Rust. It provides three main ways to optimize PNG images: compress files on disk, process PNG data already in memory, or create optimized PNGs from raw image data. The package supports multiple color types (grayscale, RGB, indexed, RGBA) and bit depths, plus advanced options like compression level, interlacing, alpha optimization, and bit depth reduction.
The wrapper has no Python runtime dependencies, relying entirely on precompiled Rust binaries. It's designed for developers who need to reduce PNG file sizes programmatically—either in batch processing pipelines, image serving infrastructure, or tools that generate PNGs. The underlying engine handles the heavy lifting with multithreading, so the Python layer is thin and fast.
Use it for:
- Batch-optimize PNG images in a web asset pipeline before deployment to reduce bandwidth and load times.
- Compress PNG screenshots or generated graphics in automated testing or documentation workflows.
- Reduce file sizes of PNGs created from raw pixel data before storage or transmission.
- Optimize PNG images in a content management system or image processing service.
- Create optimized PNG output from indexed color or grayscale data with custom color profiles or transparency.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pyoxipng reduces PNG file sizes through compression, offering file-based and in-memory optimization plus the ability to create PNGs from raw image data.
Yes, if you need to optimize PNG files in Python and want a fast, dependency-free solution. The prebuilt wheels make installation straightforward on common platforms. The aging maintenance status (358 days since last release) is a minor concern but not a blocker—the package is stable and has no known vulnerabilities. Install if PNG optimization is a core need; skip if you only occasionally compress images.
Install
pyoxipng on PyPI
pip
pip install pyoxipnguv
uv add pyoxipngpoetry
poetry add pyoxipngInstalling pyoxipng
Before you install
Medium install friction due to compiled wheels; prebuilt binaries are available for Python 3.10 and 3.11 across macOS, Linux, Windows, and musl environments. Repository shows aging maintenance (358 days since last release) but remains active with no archived status.
License in practice
Licensed under MIT (permissive), allowing use in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install pyoxipng
import pyoxipng
# Optimize a PNG file on disk
pyoxipng.optimize("/path/to/image.png")
# Or optimize and save to a new location
pyoxipng.optimize("/path/to/image.png", "/path/to/optimized.png")
Requires Python >=3.8; prebuilt wheels available for Python 3.10 and 3.11 on common platforms.
Verify before relying
- Actual file size reduction achieved on typical PNG images (varies by image type and optimization level)
- Performance characteristics compared to other PNG optimizers or the native CLI tool
- Whether the package is actively maintained beyond the 358-day release cycle
- Support for Python versions other than 3.10 and 3.11 (fact sheet shows wheels only for these versions)
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | aging — 358 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 84,814/month — #13,969 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyoxipng-9.1.1-cp310-cp310-macosx_10_12_x86_64.whl; pyoxipng-9.1.1-cp310-cp310-macosx_11_0_arm64.whl; pyoxipng-9.1.1-cp310-cp310-manylinux_2_28_aarch64.whl; pyoxipng-9.1.1-cp310-cp310-manylinux_2_28_x86_64.whl; pyoxipng-9.1.1-cp310-cp310-musllinux_1_2_aarch64.whl; pyoxipng-9.1.1-cp310-cp310-musllinux_1_2_armv7l.whl; pyoxipng-9.1.1-cp310-cp310-musllinux_1_2_i686.whl; pyoxipng-9.1.1-cp310-cp310-musllinux_1_2_x86_64.whl; pyoxipng-9.1.1-cp310-cp310-win32.whl; pyoxipng-9.1.1-cp310-cp310-win_amd64.whl; pyoxipng-9.1.1-cp311-cp311-macosx_10_12_x86_64.whl; pyoxipng-9.1.1-cp311-cp311-macosx_11_0_arm64.whl; pyoxipng-9.1.1-cp311-cp311-manylinux_2_28_aarch64.whl; pyoxipng-9.1.1-cp311-cp311-manylinux_2_28_x86_64.whl; pyoxipng-9.1.1-cp311-cp311-musllinux_1_2_aarch64.whl; pyoxipng-9.1.1-cp311-cp311-musllinux_1_2_armv7l.whl; pyoxipng-9.1.1-cp311-cp311-musllinux_1_2_i686.whl; pyoxipng-9.1.1-cp311-cp311-musllinux_1_2_x86_64.whl; pyoxipng-9.1.1-cp311-cp311-win32.whl; pyoxipng-9.1.1-cp311-cp311-win_amd64.whl
Keywords: rust, image, optimize, optimizer, optimization, compress, png
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pypngPyPNG reads and writes PNG image files in pure…
permissive · top 5,000 on PyPI
pyjpeglsEncodes and decodes image data using the…
permissive · top 15,000 on PyPI
pixelhogCompares PNG screenshots pixel-by-pixel and…
permissive · top 5,000 on PyPI
cramjamProvides fast Python bindings to multiple…
permissive · top 1,000 on PyPI
qoiA Python wrapper for the QOI (Quite OK Image)…
permissive · top 15,000 on PyPI
epaper-ditheringConverts images to dithered output optimized…
permissive · top 15,000 on PyPI
img2pdfConverts raster images to PDF without…
copyleft · top 5,000 on PyPI
onnxslimOnnxSlim reduces the size and operator count of…
permissive · top 5,000 on PyPI
blurhashEncodes images into compact blurhash text…
permissive · top 15,000 on PyPI