Converting GIFs with Python Image Library

Lars larsdoer at yahoo.com
Mon Nov 3 23:31:02 EST 2003


Hi,

I'm using PIL to convert image formats supported by PIL into JPEGs.
When I convert GIFs with transparency, the backgrounds turn out black.
Is there a way to specify the background color when converting images
with transparency?

# PIL 1.1.4
import Image

im = Image.open('yahoo.gif')
im.convert('RGB')

im.save('yahoo.jpg', 'JPEG')

Thanks,
Lars




More information about the Python-list mailing list