Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Newbie : Gif transparency with Pil problem.

0 views
Skip to first unread message

Gustavo Campanelli

unread,
Dec 15, 2003, 6:12:35 PM12/15/03
to
I have a "base trans.gif", which I created with transparency set to the
same colour as the background. However when I read the file and try
something on it and then save it under a new name, the transparency goes
away, and the file goes from 1.06 kb to 1.05 kb, as if something is
missing (which I think is the alpha channel). When I compare image
properties with Irfanview (my image browser, and the program I used to
create the gif) the only differences are file size and transparency ( I
guess I should change base color for the text as well, but that's not
the issue here).

Sample Code:

import Image, ImageDraw
firmada = Image.open("base trans.gif")
dibujo = ImageDraw.Draw(firmada)
dibujo.text ([50,50],"texto")
firmada.save ("prueba.gif")


Gedece, Python Newbie

Andrew Clover

unread,
Dec 16, 2003, 7:14:42 AM12/16/03
to
Gustavo Campanelli <birdiep...@SPAMciudad.FILTERcom.ar> wrote:

> However when I read the file and try something on it and then save it
> under a new name, the transparency goes away

I don't think PIL saves GIFs with transparency at all - at least it didn't
last time I played with it, which is one reason I wrote this:

http://www.doxdesk.com/software/py/gifWriter.html

--
Andrew Clover
mailto:a...@doxdesk.com
http://www.doxdesk.com/

Gustavo Campanelli

unread,
Dec 16, 2003, 9:42:25 AM12/16/03
to
Andrew Clover wrote:

> I don't think PIL saves GIFs with transparency at all - at least it didn't
> last time I played with it, which is one reason I wrote this:
>
> http://www.doxdesk.com/software/py/gifWriter.html

Wow, I really really thank you, I'll check it and besides using it, I'll
see what I can learn from it, as it has some nice functions from what
I've already read of the code.

Gedece

0 new messages