Page 1 of 1
Need syntax for Recolor and level in PerlMagick
Posted: 2007-10-29T10:30:36-07:00
by stully
I have been trying to use these two commands like this:
Code: Select all
# 5 x 4 color matrix
$image->Recolor([1.44,0,0,0,-27.94,0,1.44,0,0,-27.94,0,0,1.44,0,-27.94,0,0,0,1,0]);
# 5 x 5 color matrix
$image->Recolor([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0.5, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
$image->Recolor(matrix=>"1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0.5, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1");
$image->Level(level=>'20%');
In each case, the Perl script finishes successfully... but the original image is unchanged.
I am using ImageMagick ver: ImageMagick 6.2.4 02/10/07 Q16
Perl is 5.something
If anyone knows the correct syntax, any help would be greatly appreciated.
Re: Need syntax for Recolor and level in PerlMagick
Posted: 2007-10-29T12:13:51-07:00
by magick
Recolor() requires a square matrix. In your case, 25 elements are required, you have 20.
Re: Need syntax for Recolor and level in PerlMagick
Posted: 2007-10-29T16:56:25-07:00
by stully
Thanks for looking at this. As you can see in my original post, I have tried both 4x5 and 5x5 matrices. And not only that, I guessed at a bunch of different syntaxes to specify the 5x5 matrix. I feel like I'm pretty close - and yet I might as well be miles away if I don't know the right syntax. Thanks again for any help - or pointers to an example of Recolor (or Level) in PerlMagick.
Re: Need syntax for Recolor and level in PerlMagick
Posted: 2007-10-29T17:25:22-07:00
by magick
We tried a matrix of the form [ ... ] with ImageMagick 6.3.6-3, the latest release and it works fine for us.
Re: Need syntax for Recolor and level in PerlMagick
Posted: 2007-10-30T17:25:23-07:00
by stully
My sysadmin just told me that the reason Recolor wasn't working was that Recolor wasn't included in the Debian package of ImageMagick.
Thanks again for your help and sorry for the confusion.
Re: Need syntax for Recolor and level in PerlMagick
Posted: 2007-10-31T08:24:22-07:00
by stully
My sysadmin can't find a copy of this file, Recolor.al in any distribution.
My Perl script is generating this error message:
Can't locate auto/Image/Magick/Recolor.al in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /usr/local/sites/matrix2.cgi line 14
Is this a bug with the version we're using? ( ImageMagick 6.2.4 02/10/07 Q16 )
Where do we find that file?
Re: Need syntax for Recolor and level in PerlMagick
Posted: 2007-10-31T08:50:07-07:00
by magick
Most likely the Recolor() method was not available in ImageMagick 6.2.4. To use it you need a more modern version of ImageMagick. The current release is ImageMagick 6.3.6-4.
Re: Need syntax for Recolor and level in PerlMagick
Posted: 2007-10-31T13:06:21-07:00
by stully
We just upgraded to the newest version of IM and Recolor works perfectly both at the command line and in PerlMagick.
Thanks for your help.