RSS/Atom feed Twitter
Site is read-only, email is disabled

Exporting .gif files corrupts color information.

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2019-01-06 19:52:10 UTC (over 5 years ago)
postings
4

Exporting .gif files corrupts color information.

Hi,

Here's the problem I'm facing, there is no short description though:

I'm attempting to edit gif files which contain graphics used in Civilization 2 game. That's a 1996 game and it is highly customizable and as you can imagine, highly outdated.

What worked before the days of windows 10/8/7 was just using the MS paint. However, at some point, that application started to completely mess up the colors. So I moved to GIMP and all was well, for a while. I stopped making new game scenarios but recently wanted to start again.

However, upon changing anything in the file and exporting it, when I load the game, a certain color used for borders between units and/or terrain types is evidently not correctly saved and it shows up in the game, while it should not.

What normally happens is the game recognizes that particular color used in gif files and does not show it during the gameplay, since it's only used to depict said borders for the purpose of editing the graphic representations of various features.

The worst part is that that I don't even touch the parts of the image that use this color. Just exporting the file immediately upon opening it is enough.

I have attached the "before" and "after" files. Beyond compare shows the same RGB values for all colors. Size between files differs - 183 bytes appear to be missing so obviously some information is lost after exporting. The color in question is the grey background - value 135 for all three RGB colors.

I said this already but this wasn't always the case - I used to be able to edit these same files with GIMP many years ago and exported them without issues.

Also, when I export the file as BMP, which is also an acceptable format for the game engine, the issue does not exist, UNLESS I touch any of the gray color, in which case, the result is the same. Editing anything else seems to work fine with BMPs.

For comparison, I used PSP trial version and it allowed me to freely edit any of the colors and there were zero issues upon exporting the end result.

I have messed around with the vast plethora of preferences and options in GIMP but I am far from being an expert and so far there has been no improvement. I suppose the problem lies with some additional information that should be exported with the file but is not. I can't be certain though.

Could somebody take a look at the problem I'm facing? I would be very grateful. I really like GIMP since for the basic and casual needs that I have, I've managed to learn all the stuff that I need and I'd hate to switch to another application just because of, what I think, is a small issue.

Thanks in advance for your time and let me know if there's anything else I could provide to help resolve this.

rich404
2019-01-07 10:18:14 UTC (over 5 years ago)

Exporting .gif files corrupts color information.

Hi,

Here's the problem I'm facing, there is no short description though:

I'm attempting to edit gif files which contain graphics used in Civilization 2 game. That's a 1996 game and it is highly customizable and as you can imagine, highly outdated.

.....snip.....

Thanks in advance for your time and let me know if there's anything else I could provide to help resolve this.

Best guess. Your game is using the grey (#878787) for a transparency mask, rather than the more usual white.

In the original gif entry 255 is that color and selecting it (right click in color map) shows the extent (1). There is another #878787 in the colormap and only assigned to a few pixels (2)

In your export entry 255 is not set and the #878787 grey is assigned to that other #878787 (3)

To get a gif out in that format (4)

Add an alpha channel

Set the BG colour to #878787

Export as a gif.

Can not comment on the other images, they are jpegs. It will be some screw-up with a non-standard colormap.

2019-01-07 14:54:11 UTC (over 5 years ago)
postings
4

Exporting .gif files corrupts color information.

.....snip.....
Best guess. Your game is using the grey (#878787) for a transparency mask, rather than the more usual white.

In the original gif entry 255 is that color and selecting it (right click in color map) shows the extent (1). There is another #878787 in the colormap and only assigned to a few pixels (2)

In your export entry 255 is not set and the #878787 grey is assigned to that other #878787 (3)

To get a gif out in that format (4)

Add an alpha channel

Set the BG colour to #878787

Export as a gif.

Can not comment on the other images, they are jpegs. It will be some screw-up with a non-standard colormap.

Thanks, I'll try that. I only added the jpgs to demonstrate the expected and actual outcomes, the problem lies in the original gif files anyway.

2019-01-11 10:53:38 UTC (over 5 years ago)
postings
4

Exporting .gif files corrupts color information.

.....snip.....
To get a gif out in that format (4)

Add an alpha channel

Set the BG colour to #878787

Export as a gif.

That didn't work unfortunately, It's even worse than before, at least in the game. After exporting, the background is visibly a different color and I get huge black squares in the game instead of the grey ones before. Is there no way to tell GIMP to ensure the original colormap is saved and applied to the exported file? Seems like it's a simple thing for other programs.

I followed the instructions but I suppose it's possible I did something wrong. Any other ideas?

2019-05-19 19:06:25 UTC (almost 5 years ago)
postings
4

Exporting .gif files corrupts color information.

Just an update:
I have circumvented this problem by editing the palette directly, without adding channels or anything overly complicated. Here's what I did in case other people experience similar issues: I modified the color with index 16 from #878787 to #898989 (editing html notation). This changed that color everywhere in the picture. Then I edited the index 255 color's html notation as well, from 875487 to 878787, which again changed the color everywhere to the correct value. After saving the file, I can now freely edit and export it in GIMP with no further issues, the game properly recognizes all the colors.