Take the 2-minute tour ×

I would like to create an image from a map, where each country is colored in a different color, where the frontiers are in black, and in which each color except black is fully transparent, while not losing the RGB information.

My tools are The Gimp or anything installable on Linux, and small scale programming (if I need to fully understand the png format, I won't succeed).

My current image is perfect, except for the transparency information. My current experiments with GIMP have always resulted in RGB information being lost when exporting the image to png or gif.

Any pointers? Thanks a lot.

share|improve this question
If alpha is 0 there is no RGB information in png or gif formats. What you are asking is not possible. –  Scott Jan 5 at 21:29
I wouldn't dare confront anyone on such matters, as my knowledge is practically null; yet, I would like to ask you if you are reasonably sure of that, or sure without a doubt, so that I don't spend any more time on this trail of thought. Thanks and best regards in any which case. –  pouzzler Jan 5 at 21:39
Would it be possible to set a 99.9% transparence, and keep RGB info? –  pouzzler Jan 5 at 21:42
To better understand your needs: How would you use such an image? E.g. in a program you write, or for a web page? –  John Jan 5 at 22:11
in a javascript webpage/program. I elected to keep a copy of the imagedata in memory, and output another transparent copy to the html 5 canvas I use. Then I do the checks on the memory copy, as any attempt to set a high transparency on the canvas, then doing pixel color checks on the canvas leads to failures too. It would be easier if all this work were done in the image to start with, but I can live with 10 lines of code, if not. –  pouzzler Jan 5 at 22:22
show 2 more comments

1 Answer

On the GIMP Export dialog for PNG files, there is a checkbox that says "Save colour values from transparent pixels". I haven't tested it, but that should do what you want.

There doesn't seem to be an equivalent option for GIF.

More on export file format options: http://docs.gimp.org/en/gimp-images-out.html#gimp-using-fileformats-export-dialog

share|improve this answer
Yes, that should do it, regardless of @Scott's comments. –  jsbueno Jan 21 at 21:39
add comment

Your Answer


