I have a source file image.ico
of any size and want to create a thumbnail. This is the code i am using right now:
converted_file = cStringIO.StringIO()
thumb = ImageOps.fit(image, (width, height), Image.ANTIALIAS)
thumb.save(converted_file, format='png')
I chose png
as extension because PIL does not support ico
files which could be the culprit. It works beside the fact that transparency is not applied. Parts with alpha=0 are rendered black instead of being transparent. How can i fix this behavior?
/edit
I also tried (see this answer):
converted_file = cStringIO.StringIO()
thumb = ImageOps.fit(image, (width, height), Image.ANTIALIAS)
background = Image.new('RGBA', (width, height), (255, 255, 255, 0))
background.paste(thumb, box = (0, 0, width, height))
background.save(converted_file, format='png')
Same effect.