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

Prev   Next

PNG

PIL identifies, reads, and writes PNG files containing "1", "L", "P", "RGB", or "RGBA" data. Interlaced files are currently not supported.

The open method sets the following info properties, when appropriate:

gamma

Gamma, given as a floating point number.

transparency

Transparency colour index. This key is omitted if the image is not a transparent palette image.

The save method supports the following options:

optimize

If present, instructs the PNG writer to make the output file as small as possible. This includes extra processing in order to find optimal encoder settings.

transparency

For P and L images, this option controls what colour image to mark as transparent.

bits (experimental)

For P images, this option controls how many bits to store. If omitted, the PNG writer uses 8 bits (256 colors).

dictionary (experimental)

Set the ZLIB encoder dictionary.

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