available formats and params for Image.save()

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jul 24 11:47:37 CEST 2009

En Thu, 23 Jul 2009 06:56:45 -0300, News123 <news123 at free.fr> escribió:

> Somehow I have difficulties reading the documentation for PIL (Image)
> Is there an easy way to know which formats are supported and what their
> names are?

py> import PIL
py> from PIL import Image
py> Image.ID
py> Image.init()
py> Image.ID
['PNG', 'ARG', 'BMP', 'BUFR', 'CUR', 'PCX', 'DCX', 'EPS', 'FITS', 'FLI',  
'GBR', 'GIF', 'GRIB', 'HDF5', 'ICNS', 'ICO', 'IM', 'IMT', 'IPTC', 'JPEG',  
S', 'TIFF', 'MIC', 'MPEG', 'MSP', 'PCD', 'PIXAR', 'PPM', 'PSD', 'SGI',  
  'SUN', 'TGA', 'WBMP', 'WMF', 'XBM', 'XPM', 'XVTHUMB']
py> Image.OPEN.keys()
['PCX', 'ICNS', 'HDF5', 'SUN', 'MIC', 'EPS', 'MSP', 'FLI', 'FITS', 'GBR',  
, 'PCD', 'PIXAR', 'BUFR', 'PPM', 'WMF', 'SGI', 'BMP', 'TGA', 'DCX', 'ICO',  
, 'XPM', 'TIFF', 'JPEG', 'SPIDER', 'GIF', 'GRIB', 'IM', 'IMT', 'IPTC',  
'FPX', 'X
py> Image.SAVE.keys()
['XBM', 'PCX', 'SPIDER', 'HDF5', 'TIFF', 'BUFR', 'EPS', 'JPEG', 'MSP',  
'GRIB', '
GIF', 'BMP', 'IM', 'PPM', 'PDF', 'FITS', 'PALM', 'WBMP', 'WMF', 'PNG']

> Is there an easy way to know which parameters are supported by
> Image.save(). How can I list them where are they documented?

That depends on the format being used. The PIL handbook lists the standard  
formats used and their parameters:

> I'm at a complete loss at finding out what parameters the save function
> accepts for saving a JPG file or a PNG file


Gabriel Genellina

More information about the Python-list mailing list