Page 1 of 1

convert -modulate

Posted: 2011-04-17T17:20:17-07:00
by tgakic
Hi everyone,

I do try to perform an operation from command line with convert, but I can't get around it, yet. Maybe I overlook the exact keyword in the manual. In that case maybe someone can point it to me...

How do I use the modulate option of the convert to change only one colorspace and not all. For example if I do:

Code: Select all

convert image.png -modulate 100,100,200 modulate.png
I change red in cyan, yellow in blue, etc. But what if I only want to change only cyan in red, not the other colors? I have try to use

Code: Select all

-set option:modulate:colorspace cyan
and similar, but it will not work.

I found a way to do it using gimp [1], but I would like to use a command line tool, like convert to do this. Any ideeas?

Thank you.

Ionel

[1] Colors -> Hue-Saturation... -> C -> Hue at 180

Re: convert -modulate

Posted: 2011-04-17T17:25:31-07:00
by fmw42
tgakic wrote:Hi everyone,

I do try to perform an operation from command line with convert, but I can't get around it, yet. Maybe I overlook the exact keyword in the manual. In that case maybe someone can point it to me...

How do I use the modulate option of the convert to change only one colorspace and not all. For example if I do:

Code: Select all

convert image.png -modulate 100,100,200 modulate.png
I change red in cyan, yellow in blue, etc. But what if I only want to change only cyan in red, not the other colors? I have try to use

Code: Select all

-set option:modulate:colorspace cyan
and similar, but it will not work.

I found a way to do it using gimp [1], but I would like to use a command line tool, like convert to do this. Any ideeas?

Thank you.

Ionel

[1] Colors -> Hue-Saturation... -> C -> Hue at 180

If you have one exact color to convert, you want

convert image -fill newcolor -opaque oldcolor resultimage

If you want to make colors near oldcolor become newcolor then

convert image -fuzz XX% -fill newcolor -opaque oldcolor resultimage

If you want to convert one range of hues to another range of hues, see my unix/bash script, huemap, at the link below.

For Windows users, you would need to install cygwin and the cygwin install of IM to use my scripts.

Re: convert -modulate

Posted: 2011-04-17T18:14:56-07:00
by tgakic
fmw42 wrote: You have posted to the wrong forum. Please use the ImageMagick forum at the top.
[...]
fmw42 wrote: If you want to convert one range of hues to another range of hues, see my unix/bash script, huemap, at the link below.

Thank you. Sorry for posting in a wrong forum.

I found out that your script is what I was looking for.

Code: Select all

./huemap -h 180,0 -t 30,30 imagein imageout
does the trick. Thank you, again.

Ionel

Re: convert -modulate

Posted: 2011-04-17T18:26:02-07:00
by fmw42
No problem. Glad to help.