Gimp-Forum.net
How do I create a gradient map from an image? [solved] - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: How do I create a gradient map from an image? [solved] (/Thread-How-do-I-create-a-gradient-map-from-an-image-solved)

Pages: 1 2


How do I create a gradient map from an image? [solved] - Dave Rove - 10-22-2017

How do I create a gradient map from an image?

If I have an image that I know started off as greyscale and that somebody has colourized it with a gradient map, and that the resultant image is sufficiently detailed to have all 256 lightness values mapped to a colour -- then how do I create a colour gradient map from that image so that I can colourize images similarly myself?

I know that this is possible because I did it myself a few years back and I have the .ggr gradient maps that resulted, but Google has failed me now and I've forgotten how I did it.


RE: How do I create a gradient map from an image? - Zero01 - 10-22-2017

You could use the G'MIC filter under Rendering>Gradient [from line], to get the colours you wish to use for colourizing purposes, save that (just give it a name in the 'Save gradient as' box at the bottom of the dialogue) then refresh your GIMP gradients tab, choose the gradient you created and then apply it to the image you would like to colourize by going to Colors>Map>Gradient Map.
There may be another way just using the GIMP core features but if there is, I have also forgotten it.  Blush


RE: How do I create a gradient map from an image? - Dave Rove - 10-22-2017

(10-22-2017, 09:17 AM)Zero01 Wrote: ... G'MIC filter under Rendering>Gradient [from line] ...

I've tested that and found that the gradient map that results  is not in order of brightness values but in order of the colours that happened to appear along the selected line in the image, with the brightness values in no particular order. That gives crazy results when applied as a gradient map. Thanks, though.


RE: How do I create a gradient map from an image? - Zero01 - 10-22-2017

OK, well not sure then. Can only think of perhaps Colors>Map>Sample Colorize, you need both images, the one you're taking from and the one you're adding to.. not an expert but that seems to have a better (less weird) effect. Otherwise I'd wait for someone with a bit more knowledge on the subject than me (and there are quite a few) to guide you to the desired result.


RE: How do I create a gradient map from an image? - dinasset - 10-22-2017

There is a possibility to order the created gradient, but in any case what you ask seems impossible to me, because an image can have the luminosity L derived from different R,G,B combinations:
L = xR+yG+zB (x, y, z being coefficients of R, G, B values)


RE: How do I create a gradient map from an image? - rich2005 - 10-22-2017

I think this is what you are looking for, an old procedure. 

Lots of right clicking involved.

1. Open the palettes dock, I detached it here to make it easier to see.

2. Right click, select Import palette. In the dialogue, select image - number of colours - give it a name.

[attachment=843]

3. Right click on your new palette, select Sort Palette In the dialogue choose Saturation.

[attachment=844]

4. Right click in the sorted palette, click Palette to Gradient

[attachment=845]


RE: How do I create a gradient map from an image? - dinasset - 10-22-2017

IMO still a gradient can't recreate different R,G,B combo having the same luminosity.


RE: How do I create a gradient map from an image? - Ofnuts - 10-22-2017

Try this:
  • Image>Mode>Indexed and let Gimp create the optimal color map
  • Windows>Dockable dialog>Palettes. The top palette should be "Colormap of image...."
  • Right-click, and Palette to gradient
You can then Ctr-Z to restore your image to full RGB. Experts will wonder about the stint via Color-Indexed mode ince one can create the palette directly (Import Palette>From image) but in that case the palette in not ordered by luminosity.


RE: How do I create a gradient map from an image? - dinasset - 10-22-2017

Did someone try to:
- desaturate the image
- use the gradient so created to rebuild the image in colours
I made some attempts: no success (outcome maybe nice from a crazy painting viewpoint...)
If someone succeeded please:
- post the original (or the one reduced to 256 colors)
- post the gradient created
- post the desaturated
- post the rebuilt
Just to learn...


RE: How do I create a gradient map from an image? - rich2005 - 10-22-2017

Yeah, but....

That was not the question, personally I have doubts about the possibility of reverse engineering a colorized image, whether mapped to gradient or palette.

But without the OP's image .... I do not know.

Edit: Similar sorts of images https://i.imgur.com/vAYZEfL.jpg sort of..