NanoJPEG ported to Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

NanoJPEG -- KeyJ's Tiny Baseline JPEG Decoder -- ported to Python

version 1.1 (2010-03-05)

by Martin J. Fiedler

This software is published under the terms of KeyJ's Research License, version 0.2. Usage of this software is subject to the following conditions:

  1. There's no warranty whatsoever. The author(s) of this software can not be held liable for any damages that occur when using this software.

  2. This software may be used freely for both non-commercial and commercial purposes.

  3. This software may be redistributed freely as long as no fees are charged for the distribution and this license information is included.

  4. This software may be modified freely except for this license information, which must not be changed in any way.

  5. If anything other than configuration, indentation or comments have been altered in the code, the original author(s) must receive a copy of the modified code.

Ported to python by Andras Suller, 2012 January 03


2012 January 03 -- first working release


I couldn't find a pure Python JPEG decompressor which has a good quality. PIL is not available in Goolge App Engine, and I will use this library there.


There may be bugs in the porting, but it is good enough for me.

Some parts are not converted. For example, it doesn't support grayscale JPEGs and always use chroma upscaling.

Performance is awful, it needs 12 seconds to decompress a 400x400 pixel image on my core2duo machine, compared to the original C code's 0.2 seconds.

No test suite, since I have no idea how the JPEG decompression is working. I only translated it to Python.