Page 1 of 1

Help with translating command to Imagick

Posted: 2011-03-07T03:22:04-07:00
by stroker
What's the equivalent to ImageMagick cmd "convert image.jpg -fx intensity -gamma $RED,$GREEN,$BLUE out.jpg"?

Re: Help with translating command to Imagick

Posted: 2011-03-07T09:54:56-07:00
by fmw42
see fxImage and gammaImage at http://us3.php.net/manual/en/book.imagick.php

sorry I am not an iMagick user

Re: Help with translating command to Imagick

Posted: 2011-03-08T03:09:17-07:00
by stroker
Ok thanks for your answer. I actually tried fxImage and gammaImage first but I was uncertain of the parameters.
It's seems that you have to call gammaImage for each color:
$im->gammaImage($RED, Imagick::CHANNEL_RED);
$im->gammaImage($GREEN, Imagick::CHANNEL_GREEN);
$im->gammaImage($BLUE, Imagick::CHANNEL_BLUE);

I've got that working but I can't get -fxImage('intensity') to work, it does nothing. What is the correct way to convert a RGB image to grayscale with the way that the eyes perceive them?
I know that our eyes are most sensitive to green and the command -fx intensity converts regarding to that. I want to use this command in php Imagick.

Re: Help with translating command to Imagick

Posted: 2011-03-08T10:02:03-07:00
by fmw42
use the equivalent of -colorspace and see colorspaces at http://www.imagemagick.org/script/comma ... colorspace and in particular: either Rec601Luma or Rec709Luma or gray

Re: Help with translating command to Imagick

Posted: 2011-03-11T07:25:36-07:00
by stroker
Thanks that works. I also found out that fxImage('intensity') works as well. I used it the wrong way, the function return a new Imagick object with the changes.