Thread

Index > i.Mage > Transparency
Author/Date Transparency
Flexable
23/06/2003 2:00am
Could you explain how the transparency works? Which colour is 'opaque'? I've been using an HLS Cube palette, is it possible to use one of these colours as transparent?
I've had limited success using background colour for transparency, is it the background colour that the picture was originally created on?
fReT
23/06/2003 2:07am
The current background colour is used as the "transparent" colour when saving to a format that supports transparency.

However there are 2 gotchas, firstly if your saving to a indexed colour image, and the background colour is still RGB then it's not going to match, even if the RGB is the same as the palette entry being used as the background.

Secondly the PNG save code appears to not save transparency at the moment. This is mearly a bug which I'll have to address soon.
fReT
23/06/2003 2:09am
When the colour swatch has a paletted colour it looks like:
56 (FF, 00, FF)

and when it's in RGB mode it looks like:
255, 0, 255 (FF, 0, FF)

For GIFs you'll want the former.
Flexable
23/06/2003 10:20am
Thanks for the info, I'm drawing pictures for a game a friend and I are writing. (Top down shooter only 3d in a glider). We're doing it in C, using SDL as a graphics library and typically use PNGs. Still debating over whether or not to go completely 8-bit for easy colour cycling etc. My friend's actually written a SavePNG function, we've started a sprite editor..
Dragen
26/04/2004 5:19pm
Im having the same problem Flexable was having except I don't have a choice in the palette for 56(FF, 00, FF). The file I opened up had its own palette. I've been trying to add that color to it with no luck. Is there a way to change colors on the palette so I can set one of them to that color? Or is there a way to change the "background color" the file uses when saving .gifs?
Matthew Allen
27/04/2004 9:50am
When you double click and entry in the palette you get an edit window to change the palette entry. By selecting a new RGB and hitting ok, you'll change that entries colour.

You can select a colour as the background colour by ctrl-clicking the entry in the palette window.

When you save a GIF or PNG it'll ask you whether you want a transparent or opaque image. If you choose transparent and there are some pixels in your image that are the background colour then they'll be transparent in the file written out.
Reply