Skip to main content

pysqueeze

pysqueeze is a high-quality image compression library for Python, inspired by tools like TinyPNG and Squoosh. It focuses on achieving significant file size reduction while preserving perceptual image quality.

The library is designed for developers who need reliable, automated image optimization for web, mobile, and backend pipelines.

Key Features

  • Convert JPG and PNG images to WebP or AVIF
  • Perceptual compression with sensible defaults
  • Target file size compression (TinyPNG-like behavior)
  • Automatic format selection (WebP vs AVIF)
  • Metadata stripping for smaller output files
  • Simple Python API and command-line interface
  • Cross-platform support (Windows, macOS, Linux)

Install

pip install pysqueeze

Standard compression (default)

from pysqueeze import compress
compress("input.jpg", "output.webp")

Target file size compression

from pysqueeze import compress
compress(
    "input.jpg",
    "output.webp",
    mode="target",
    target_kb=200,
)

Automatic format selection (best result)

from pysqueeze import compress
compress(
    "input.jpg",
    "output",
    mode="auto",
)

Standard compression

pysqueeze input.jpg -o output.webp

Target file size (TinyPNG-style)

pysqueeze input.jpg -o output.webp --mode target --target-kb 200

Automatic format selection

pysqueeze input.jpg -o output --mode auto

Options

Option Description
--mode standard, target, or auto
--max-size Maximum width/height in pixels (default: 1600)
--format Output format (webp or avif, ignored in auto mode)
--quality Compression quality override
--target-kb Target file size in KB (required for target mode)

LICENSE

MIT License

Project Status

pysqueeze is actively developed and suitable for production use. Contributions, issues, and feature requests are welcome.

Metadata

Release files for pysqueeze 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysqueeze 0.1.1
File Size Uploaded Provenance
pysqueeze-0.1.1.tar.gz 4.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pysqueeze 0.1.1
File Interpreter ABI Platform
pysqueeze-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / pysqueeze-0.1.1.tar.gz

Download URL pysqueeze-0.1.1.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5780a730791000413ddfdf7ba54f992b5f0da8920521fef7f243ea2b634b3cd8
BLAKE2b-256 checksum
How to use checksums
2f1e4bcca749fb9aa1e2c597a648194d6e215d1a31c1f69013fb0ba55350604c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 2, 2026.

Transparency log

Release files / pysqueeze-0.1.1-py3-none-any.whl

Download URL pysqueeze-0.1.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db4d2a1c911adb153db449dcb7de3bad0e8edd2c323dfb98afd69296cc88ea2f
BLAKE2b-256 checksum
How to use checksums
dbc1fd7a941b332b8e82a387b3bccd197adfce79fd2848d4eb190e9df37392a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 2, 2026.

Transparency log

Security for pysqueeze 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pysqueeze-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page