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://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

Requirements

  • Python 2.7 or 3.4+

Installation

$ pip install zopflipy

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.1
Filename, size File type Python version Upload date Hashes
Filename, size zopflipy-1.1-cp27-cp27m-win32.whl (89.0 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size zopflipy-1.1-cp27-cp27m-win_amd64.whl (114.8 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size zopflipy-1.1-cp34-cp34m-win32.whl (89.1 kB) File type Wheel Python version cp34 Upload date Hashes View hashes
Filename, size zopflipy-1.1-cp34-cp34m-win_amd64.whl (108.1 kB) File type Wheel Python version cp34 Upload date Hashes View hashes
Filename, size zopflipy-1.1-cp35-cp35m-win32.whl (83.3 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size zopflipy-1.1-cp35-cp35m-win_amd64.whl (100.8 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size zopflipy-1.1-cp36-cp36m-win32.whl (83.3 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size zopflipy-1.1-cp36-cp36m-win_amd64.whl (100.8 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size zopflipy-1.1-cp37-cp37m-win32.whl (83.3 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size zopflipy-1.1-cp37-cp37m-win_amd64.whl (100.8 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size zopflipy-1.1.zip (176.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page