High-quality image compression like TinyPNG and Squoosh
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysqueeze-0.1.1.tar.gz.
File metadata
- Download URL: pysqueeze-0.1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5780a730791000413ddfdf7ba54f992b5f0da8920521fef7f243ea2b634b3cd8
|
|
| MD5 |
74cbf112bce2103c0a1b8b45e385e398
|
|
| BLAKE2b-256 |
2f1e4bcca749fb9aa1e2c597a648194d6e215d1a31c1f69013fb0ba55350604c
|
Provenance
The following attestation bundles were made for pysqueeze-0.1.1.tar.gz:
Publisher:
publish.yml on Gerard-007/pysqueeze
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysqueeze-0.1.1.tar.gz -
Subject digest:
5780a730791000413ddfdf7ba54f992b5f0da8920521fef7f243ea2b634b3cd8 - Sigstore transparency entry: 788138020
- Sigstore integration time:
-
Permalink:
Gerard-007/pysqueeze@d4656206f75555e77530d6fba8282e9c0dd0eae6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Gerard-007
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d4656206f75555e77530d6fba8282e9c0dd0eae6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pysqueeze-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pysqueeze-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db4d2a1c911adb153db449dcb7de3bad0e8edd2c323dfb98afd69296cc88ea2f
|
|
| MD5 |
e8668a9d4d1d68b5a79fe5d7b8bdac29
|
|
| BLAKE2b-256 |
dbc1fd7a941b332b8e82a387b3bccd197adfce79fd2848d4eb190e9df37392a9
|
Provenance
The following attestation bundles were made for pysqueeze-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Gerard-007/pysqueeze
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysqueeze-0.1.1-py3-none-any.whl -
Subject digest:
db4d2a1c911adb153db449dcb7de3bad0e8edd2c323dfb98afd69296cc88ea2f - Sigstore transparency entry: 788138022
- Sigstore integration time:
-
Permalink:
Gerard-007/pysqueeze@d4656206f75555e77530d6fba8282e9c0dd0eae6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Gerard-007
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d4656206f75555e77530d6fba8282e9c0dd0eae6 -
Trigger Event:
release
-
Statement type: