available formats and params for Image.save()

News123 news123 at free.fr
Sat Jul 25 22:29:29 CEST 2009

Thanks a lot Gabriel,

Your answer is perfect.

I was only looking in part II of the PIL manual and overlooked the
Appendix :-(.

I also apreciate
Image.ID , Image.SAVE , Image.OPEN

I saw them when typing
dir Image
but I never had the idea of calling Image.init() first



Gabriel Genellina wrote:
> 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',
> 'FPX',
> 'GBR', 'GIF', 'GRIB', 'HDF5', 'ICNS', 'ICO', 'IM', 'IMT', 'IPTC',
> 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', 'WBMP'
> , 'PCD', 'PIXAR', 'BUFR', 'PPM', 'WMF', 'SGI', 'BMP', 'TGA', 'DCX',
> 'ICO', 'CUR'
> , 'XPM', 'TIFF', 'JPEG', 'SPIDER', 'GIF', 'GRIB', 'IM', 'IMT', 'IPTC',
> 'FPX', 'X
> BM', 'MPEG', 'PSD', 'ARG', 'XVTHUMB', 'PNG', 'MCIDAS']
> 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:
> http://www.pythonware.com/library/pil/handbook/index.htm
>> I'm at a complete loss at finding out what parameters the save function
>> accepts for saving a JPG file or a PNG file
> http://www.pythonware.com/library/pil/handbook/format-jpeg.htm

More information about the Python-list mailing list