Skip to main content

A Python bindings for Zopfli

Project description

A Python bindings for Zopfli.

https://img.shields.io/pypi/v/zopflipy.svg https://github.com/hattya/zopflipy/actions/workflows/ci.yml/badge.svg https://semaphoreci.com/api/v1/hattya/zopflipy/branches/master/badge.svg https://ci.appveyor.com/api/projects/status/98a7e7d6qlkvs6vl/branch/master?svg=true https://codecov.io/gh/hattya/zopflipy/branch/master/graph/badge.svg

Installation

$ pip install zopflipy

Requirements

  • Python 3.6+
  • setuptools

Usage

ZopfliCompressor

>>> import zopfli
>>> c = zopfli.ZopfliCompressor(zopfli.ZOPFLI_FORMAT_DEFLATE)
>>> z = c.compress(b'Hello, world!') + c.flush()
>>> d = zopfli.ZopfliDecompressor(zopfli.ZOPFLI_FORMAT_DEFLATE)
>>> d.decompress(z) + d.flush()
b'Hello, world!''

ZopfliDeflater

>>> import zopfli
>>> c = zopfli.ZopfliDeflater()
>>> z = c.compress(b'Hello, world!') + c.flush()
>>> d = zopfli.ZopfliDecompressor(zopfli.ZOPFLI_FORMAT_DEFLATE)
>>> d.decompress(z) + d.flush()
b'Hello, world!''

ZopfliPNG

>>> import zopfli
>>> png = zopfli.ZopfliPNG()
>>> with open('in.png', 'rb') as fp:
...     data = fp.read()
>>> len(png.optimize(data)) < len(data)
True

License

ZopfliPy is distributed under the terms of the Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for zopflipy, version 1.6
Filename, size File type Python version Upload date Hashes
Filename, size zopflipy-1.6-cp36-cp36m-win32.whl (87.9 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size zopflipy-1.6-cp36-cp36m-win_amd64.whl (107.3 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size zopflipy-1.6-cp37-cp37m-win32.whl (87.9 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size zopflipy-1.6-cp37-cp37m-win_amd64.whl (107.3 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size zopflipy-1.6-cp38-cp38-win32.whl (88.0 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size zopflipy-1.6-cp38-cp38-win_amd64.whl (107.5 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size zopflipy-1.6-cp39-cp39-win32.whl (91.1 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size zopflipy-1.6-cp39-cp39-win_amd64.whl (114.9 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size zopflipy-1.6.zip (207.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page