Answer the question
In order to leave comments, you need to log in
Python convert ico to png while preserving transparency
At the input, an icon with a transparent background - the output is a png with an opaque background. And it is necessary with transparent.
I do something like this:
import Image
…
im = Image.open(f)
im = im.convert("RGBA")
im.save(t, 'png')
This code works for gif, but not for icons. Guess who made the decision?
Answer the question
In order to leave comments, you need to log in
PIL cannot guess the transparency index of ico.
Solution: im.save(t, 'png', transparency=0) - the index was put down by hand or djangosnippets.org/snippets/1287/ (didn't try the second one).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question