4

This began as a simple question but got confusing the more I thought about it. I hope somebody here can help me get it sorted.

I was preparing an image texture that was to serve a purpose similar to an albedo map, in that I wanted to preserve the hue but not the luminosity values. Each of the RGB channels was to be represented with their full range of hue data.

I will use this image of two lorikeets as an example. (Credit)

Rainbow Lorikeets - example image with vibrant color

I thought it would be a simple matter of creating a fill layer of some bright color, placing it below my main image layer, and setting the main layer's blend mode to "Hue".

Knowing that green has the highest luminance (Red:21% Green:72% Blue:7% according to common approximation) ...I started with green, my logic being that it should capture the full range.

Using pure green (#00ff00) for the fill layer, the hues of the image were all mapped to the luminosity of pure green. But I noticed my reds and blues looked too bright and washed out. Data was certainly being lost for those colors.

The luminosity of pure magenta (#ff00ff) was an improvement. The reds really popped now, but were so "hot" they were getting clipped out of their dynamic range.

The luminosity of pure blue (#0000ff) was of course the darkest, and not useful. But I'll include it for reference, since it gives a sense of scope to see how vast the difference is.

The green channel having the most potential for luminance, I revisited using green as the basis, but reduced the brightness value (going by the HSB model) to 80% (Hex: #00cc00). This looked a lot better. But I was still bothered that my choice was an arbitrary brightness value.

Hue transfer using the Hue blend mode - comparison using different base colors

I thought about how in Photoshop we can see in the Channels tab, unmistakably, how much each of the RGB channels is contributing to the color of an image. And images typically contain shadows or contrasting variation in luminance. There are ways we can raise the "floor" on all three channels so that no black or dark areas remain, but then we are truncating the lower part of the dynamic range that represent the colors too, aren't we?

Thinking of a "color wheel" model color picker, the hues blend from one to the next and on the outermost part of the wheel are all as saturated as they can be, yet they still blend from one to the next in smoothly transitioning gradients. While blue is still the hue with lowest luminance, every hue is at its maximum potential luminance at the circle's edge.

Above: Example of a circular color selector

But considering the range of valid values for a channel, the Red Green and Blue channels each have the same range: between 0 and 255. Can it really be so difficult to preserve the integrity of all three channels?

I got curious as to whether this might be a color space or color mode issue, so I tried switching to LAB Color. In LAB, Magenta's luminosity at a brightness around 75% looked good. ↓

Next, 32-bit color mode. Surprisingly, pure blue (despite producing an unusable dark result in 8-bit RGB) produced arguably the best result in 32-bit! ↓

Note: The conclusion of "best result" (in addition to being merely an opinion) is based on a small sample set from my limited experience testing these combinations.

Note: Bear in mind all screenshots here ultimately have been exported as 8-bit RGB for in-browser display. Although the benefits of being processed while in 32-bit should be evident. The HDR Toning method used when exporting back to 8-bit was "Exposure and Gamma" at default values, so as not to alter the appearance.

In all of the results I shared above, yellow was notably absent - which is strange considering the original photo has yellow parts. Using yellow's luminance instead of blue's allowed the yellows to be preserved... but then other colors suffered. Not exactly a solution.

The more I contemplated it, the more I got to thinking that some color-science based "correct" method probably exists for isolating just the hue of an image. What is that method?

(Thanks for reading to the end of this color nerd-fest.)

3
  • 1
    there is a plugin that can make these channels out of other color models. You should be able to get this for free from adobe. Atleast you used to. In anycase you can do this with imagemagick. A bit bizarely adobe actually ships imagemagick with photoshop so no need to install anything.
    – joojaa
    Jun 20, 2023 at 18:04
  • The fundamental thing that we do not know: What you exactly want. It's not the albedo map, because albedo maps keep the colorfulness, for ex. greys stay grey. In addition we do not know how you want to handle the limited color range of the RGB system. Let everything be clipped to pure red, pure green or pure blue or still keep the original seen hues and reduce the colorfulness as much as needed to get it? Or is it "the numbers nor clipping are not interesting, they can be whatever, only fine artistic look is what matters"?
    – kexxgem
    Jun 21, 2023 at 17:05
  • There is a way to decompose an image to HSL layers in GIMP if that's any use to you. The steps are: Colours > Components > Decompose. In the dialog choose HSL for the colour model. This creates a new image file with HSL layers, then fill the Saturation and Lightness layers with 50% grey, and then do Colors >Components > Recompose. Back in the original image file, the image will be recomposed to effectively neutralize the saturation and lightness channels. see example here.
    – Billy Kerr
    Jun 22, 2023 at 11:33

4 Answers 4

5

This is more about RGB math than about color science really. The HSB model (aka. the HSV model) is just a mathematically derived alternative representation of the RGB model. It doesn't attempt to accurately describe how humans perceive colors.

In Photoshop, you can easily alter an image to only consist of completely saturated and completely bright pixels with their original hues.

  • Download and install the Optional Plug-ins from Adobe.

  • Apply the Filter > Other > HSB/HSL filter to your image with the following settings:

    This will create an image where hue is shown in the red channel, saturation is shown in the green channel and brightness is shown in the blue channel.

  • In the Channels panel, select the green and blue channel and fill them with white to set saturation and brightness to max.

  • Once again apply the Filter > Other > HSB/HSL filter to your image, but this time with these settings:

    This will turn your image into ordinary RGB again using the channels as HSB.

    The end result looks like this:

A flaw in this whole idea is how completely neutral colors are handled. In theory they can't be said have a hue value at all. They should belong in the center of the RGB color wheel. But in Photoshop (and other image editors) neutral pixels gets a hue of 0 (red) by default. So you can't be sure if a red pixel in the resulting image represents a red or neutral pixel from the original image.

1

In the HSV, HSL or HSB model you need to set the S to 100%, and the V or B to 100%, or the L to 50%, just keeping the H from the original pixel. The luminosity should then vary depending on the hue of the pixel.

The result will likely look un-natural and quite “neon” because the maximum saturation in the RGB gamut is unnaturally high for many hues.

If there is an option to limit to the CMYK gamut then the image will look more natural, but might produce odd results for some blues and purples.

Having said this, I do not know how you would achieve this in practice on the program you are using.

1

The accepted answer by Wolff provided all the info I needed! It shall remain the accepted answer, but I will post the following solution I came up with that expands on it to resolve the red channel issue.

I kept thinking about this limitation:

A flaw in this whole idea is how completely neutral colors are handled...

In Photoshop (and other image editors) neutral pixels gets a hue of 0 (red) by default. So you can't be sure if a red pixel in the resulting image represents a red or neutral pixel from the original image.

I tried it in Blender and sure enough, I got the same thing. Neutral colors were turning red.

But after some thought, and using techniques I knew about thanks to Blender SE contributors, I got a nice result with the following node setup:

Main node setup for isolating hue

The value node labeled "Neutral Hue Threshold" is fine left at 0.0, but as it is increased, it will introduce more neutral/gray tones for subtlety. The effect is exactly what I had in mind. Orange, yellow, magenta, cyan, etc are present, but with no more false reds. :-)

The green "Select Color" node is a group containing the following nodes:

Select Color node setup

And inside the "Vector - Length" group node are the following nodes (thanks to Robin Betts for this part!):

node setup for Vector Math - Length

These are Compositor nodes, although the same kind of setup works with Material nodes too, if one prefers to do this within a material.

Maybe I will elaborate a little more another day, but I should get going now... just wanted to share.

.blend file here

1
  • 1
    That's interesting. Hard for me to follow exactly what's going on just by the screenshots. I should get more into node based image editing. But it's an uncommon approach for graphic designers.
    – Wolff
    Jun 23, 2023 at 15:57
0

Want to map the hues to a solid color layer i.e. fade all visually observable lightness and colorfulness variations?

I said colorfulness, I didn't say "saturation". I avoid here word saturation because it does not present what's seen, it's a number in the polar versions of the RGB system. RGB is developed to create colored light in computers, it is not a model for human color perception.

Photoshop's Lab or actually CIELAB is a model for observed colors, so you should use it. Color scientists have made millions of tests with humans to find how to present seen colors consistently with numbers and Lab is a result of the effort. There the lightness is separated in an useful way from colorfulness and hue.

Start by converting your RGB image to Lab. Have 16 bit color depth.

enter image description here

Sorry for not using Photoshop. I rent Adobe stuff only if needed.

In the next image a new bottom layer is inserted and filled with a solid color. It's a not especially bright nor colorful red (L=50, a=50, b=25) to avoid any extremes. The original image has got blending mode Hue:

enter image description here

There's also inserted an in-layer hue-saturation-brightness effect to make the layer color adjustable. In Photoshop one should insert Hue/Saturation adjustment layer, the colorize mode should be ON. The reason: It's not at all clear that the mapping succeeds. It succeeds in numbers, but RGB color range is so limited that you can see a badly clipped wrong observed hue color on your RGB screen. We see it easily by switching proof colors ON in Photoshop. In Affinity one inserts a soft proof layer. This one shows as grey all colors which are shown wrongly in the normal sRGB screen:

enter image description here

The bottom layer color is adjusted so that the grey vanishes:

enter image description here

This result can be flattened and converted back to RGB with no observable changes. It presents my best effort to make a RGB image which contains the seen color hues of your original image, but no colorfulness nor lightness variations.

I must add that nearly grey colors can in this way get wildly varying color hues due the image noise. This warning can be found also in older answers to your question. The result is NOT an albedo map, because also colorfulness variations are removed. Albedo maps are made of photos by removing only the lightness variations. You see how the plaster stays grey in your linked example.

3
  • Where did all the yellows go?
    – Wolff
    Jun 21, 2023 at 16:03
  • @Wolff They are exactly in the same places as in the original image. Now they are as dark as other colors. This image shows only hue differences. Colorfulness and lightness variations are removed. The common bright yellow RGB(255,255,0) has nearly twice the lightness of the maximally bright red RGB(255,0,0)
    – kexxgem
    Jun 21, 2023 at 16:55
  • Ah OK, I see. Well that's another take on it. Hard to tell what result the OP is really looking for.
    – Wolff
    Jun 21, 2023 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.