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.

Filename, size & hash SHA256 hash help File type Python version Upload date
zopflipy-1.1-cp27-cp27m-win32.whl (89.0 kB) Copy SHA256 hash SHA256 Wheel cp27 Jul 17, 2018
zopflipy-1.1-cp27-cp27m-win_amd64.whl (114.8 kB) Copy SHA256 hash SHA256 Wheel cp27 Jul 17, 2018
zopflipy-1.1-cp34-cp34m-win32.whl (89.1 kB) Copy SHA256 hash SHA256 Wheel cp34 Jul 17, 2018
zopflipy-1.1-cp34-cp34m-win_amd64.whl (108.1 kB) Copy SHA256 hash SHA256 Wheel cp34 Jul 17, 2018
zopflipy-1.1-cp35-cp35m-win32.whl (83.3 kB) Copy SHA256 hash SHA256 Wheel cp35 Jul 17, 2018
zopflipy-1.1-cp35-cp35m-win_amd64.whl (100.8 kB) Copy SHA256 hash SHA256 Wheel cp35 Jul 17, 2018
zopflipy-1.1-cp36-cp36m-win32.whl (83.3 kB) Copy SHA256 hash SHA256 Wheel cp36 Jul 17, 2018
zopflipy-1.1-cp36-cp36m-win_amd64.whl (100.8 kB) Copy SHA256 hash SHA256 Wheel cp36 Jul 17, 2018
zopflipy-1.1-cp37-cp37m-win32.whl (83.3 kB) Copy SHA256 hash SHA256 Wheel cp37 Jul 17, 2018
zopflipy-1.1-cp37-cp37m-win_amd64.whl (100.8 kB) Copy SHA256 hash SHA256 Wheel cp37 Jul 17, 2018
zopflipy-1.1.zip (176.7 kB) Copy SHA256 hash SHA256 Source None Jul 17, 2018

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 DigiCert DigiCert EV certificate StatusPage StatusPage Status page