IdentifiantMot de passe
Mot de passe oublié ?Je m'inscris ! (gratuit)
Python Imaging Library Handbook

Prev   Next


PIL reads JPEG, JFIF, and Adobe JPEG files containing "L", "RGB", or "CMYK" data. It writes standard and progressive JFIF files.

Using the draft method, you can speed things up by converting "RGB" images to "L", and resize images to 1/2, 1/4 or 1/8 of their original size while loading them. The draft method also configures the JPEG decoder to trade some quality for speed.

The open method sets the following info properties:


JFIF application marker found. If the file is not a JFIF file, this key is not present.


Adobe application marker found. If the file is not an Adobe JPEG file, this key is not present.


Indicates that this is a progressive JPEG file.

The save method supports the following options:


The image quality, on a scale from 1 (worst) to 95 (best). The default is 75. Values above 95 should be avoided; 100 completely disables the JPEG quantization stage.


If present, indicates that the encoder should make an extra pass over the image in order to select optimal encoder settings.


If present, indicates that this image should be stored as a progressive JPEG file.

Note: To enable JPEG support, you need to build and install the IJG JPEG library before building the Python Imaging Library. See the distribution README for details.