In GIMP, how to use an image as colormap (or gradient, or palette)?


I already have a reference colormap in the form of a raster image (basically, the vertical extrusion on a 1D colormap). How can I use it to colorise a grey-level image in GIMP ?

If gradients or palettes are the way, I see quite raw editors, but no way to import or paste a raster image.

5/13/2016 4:14:00 PM

If you open up the palettes tab Windows->Dockable Dialogs->Palettes , you will note that the colormap for any opened indexed image is ready to be used as a palette (if you want such a palette to become a permanent asset, just use the duplicate button on it, available at the bottom of the dialog).

To use those colors on another image, there are two options:

1 - color likeness mapping: Starting with an image in RGB mode (convert its mode back to RGB if it is indexed or grayscale, Image->Mode->RGB), convert the image to indexed - Image->Mode->Indexed - on the dialog that shows, pick the option to Use custom palette and choose the Palette of your source image. If you need the palette from the source image to be in a particular order other than the one it is put in (for example, ascending value of colors), duplicate the colormap palette of your source image (so that it is independently editable) and on the context menu of the Palette list dialog, use the Sort palette... option.

2 - color by color index number: With your target image already in indexed mode (convert to indexed as above, but use Generate optimum palette instead), use the option Colors->Map->Set Color Map... and pick the palette that represents the colormap of your source image.

3 - For mapping the Value (HSV) from your target image to colors on the corresponding indexes of the target palette (as opposed to a proximity algorithm that includes Hue like (1) or overwritting the color map, as in (2): convert your target image to grayscale (Image->mode->grayscale) and them use Colors->Map->Palette Map

5/16/2016 2:49:00 PM