Skip to main content

ZopfliPNG wrapper for python

This library wraps the zopflipng extension to implement lossless compression of PNG.

  • Lossless compression of PNGS implemented by zopfli typically results in a compression ratio of 5% more than other lossless compression tools at the expense of longer compression time.

Install

pip install zopflipng

Usage:

# a simple example, using the default configuration

from zopflipng import png_optimize

data = open('test.png', 'rb').read()
result, code = png_optimize(data)
# if code ==0 ,png compression success
if code == 0:
   # save png
   with open('result.png','wb') as f:
       f.write(result)
       f.close()

  • Use quick, but not very good, compression:
result, code = png_optimize(data, use_zopfli=False)
  • Compress really good and trying all filter strategies:
result, code = png_optimize(data, lossy_8bit=True, lossy_transparent=True, filter_strategies='01234mepb', num_iterations=500)

If you want to process multiple images, use multiprocessing

Metadata

Release files for zopflipng 1.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 zopflipng 1.1.1
File Size Uploaded Provenance Actions
zopflipng-1.1.1.tar.gz 158.0 kB Without provenance Details for zopflipng-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zopflipng 1.1.1
File Interpreter ABI Platform Actions
zopflipng-1.1.1-cp39-cp39-macosx_10_9_universal2.whl CPython 3.9 CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) Details for zopflipng-1.1.1-cp39-cp39-macosx_10_9_universal2.whl

Total release size: 448.9 kB

Release files / zopflipng-1.1.1.tar.gz

Download URL zopflipng-1.1.1.tar.gz
Size 158.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5505335aa5d5292e2c81adb8edaea82e44025d86b8d482f5af3c1202ed10ccc3
BLAKE2b-256 checksum
How to use checksums
09118e22899d516a2bd09b1138e243b42c8179bd504ec31ff1d3a464d8e1cbea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Release files / zopflipng-1.1.1-cp39-cp39-macosx_10_9_universal2.whl

Download URL zopflipng-1.1.1-cp39-cp39-macosx_10_9_universal2.whl
Size 290.9 kB
Tags CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
2f70ed9f753c76e5dca6dbc88bf3d32c854ace7dc273d4dd4450793de6699c57
BLAKE2b-256 checksum
How to use checksums
1028bf3fd12a8d649efe96d69e1a65487cdfa1b10e3bca4d39d8efee59627e69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Security for zopflipng 1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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