convert -modulate

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
tgakic
Posts: 2
Joined: 2011-04-17T17:07:29-07:00
Authentication code: 8675308

convert -modulate

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

Re: convert -modulate

Post 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.
Last edited by fmw42 on 2011-04-17T19:28:54-07:00, edited 2 times in total.
tgakic
Posts: 2
Joined: 2011-04-17T17:07:29-07:00
Authentication code: 8675308

Re: convert -modulate

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

Re: convert -modulate

Post by fmw42 »

No problem. Glad to help.
Post Reply