Page 1 of 1

modulate blue areas in hue

Posted: 2010-11-21T14:38:36-07:00
by mikolaskova
Hello,

how can I modulate blue areas of an image in its hue

I tried things like

Code: Select all

convert test.JPG -channel blue -modulate 40,40  test4.jpg but this always changes the whole image...
Thanks and regards

Adriana

Re: modulate blue areas in hue

Posted: 2010-11-21T16:19:52-07:00
by fmw42
the order of the arguments for -modulate are Brightness (Lightness), Saturation, Hue

see

http://www.imagemagick.org/script/comma ... p#modulate
http://www.imagemagick.org/Usage/color/#color_mods

Re: modulate blue areas in hue

Posted: 2010-11-21T20:29:22-07:00
by anthony
In what way do you want to "modulate blue areas"

It could mean a LOT of things!

Re: modulate blue areas in hue

Posted: 2010-11-22T12:35:22-07:00
by mikolaskova
thank you... I know the order of the modulate arguments, but I don't know how to apply this function on parts of the image, that have a certain color. I know how to replace certain parts with a color (f.e. fill with orange ...convert DSC_0208.JPG -fuzz 50% -fill orange -opaque blue test5.jpg) but I don't want to fill but just modulate the areas I get f.e. by -opaque blue.

It does not work if I replace -fill with -modulate, so I suppose, there is another solution for this?

Re: modulate blue areas in hue

Posted: 2010-11-22T13:04:54-07:00
by GreenKoopa
Are you trying to increase the brightness and saturation, but only in the areas of the image with a blue hue? I'm still not clear on your intent. When you gave "-fuzz 50% -fill orange -opaque blue" as an example, do you mean that this makes the area you wish to -modulate orange? When you do try -modulate, does it give you what you want in those areas, if only it would leave the other areas alone? We would like to help, but at least I am unclear to your needs. Could you link to an example image?

Re: modulate blue areas in hue

Posted: 2010-11-22T13:22:49-07:00
by mikolaskova
Yes, I'm trying to change the brightness, saturation and hue(ยจ) in areas of the image with a blue hue.

This could be the original Image
This could be the original Image

(this exemple is made by the GIMP function Color<Hue- Saturation, there chosen blue and changed the hue)

Thank you very much, best regards

Adriana

Re: modulate blue areas in hue

Posted: 2010-11-22T13:36:49-07:00
by GreenKoopa
I'm not sure that answered all my questions of your need. I'll assume that with your original and modulated image, every area is what you want in at least one of them.

One option is to -composite your original image and modulated image together using a mask. See:
http://www.imagemagick.org/Usage/compose/#mask

Re: modulate blue areas in hue

Posted: 2010-11-22T13:47:31-07:00
by mikolaskova
thank you, but I try once more to explain: I have many images with something blue in the background*. with -opaque blue I managed to separated this part in the image. But instead of filling it with another color, I want to modulate this blue part f.e. change the saturation to 120, the brightness to 150 and the hue to 180.

*it's not always the same area of image, so I can not use composite...

Re: modulate blue areas in hue

Posted: 2010-11-22T14:03:10-07:00
by GreenKoopa
mikolaskova wrote:*it's not always the same area of image, so I can not use composite...
The area of interest changing means you can't use a fixed mask, but you can generate a mask for use with composite. Something like:

Code: Select all

convert original.jpg -fuzz 50% -fill white -opaque blue -threshold 99% mask.png
I don't know, but GIMP probably uses a more complex composite method than a simple mask.

Re: modulate blue areas in hue

Posted: 2010-11-22T16:05:45-07:00
by GreenKoopa
All together now:

Code: Select all

convert original.jpg -modulate 120,120,180 changed.png
convert original.jpg -fuzz 50%% -fill white -opaque blue -threshold 99%% mask.png
composite changed.png original.jpg mask.png a.png
Broken into steps so that you may examine the intermediate images. Change -modulate to whatever operation you like. Different masks or entire composite methods will certainly yield better blended results.

Re: modulate blue areas in hue

Posted: 2010-11-22T16:08:24-07:00
by fmw42
The best way to handle that is to make a mask for the blue area (you can even blur the border by a pixel or two if you want), then process the whole image with -modulate so that the blue areas are correct even though the rest of the image is not, then composite the two images together using the mask to control that the result contains the blue from the modulated image and the rest comes from the original image.

see http://www.imagemagick.org/Usage/compose/#compose