[Image-SIG] Bug in image.crop()?

Denis S. Otkidach ods at strana.ru
Thu Nov 4 17:56:34 CET 2004

When I load GIF image and crop it, then some information is lost:

>>> from PIL import Image
>>> im=Image.open('21_files/bg_foto2_1.gif')
>>> cim = im.crop((0, 0, 50, 50))
>>> im.mode, cim.mode
('P', 'P')
>>> im.palette, cim.palette
(<PIL.ImagePalette.ImagePalette instance at 0x4df80c>, None)

According to documentation, image with mode 'P' should have palette, so
it's now in incosistent state.

>>> im.info, cim.info
({'duration': 0, 'version': 'GIF89a', 'transparency': 7, 'background':
7}, {})

If I save croped image, then transparancy is lost.  Is it a bug or
intended limitation?

Denis S. Otkidach
http://www.python.ru/      [ru]

More information about the Image-SIG mailing list