Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I copy/map pixel brightness to hue?
#1
I wish to process grayscale images, and convert the gray shades (brightness 0-255) to hue (0-255), pixel for pixel.

More control over the color mapping is better, but I can make do with that by modifying the grayscale image first.

I can find no mention of such an operation. Am I missing something obvious? Is there a way for the GIMP to do this? Is there a plugin that will do it?
Reply
#2
Starting with a color image:

  • Colors > Components > Decompose to HSL or HSV
  • Copy/paste the Value/lightness layer into the "hue" layers
  • Colors > Components > Recompose
   

However if you start with a grayscale image, you will find that the Hue and Saturation layers are initially black (because gray has no specific hue and its saturation is 0), so if you recompose the image at this point you get the same image (because even if you changed the Hue, the saturation is still 0). So if you want to see color, you have to bucket-fill the saturation layer with some non-zero value (255 for full saturation in the image below) before you recompose:

   

And perhaps you also want to bucket fill the luminosity layer to some uniform value (some medium gray):

   
or at least reduce its constrast:

   

It is quite a coincidence that in this picture, midtones (that are mostly the green hills) are converted to green which is half-way in the hue circle.
Reply
#3
Nifty. Thanks. I found it may be possible through GEGL, but this looks a lot simpler, and uses more familiar tools.
Reply


Forum Jump: