lossless transformation of jpeg images

Daniel Nogradi nogradi at gmail.com
Sun Oct 29 20:15:11 CET 2006


Hi all,

Last time I checked PIL was not able to apply lossless transformations
to jpeg images so I've created Python bindings (or is it a wrapper? I
never knew the difference :)) for the jpegtran utility of the
Independent Jpeg Group.

The jpegtran utility is written in C and is very efficient, fast and
robust. It can rotate, flip, transpose and transverse jpeg images in a
lossless way, see www.ijg.org for more details.

The bindings allow you to use all jpegtran features from Python.

Downloads are here: http://ebiznisz.hu/python-jpegtran/

Any feedback is very welcome, especially if you are able to compile it
on non-standard platforms. It has been tested on Linux and Python 2.3.

Usage example:

import jpegtran

transformer = jpegtran.transformer( )

transformer.rotate( 90, 'pic.jpg', 'pic_rotated.jpg' )
transformer.flip( 'horizontal', 'pic.jpg', 'pic_flipped.jpg' )
transformer.transpose( 'pic.jpg', 'pic_transposed.jpg' )
transformer.transverse( 'pic.jpg', 'pic_transversed.jpg' )
transformer.gray( 'pic.jpg', 'pic_gray.jpg' )



More information about the Python-list mailing list