Search code examples
gifgimpangular-ng-if

Create gif without losing the white color


I realize when creating gifs, the quality of the outcome suffers. Is there a way to retain the "whiteness" of the background? The result now has a yellowish tone and it stands out when implementing in a page.


Solution

  • GIFs are color-indexed and limited to 256 colors per image(*). When exporting a full-RGB image to GIF, Gimp does an implicit conversion to color-indexed and tries to find a best fit. If you want white the best way is to explicitly do the color indexing (Image>Mode>Indexed) and then edit the colormap (Layers>Dockable dialog>Colormap), find the color of the background and change it to white. You can also specify a palette when doing the color indexing, if this palette contains a white color then it will be used.

    Otherwise, if you are doing still images, you may want to switch to the PNG format...

    (*) that is, in the single image, or in all layers/frames combined. If you are using animations. More recent variant of the GIF format allow 256 colors per frame, when doing animations, but GIMP doesn't support these.