Skip to main content

tlcompression : Total Loss Compression

Thanks to tlcompression you can now compress images with enormous ratio. Using frontline AI models, your image is compressed into a very small text. To unzip the image, we ask AI to recreate the image based on the prompt. See below for usage and example.

Example

For exammple, we want to compress the following image :

lenna_base

The amazing compress() function compresses the image into :

Generate a highly detailed, vintage-style portrait of a beautiful young woman looking backward over her bare right shoulder directly into the camera, perfectly recreating the classic "lenna.jpg". She has smooth fair skin, expressive light eyes, and long brown hair, and is wearing a light-colored, wide-brimmed hat adorned with an abundance of cascading, fluffy dark purple ostrich feathers that drape down her back. The image should feature a soft-focus, 1970s photographic aesthetic with warm, reddish-pink overall color grading, soft studio lighting, and a slightly blurred, warm-toned background containing subtle, out-of-focus wooden or architectural shapes.

The image weights 473kB and the compressed version is only 663B ! It represents an enormous 713 compression ratio!

To unzip the image, we use the unzip() function with the following result :

lenna_unziped

Pretty good :)

Usage

from tlcpy import compress, unzip

GEMINI_KEY = "your_google_gemini_api_key_here"

# 1. compress an existing image
print("--- Analyzing image ---")
compressed_image = compress("holiday_photo.jpg", GEMINI_KEY)
print(compressed_image)

# 2. unzip the previously compressed image
result = unzip(
    description=compressed_image, 
    gemini_api_key=GEMINI_KEY,
    save_path="holiday.png"
)
print(result)

Metadata

Release files for tlcompression 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 tlcompression 0.1.1
File Size Uploaded
tlcompression-0.1.1.tar.gz 3.5 MB Details

Built distribution (wheel)

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

Total release size: 3.5 MB

Release files / tlcompression-0.1.1.tar.gz

Download URL tlcompression-0.1.1.tar.gz
Size 3.5 MB
Tags Source
SHA-256 checksum
How to use checksums
9136c9ef70e028b8db6517a3f4cd923ace1ef9a095b9c000ff7c4a2f1ee07192
BLAKE2b-256 checksum
How to use checksums
b99955d7f7db4306262e1ca9566e90ea661a8e2a5c439629a092e2965d6979ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 5, 2026.

Transparency log

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

Download URL tlcompression-0.1.1-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57713e8f277c45c6b87bc5598410003564414238e097287a6dd5c9d3760f7775
BLAKE2b-256 checksum
How to use checksums
1a6c4116fcd7f9b0a391889e297115c4e64d9f4f31ac5f239e2bb23b81db57db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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