Gimp image color mode

Viewed 19

I use Gimp, I have a color pallet which contain 556 colors (embroidery related) , but I don't know how to use all those colors in my working image because the index color mode only support maximum 256 colors... what's the solution I have?

1 Answers

All the places in Gimp where the number of colors is limited seem to have an upper limit of 256 colors: indexed mode, color palettes, Posterize filter...

If you want to limit yourself to the 556 colors of your palette, create an image with 556 squares, each painted with one of your 556 colors and save it somewhere. Then when needed open it in Gimp together with your work image, and use the color picker to sample colors from it.

If you want to shoehorn an existing image into your 556 color palette, then you can use the ImageMagick toolbox for this:

  • Prepare an image with only your 556 colors (as a PNG file, you have to avoid JPEG because the compression will introduce extra colors). This will be your "color map". There is no need for a special format layout, the only important thing is that it contains only your 556 colors (to check in Gimp: Colors > Info > Colorcube analysis, with IM: identify -verbose ColorMap.png and check the Colors line)

  • Execute the command

    convert Source.png -remap ColorMap.png Reduced.png

where:

  • Source.png is your original image, with likely thousands of colors. It can be any format (JPG, PNG, TIFF...)
  • ColorMap.png is the map you prepared above
  • Reduced.png is the color-reduced image. It has to be in a format where pixel colors are preserved exactly (so, PNG in your case, for simplicity(*))
  • In recent versions, convert is replaced by magick or magick convert

So for instance, starting with:

enter image description here

And applying this 512-colors colormap

enter image description here

You obtain this:

enter image description here

Note that the color-reduced image can contain much less than the 556 colors (190 colors in the image above, despite the 512 colors colormap) (you won't have bright reds in Mona Lisa).

The whole thing is documented here.

After trying the process a few times, I find that given a good palette it works quite well, so if your 556 colors make up good palette, you could make your workflow a lot simpler, by working in full RGB all the time, and then converting the image to 556 colors.

(*) TIFF and WebP formats also support exact colors/lossless compression, but they still have variants that will do a JPEG-like compression that will change the colors, so they must be used with care.

Related