modulate blue areas in hue

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mikolaskova
Posts: 8
Joined: 2010-11-21T14:35:44-07:00
Authentication code: 8675308

modulate blue areas in hue

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: modulate blue areas in hue

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: modulate blue areas in hue

Post by anthony »

In what way do you want to "modulate blue areas"

It could mean a LOT of things!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
mikolaskova
Posts: 8
Joined: 2010-11-21T14:35:44-07:00
Authentication code: 8675308

Re: modulate blue areas in hue

Post 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?
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: modulate blue areas in hue

Post 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?
mikolaskova
Posts: 8
Joined: 2010-11-21T14:35:44-07:00
Authentication code: 8675308

Re: modulate blue areas in hue

Post 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
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: modulate blue areas in hue

Post 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
mikolaskova
Posts: 8
Joined: 2010-11-21T14:35:44-07:00
Authentication code: 8675308

Re: modulate blue areas in hue

Post 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...
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: modulate blue areas in hue

Post 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.
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: modulate blue areas in hue

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: modulate blue areas in hue

Post 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
Post Reply