Is there a way of setting the color to be used as transparent in a .gif file to a specific index in the color map?

I have tried ImageMagick. For example, if I want to make all red in the image to use the color of index 10 which is blue:

convert in.gif -transparent-color blue -transparent red out.gif

This works fine if we don't worry about the indexes. The red in the picture is now transparent blue. But IM adds this transparent blue to the color table after the last used index. In my case I need the transparency to be a color map index of my choice. GIMP can rearrange the color map, which seems like something that might work, but I will still have to investigate this since it haven't really been working out.

1 Answer 1


IrfanView solved the problem. When saving a .gif file in IrfanView you can choose which color in the image should be transparent, and the exact color map index of the chosen color will be used as transparent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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