I've been looking through plenty of images I enjoy on the internet. One way to study them is to use photoshop's hue/saturation adjustment layer. Desaturating it will expose the value. Giving it full saturation will expose the hue. But is there any way to convert a pixel's saturation value to grayscale? Like saturated being white and desaturated being dark?
Replies
Why the B/W filter is different than Desaturation... in Photoshop go to Image, Adjustments, Black and White. Each hue has a different default %. This approximates how the brain perceives the relative brightness of each hue. A nice diagram from here shows how the cells in your eye convert hues differently
Example image:
Saturation measured in this way:
Edit: this isn't quite right. Maybe I'll try again later.
Edit 2: I've found that I get the most illustrative results by setting both Desaturates to Lightness. I can't guarantee that the values you get out of this are suitable for converting directly back into saturation.
Edit 3: I've figured out what I was doing wrong. I didn't separate the chroma data before finding the difference in luminosity. The ACTUAL best layer stack for this task is created like this: create a clone layer of your image or a top-level group, create a fill layer with the color #803f3f, set the fill layer to Luminosity mode, group those two layers, create a clone layer of the group, set that clone layer to Difference blending mode, add a Desaturate (Lightness mode) filter mask to that clone layer, then add a Desaturate (Lightness mode) filter layer above that with a Brightness/Contrast Curves filter mask with the top-right point moved left to the first vertical grid line. Whew. I think that just about does it right, although there's a loss of precision compared to what it would probably look like if there were just a filter that did this.
I'm using filter masks because you can collapse them. Of course you can do all of this with filter layers instead, if you wish.
can this be done in Photoshop?
Also Eric, The link on his page didn't go anywhere.
- Duplicate the layer that you want to visualize the saturation of.
- Change the image mode to Lab color (Image->Mode->Lab Color.) Don't flatten the image when it asks you.
- In the channels palette click the Lightness channel.
- Fill it with neutral gray (L 50, a 0, b 0) (Shift+F5).
- Go back to RGB image mode.
- Make sure you're on all RGB channels. Make a new layer and fill it with the same neutral gray (Shift+F5). Set this layer's blending mode to Difference.
- Flatten it with the underlying layer and convert to black and white (Shift+Alt+Ctrl+B).
I don't think I know enough about Photoshop to come up with a non-destructive technique. But it might not be impossible.I'm also into the approach kwyjibo described, which is to "program" that the saturation should become the RGB values.
A way to do that can be through ImageMagick, it's a command line application that can convert images and do several filters, such as a "FX" filter where you can write expressions that happen on each pixel (that could do stuff like outputting the saturation as RGB for example). It's kinda brutal, but once you set up a shortcut on your desktop it should work with drag-and-dropping images from the web browser.
It should be simpler to use than firing up a beast like Maya or Photoshop just for that.
I also wondered if you couldn't do that with javascript\HTML5, here's is a JSFiddle (a javascript demo) that loads an image and shows the saturation:
https://jsfiddle.net/48dLgvqb/1/
There's a commented line in there that also shows it as the "chroma" from LCH (the cylindrical form of LAB mode). It's a different way to measure the vibrance of colours.
From that candy image Jed posted, here's a comparison.
http://www.russellcottrell.com/photo/saturationMask.asp
works non destructively on smart objects
ps. To get "right" grayscale from desaturated rgb I am using gamma 1.27 in "exposure" adjustment layer once I run an action that saves a certain layer comp as an alpha channel within an output file trough copy/paste
http://www.chilliant.com/rgb2hsv.html
(a) The less diversity you have in your hue, the more diversity you can add in your saturation. Think skin tones with bright red shadows and near white red highlights
(b) The less diversity you have in your saturation, the more diversity you have in your hue.
The reason I bring this up is because now is because at some point I want to create 3D material in which the shadows change color. The change depending on the overall average saturation of my scene (which I define myself by typing in a number presumably between 0-1). You know, just to give it some kind of hue offset for saturated scenes and a saturation offset for brightly colored scenes.
Using this example from this amazing painter. https://www.artstation.com/artwork/1Z5Ye
This girl's skin had a wide hue range. Lots of blues blended with orange. But it works because there's still a tons of gray mixed in. This could not happen with highly chromatic colours because blending blue and orange with high chroma just creates nasty gray mud in between, and creates invalid colour harmony.
Let's look at Vinogradov's painting of Rey in contrast. https://www.artstation.com/artwork/Eben4
Her skin looks like it has a lot of different hues. But when looking at the range of hues, it sits in a very thin slice of the red range the whole time. But the chroma goes from anywhere to being an off-grey to half way full.
Despite what may be valid when it comes to photorealistic 3D materials, I don't see why we wouldn't be able to replicate either of these painter's colour pallets regardless of the texture color and light color. So if we tell the material that our scene saturation is low (based on how we eyeball it), then the highlights could add more degrees to the acceptable hue range and shadows could reduce degrees to the acceptable hue range, I imagine there would have to be a few extra parameters to allow some extra controls since these aren't absolute rules, just common patterns.
If that's true, then does that mean light of the opposite colour as the material always turns said more gray in real life? Exception being things glass etc.
Like Teriyaki wrote, a white \ neutral light is the only way to truly know what's the local colour of a material. When the light has some tint or flavor it will influence how our eyes see the material. You can read more about it here: the effects of coloured illumination.
The context is also important. Our eyes have this thing called "chromatic adaptation" which tries to give us an accurate appearance of objects by adapting to the colour of light sources, or something like that. You can see a nice example here: http://gurneyjourney.blogspot.com.br/2011/09/part-3-gamut-masking-method.html
There's more material on this if you search for "white balance", a concept from photography: http://ronbigelow.com/articles/white/white_balance.htm