LLM-native image optimization — reduces vision model token consumption by snapping to tile boundaries
Project description
vision-squeezer (Python)
Python bindings for vision-squeezer — LLM-native image optimization. Reduces vision model token consumption by snapping to tile boundaries.
Install
pip install vision-squeezer
From source (requires Rust + pip install maturin):
cd python && maturin develop --release
Usage
import vision_squeezer as vs
# Optimize an image on disk and write next to it.
report = vs.optimize_image(
"screenshot.png",
model="claude",
quality=75,
output_path="screenshot.optimized.jpg",
)
print(f"Saved {report['tokens_saved']} tokens, {report['size_reduction_pct']:.1f}% smaller")
# Or work with raw bytes.
with open("screenshot.png", "rb") as f:
raw = f.read()
report = vs.optimize_image(raw, model="gpt4o", format="webp")
# report["bytes"] holds the optimized image
# report["base64"] is the same image, base64-encoded
# Estimate tokens without optimizing.
est = vs.estimate_tokens(4096, 3072, model="claude")
print(est) # {'model': 'claude', 'tokens': ..., 'tiles': ...}
# Optimal send dimensions for a given model.
print(vs.optimal_dimensions(4096, 3072, model="gpt4o"))
Supported models
claude(3.5 / 4.x — area-based token estimation)gpt4o(GPT-4o / 4.5 — 2048 fit then 768 short-side, 512px tiles)gpt5(GPT-5/5.5 — 6000px max, 10.24M pixel cap, 1536 token cap)gemini(Gemini 2.0/3.0 — flat 258 ≤384×384, else 768px tiles)
Output formats
jpeg (default) and webp. Format affects bytes, not tokens.
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 Distributions
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 vision_squeezer-0.6.0.tar.gz.
File metadata
- Download URL: vision_squeezer-0.6.0.tar.gz
- Upload date:
- Size: 10.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f62138447dab0bcec38e63e5f19909931c985c2e17af24e3fbafe2ddea4d250a
|
|
| MD5 |
41b920291a487a3016f1660c04f8b324
|
|
| BLAKE2b-256 |
9fc984f6affe781f90c38fc6983e9c5d7a79047cfd3e86dca8667c4b7b7dd9e2
|
Provenance
The following attestation bundles were made for vision_squeezer-0.6.0.tar.gz:
Publisher:
python.yml on eralpozcan/vision-squeezer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vision_squeezer-0.6.0.tar.gz -
Subject digest:
f62138447dab0bcec38e63e5f19909931c985c2e17af24e3fbafe2ddea4d250a - Sigstore transparency entry: 1887488034
- Sigstore integration time:
-
Permalink:
eralpozcan/vision-squeezer@52b0d13db1dfb33b3fcb2654adcfc262785d38d9 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/eralpozcan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@52b0d13db1dfb33b3fcb2654adcfc262785d38d9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file vision_squeezer-0.6.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: vision_squeezer-0.6.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a9daf82022bb8aa9aac19065035fd197eb21787aba33f820f4f0bfe4359ba42
|
|
| MD5 |
99a5cf5dfa3f7c1e19b1424818240774
|
|
| BLAKE2b-256 |
c69b36ee3f54ad7113dc4506d0dddc6ffd7e23b106bcb62c0b28b25ba0314d99
|
Provenance
The following attestation bundles were made for vision_squeezer-0.6.0-cp38-abi3-win_amd64.whl:
Publisher:
python.yml on eralpozcan/vision-squeezer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vision_squeezer-0.6.0-cp38-abi3-win_amd64.whl -
Subject digest:
1a9daf82022bb8aa9aac19065035fd197eb21787aba33f820f4f0bfe4359ba42 - Sigstore transparency entry: 1887488283
- Sigstore integration time:
-
Permalink:
eralpozcan/vision-squeezer@52b0d13db1dfb33b3fcb2654adcfc262785d38d9 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/eralpozcan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@52b0d13db1dfb33b3fcb2654adcfc262785d38d9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file vision_squeezer-0.6.0-cp38-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: vision_squeezer-0.6.0-cp38-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.8+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02c1d9fb543f519beb95579de6adc52d81dab103ef9c16505d87ba77dfe61d20
|
|
| MD5 |
353556f28068b80a88c68ef1932bb892
|
|
| BLAKE2b-256 |
845f2d6828346fc74c4487e644d740013e6ce21a1ce7e3c0bda3a65e0dab2b6f
|
Provenance
The following attestation bundles were made for vision_squeezer-0.6.0-cp38-abi3-manylinux_2_28_x86_64.whl:
Publisher:
python.yml on eralpozcan/vision-squeezer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vision_squeezer-0.6.0-cp38-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
02c1d9fb543f519beb95579de6adc52d81dab103ef9c16505d87ba77dfe61d20 - Sigstore transparency entry: 1887488571
- Sigstore integration time:
-
Permalink:
eralpozcan/vision-squeezer@52b0d13db1dfb33b3fcb2654adcfc262785d38d9 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/eralpozcan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@52b0d13db1dfb33b3fcb2654adcfc262785d38d9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file vision_squeezer-0.6.0-cp38-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: vision_squeezer-0.6.0-cp38-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.8+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07e3c42097d26464bb579950b47e3784717c1bb096754b161324c4bdf6ccc289
|
|
| MD5 |
3c0457d63848aabd9775302b13fb94c6
|
|
| BLAKE2b-256 |
4b0e42553818fd874d5e9f95d82ec59af7bc191952892212ab99c46af3ebfc7a
|
Provenance
The following attestation bundles were made for vision_squeezer-0.6.0-cp38-abi3-manylinux_2_28_aarch64.whl:
Publisher:
python.yml on eralpozcan/vision-squeezer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vision_squeezer-0.6.0-cp38-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
07e3c42097d26464bb579950b47e3784717c1bb096754b161324c4bdf6ccc289 - Sigstore transparency entry: 1887488705
- Sigstore integration time:
-
Permalink:
eralpozcan/vision-squeezer@52b0d13db1dfb33b3fcb2654adcfc262785d38d9 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/eralpozcan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@52b0d13db1dfb33b3fcb2654adcfc262785d38d9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file vision_squeezer-0.6.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: vision_squeezer-0.6.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
827c0b404e42768d05bafa2a34aa7117b584692f156a4df79473f4e2084b427b
|
|
| MD5 |
e3caaddc13ecdf2b7f5487bb6fb652ba
|
|
| BLAKE2b-256 |
652785404e48cb6503f397ba39192d3873e85c15fb4554051bcff6824f6cb483
|
Provenance
The following attestation bundles were made for vision_squeezer-0.6.0-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
python.yml on eralpozcan/vision-squeezer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vision_squeezer-0.6.0-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
827c0b404e42768d05bafa2a34aa7117b584692f156a4df79473f4e2084b427b - Sigstore transparency entry: 1887488437
- Sigstore integration time:
-
Permalink:
eralpozcan/vision-squeezer@52b0d13db1dfb33b3fcb2654adcfc262785d38d9 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/eralpozcan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@52b0d13db1dfb33b3fcb2654adcfc262785d38d9 -
Trigger Event:
push
-
Statement type: