Search code examples
imagemagickcurves

ImageMagick equivalent to PhotoShop Curves


I am trying to convert some custom image filters with ImageMagic command line from PhotoShop tutorials. I can manage to work out most of it, but when it comes to "Curves", I can't seem to find any information on how to translate the following using ImageMagic command line.

Image > Adjustments > Curves. Go into the green channel and put the output to 32 and then go to the blue channel and put the output to 110.

I am trying to adjust the colors in the $img_in in this example:

$img_in = "image.jpg";
$gradient = "convert -size $dim radial-gradient:#f7d9ad-#f0ce9b ";
$c = " $gradient -compose multiply -gravity center -composite ";
exec("convert $img_in $c $img_out");

Any help here would be appreciated.


Solution

  • If you mean you want to set the curves so that the maximum output value of the green channel is 42, you are effectively scaling the green channel by a factor of 42/255. So, if your original inage was, say, white, and your green channel curve looks like this, your image would be more red and blue (i.e. purplish) like this when you reduce the green to 42/255 of its full-scale value.

    enter image description here

    then you could achieve the same effect in ImageMagick using the fx operator like this:

    convert -channel green input.jpg -fx "u*42/255" out.jpg