I exported a bunch of png files from R. The pictures are of a dataset that is 'spinning' against a white background. I then use GIMP to stitch them together and export an animated gif. Unfortunately, the gif has a yellowish color instead of a white background like the original files. This yellowish color was not there when I used to do this in imageMagick and isn't even there when I preview the files in GIMP. It only appears after I do the export as a gif. Does anybody know what is going on and how I can correct this?
-
are you optimizing to gimp correctly? There is an option in Gimp to do so. Also Gif only supports 256 colors, so perhaps it is trying to best fit the color for you – Knight0fDragon Dec 18 '15 at 20:44
-
I am new to GIMP so I am not sure what you mean by 'optimizing to gimp correctly." I am following this tutorial: http://www.digitalcitizen.life/how-create-animated-gif-using-your-own-pictures-gimp – user3390169 Dec 18 '15 at 21:00
-
goto Filters -> Animation -> Optimize (for GIF) – Knight0fDragon Dec 18 '15 at 21:06
-
that did not seem to work – user3390169 Dec 18 '15 at 21:45
-
then go to Image->Mode->Indexed. Select Generate optimum palette with a max colors of 255, Do not turn on dithering and do not allow dithering of transparency – Knight0fDragon Dec 18 '15 at 21:48
-
That made the frames the off white 'yellowish' color immediately, before I exported them as a gif. – user3390169 Dec 18 '15 at 21:53
-
yup, now we know what is happening, you need to pick 255 colors for your image, Are you on a mac or PC? – Knight0fDragon Dec 18 '15 at 21:55
2 Answers
GIF files are limited to 255 colors. If you don't downsacle colros prior to exporting them, GIMP will do that automatically at the export step itself. It is at this point that your yellowish background is being created.
The workaround is quite simple: convert your image to the indexed color model before exporting the GIF file (image->mode->indexed
) ( perceive you could even force a custom crafted palette at this step). If after this conversion the backgroound is already yellowish, you can manually redefine it on the Color Map dialog (search for it on the Windows->Dockable
menu) - pick the background color, and change it for white.
When exporting the Indexed image to an animated GIF there is no color conversion step, and the colors of the GIF are saved as they are seen on the screen

- 99,910
- 10
- 151
- 209
The issue here is GIMP is trying to do its best to convert your image down to 255 colors, and that is where it is failing. What I recommend for people on OSX is to get this program called ImageAlpha (it is free) https://pngmini.com/. It does a very good job and compressing png images without much loss. If anybody has a recommendation for a Windows app that would do this, please post it here for reference.

- 16,609
- 2
- 23
- 44
-
ImageMagick worked great but my company is cracking down on unsupported software. We have GIMP so that is what I am using:( Is there a way to take the snapshot in R so that GIMP can better handle it? – user3390169 Dec 18 '15 at 23:49
-
if you have to use gimp, then play with the palette options. Dunno what you mean by snapshot in R – Knight0fDragon Dec 19 '15 at 06:32