Skip to main content

libjpeg-turbo cffi bindings and helper classes

Project description

jpeg4py
=======

Python cffi libjpeg-turbo bindings and helper classes.

The purpose of this package is to provide thread-safe and aware of GIL Python
bindings to libjpeg-turbo which work with numpy arrays on
Python 2, 3 and PyPy (when numpy is fully implemented). It was tested with
Python 2.7, Python 3.3 and PyPy on Ubuntu 13.10.


Covered TurboJPEG API:
```
tjInitDecompress
tjDecompressHeader2
tjDecompress2
```
so, currently, only decoding of jpeg files is possible, and
it is about 1.3 times faster than Image.open().tobytes() and
scipy.misc.imread() in a single thread and up to 9 times faster in
multithreaded mode.


Installation
------------

Requirements:

1. numpy
2. libjpeg-turbo

On Ubuntu, the shared library is included in libturbojpeg package:
```bash
sudo apt-get install libturbojpeg
```
If you have a custom library which is TurboJPEG API compatible,
just call jpeg4py.initialize with tuple containing that library's file name.

To install the module run:
```bash
python setup.py install
```
or just copy src/jpeg4py to any place where python interpreter will be able
to find it.

Tests
-----

To run the tests, execute:

for Python 2.7:
```bash
PYTHONPATH=src nosetests -w tests
```
for Python 3.3:
```bash
PYTHONPATH=src nosetests3 -w tests
```
for PyPy:
```bash
PYTHONPATH=src pypy tests/test_api.py
```

Example usage:
--------------

```python
import jpeg4py as jpeg
import matplotlib.pyplot as pp


if __name__ == "__main__":
pp.imshow(jpeg.JPEG("test.jpg").decode())
pp.show()
```

License
-------

Released under Simplified BSD License.
Copyright (c) 2014, Samsung Electronics Co.,Ltd.

Project details


Download files

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

Source Distribution

jpeg4py-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

File details

Details for the file jpeg4py-0.1.0.tar.gz.

File metadata

  • Download URL: jpeg4py-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jpeg4py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9aa948cc9713124a719d72b656983dc072df3b504a2ccf9bcc97803cf6a96154
MD5 15135cbc0536aeb651580cbe9d608ad8
BLAKE2b-256 0c9b1fb0c62eaf551299ecf102a84794e56d87e585c39591f168cf5c29871d07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page