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

Prev   Next

JPEG

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

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

adobe

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

progression

Indicates that this is a progressive JPEG file.

The save method supports the following options:

quality

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.

optimize

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

progressive

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.