Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert image to grayscale of the saturation 2

Status
Not open for further replies.

ESquared

Programmer
Dec 23, 2003
6,129
US
I have Photoshop 7.0. How do I convert an image to a grayscale representation of the saturation?

For example, a point that currently has 100% saturation should be completely black (or white, doesn't matter) and a point that has 50% saturation would be exactly midpoint gray.

Thanks for your help!

-------------------------------------
It is better to have honor than a good reputation.
(Reputation is what other people think about you. Honor is what you know about yourself.)
 
Marcus,

That doesn't work. What you suggested converts brightness to grayscale, discarding the color (hue, saturation) information. I want to convert saturation to grayscale, discarding the hue and brightness parts of the image.

For example, a bright 100% saturated yellow should be the same gray in the finished product as a solid black area.

-------------------------------------
It is better to have honor than a good reputation.
(Reputation is what other people think about you. Honor is what you know about yourself.)
 
I'll explain.

I have a fairly dark photograph that was taken with a digital camera that placed an overlay on the image. The overlay is primarily made up of saturated colors. For the sake of interest, I thought I would figure out how to select all the portions of the image that were above a certain saturation threshold. If I could get any image which had the overlay distinctly different from the rest of the "real" photograph, I could then play with levels or the wand tool to select just those parts and adjust the rest of the image separately from them.

-------------------------------------
It is better to have honor than a good reputation.
(Reputation is what other people think about you. Honor is what you know about yourself.)
 
Are you talking about removing a watermark that's been placed on top of the image?

The only way I can think of that will convert 100% saturation to black and varying levels of saturation to it's appropriate grayscale version would be to write a Javascript function to do so. Then install the scripting plugin for photoshop and run your script as an action. Even then I don't think this will quite give you what you want. Have you tried playing with different layer modes?

NATE


mainframe.gif


Got a question? Search G O O G L E for links to the fastest answers: www.google.com
 
Well, I'm partly wanting to mess with the photo, but also partly wanting to increase my Photoshop knowledge. So there might be other methods to get what I want, but for the time being I thought it would be fun to learn to do this exact thing.

Anyway, thanks for your help, Nate. The suggestion to switch modes and then mess with the layers gave me basically what I want. The problem is that the magic wand does its job on the full color information... but not in the separate channels.

I wish there was an HSB mode, though! :)

I wanted to manually adjust the levels because the pictures are very dark, but exclude the portions of the image that have the artificial "watermark" on them. Auto levels doesn't do anything because it doesn't adjust the midpoint of the color range, and most of the color information is in a big lump at the dark end in the uncorrected images.

-------------------------------------
It is better to have honor than a good reputation.
(Reputation is what other people think about you. Honor is what you know about yourself.)
 
You know if you wanted to remove an artifact or watermark etc you can always just clone that out or use the healing brushes etc to complete the image as if the watermark wasn't there.

Can I see this image you are playing with? I bet just cloning and going that route will be much easier than what you're trying to do right now.

Hope this helps!

NATE


mainframe.gif


Got a question? Search G O O G L E for links to the fastest answers: www.google.com
 
Well, I know all about cloning to touch up an image, but the stupid overlay is much too big for it to be feasible... maybe for one image but not for all sixteen of them. Besides, you can't clone something that isn't there (like someone's entire missing face).

I'm not familiar with how to use the healing brushes, though.

Give me an email address and I'll show you what I'm looking at.

E

P.S. I just figured out why there may not be an HSB channel. Black is what saturation? It has no color, so has no saturation at all, not just 0% or 100%. So

-------------------------------------
It is better to have honor than a good reputation.
(Reputation is what other people think about you. Honor is what you know about yourself.)
 
If you dig out your Photoshop CD, have a look in the "Goodies > Optional Plug-Ins > Photoshop Only" folder for something called HSL & HSB Filter. Quit Photoshop, copy the filter into the Plug-Ins > Adobe Photoshop Only folder and restart Photoshop.

To use it, you need to have an RGB image, but it's best to work on a copy. Go to Filter > Other > HSB/HSL. In the dialog that appears, select "RGB" as the Input Mode, and "HSB" as the Output mode. When you click OK, your image will remain in RGB mode, but it will undergo a dramatic color shift. In fact, the "Green" channel is actually your saturation. By copying that channel on its own, you can create a new mask / alpha channel / whatever in your original image.

Good luck!
 
Hey blueark,

Thanks a ton for the help! I haven't done it yet but what you've outlined sounds great. It makes perfect sense and it's obvious you know your stuff (and understood the question, which I appreciate). Have a star.

-------------------------------------
It is better to have honor than a good reputation.
(Reputation is what other people think about you. Honor is what you know about yourself.)
 
After looking at that image though I don't think what blueark metioned will work as well as the cloned version I sent you. It might though.

Blueark just to let you know that image had balloons all over it for a birthday photo and some trailing stars etc. Simply converting those parts will not reproduce the images underneath. You need to do advanced cloning to get rid of all of it.

NATE


mainframe.gif


Got a question? Search G O O G L E first.
 
Maybe I'm not understanding the question correctly after all! The saturation technique is only meant to produce a mask that can be used to isolate certain parts of an image. You're quite right in saying that it won't magically show what should be underneath.

If you just want to mask off the overlay so you can apply color correction to the rest of the image, it may start you off on the right track. Also consider using Select > Color Range... and tidy up the selection in Quick Mask mode afterwards. It's probably a lot less trouble!
 
Somehow my last post didn't make it onto the forum.

Blueark, you understood perfectly. In some of the photos, the overlay is not in such a bad position, but I still need to color correct the actual photo pixels. But in order to do so properly, I need to select everything BUT the overlay. Given the complexity of the overlay it was a difficult task. SPYDERIX's suggestion to use various color modes and color channels was excellent and it basically did the trick I was looking for with the saturation thing. I still am interested in knowing how to convert saturation to its own channel, which you told me perfectly.

SPYDERIX, my question in this forum was to learn something about Photoshop that I wanted to know. Anyway, please give me some credit--I certainly know that merely selecting parts of an image would not help me remove an overlay! Sheesh! [smile] [smile] [smile] I know all about the clone tool and intend to look up the healing brush. Maybe I will send you a picture where I inserted an entire person standing next to someone. Or where I switched heads on two dogs. Mostly done using the clone stamp.

Please don't feel I am ungrateful. Your efforts to remove the overlay for me were appreciated, and you went far beyond the call of duty.

-------------------------------------
It is better to have honor than a good reputation.
(Reputation is what other people think about you. Honor is what you know about yourself.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top