views:

112

answers:

1

A simple questions really. If you crop a jpeg image using the Python Imaging Library, is the resulting image recompressed, or is it lossless?

+3  A: 

Generally not. There is a python wrapper for the lossless jpeg library.

Cropping might be essentially lossless if you remove entire 8x8 pixel blocks

Martin Beckett
I don't get it, doesn't the PIL library just uncompress the image when it is loaded, and store the (uncompressed) pixel values in memory? In that case any operation would be lossless, unless you save it to some compressed file format again, right?
catchmeifyoutry
I'm talking about going from jpeg to jpeg, so from Martin's answer it looks like I'd have to use jpegtran.
Acorn
Even unpacking a jpeg into memory and recreating the jpeg isn't totally lossless, there may be rounding errors.
Martin Beckett