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.

  • 1
    If alpha is 0 there is no RGB information in png or gif formats. What you are asking is not possible.
    – Scott
    Commented Jan 5, 2014 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
    Commented Jan 5, 2014 at 21:39
  • Would it be possible to set a 99.9% transparence, and keep RGB info?
    – pouzzler
    Commented Jan 5, 2014 at 21:42
  • 1
    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
    Commented Jan 5, 2014 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
    Commented Jan 5, 2014 at 22:22

1 Answer 1


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

  • Yes, that should do it, regardless of @Scott's comments.
    – jsbueno
    Commented Jan 21, 2014 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.