LevelColors

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
johnfl68
Posts: 33
Joined: 2012-07-09T18:31:26-07:00
Authentication code: 13

LevelColors

Post by johnfl68 »

Does anyone know how to use LevelColors in perl as in the example with turning the black cow to red as on this page:

http://www.imagemagick.org/Usage/color_ ... vel-colors

I have tried the following:

Code: Select all

$image->LevelColors('black-point' => "red", );
This only turns white to cyan, and does nothing to black. I also tried with and without the comma after the red, which seems to make no difference.

If anyone knows how this will work, it would be appreciated.

Thanks!

John
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: LevelColors

Post by fmw42 »

$image->LevelColors('black-point' => "red", );
I am not a perlmagick user.

But, you may need to set the white-point to white as well. Also be sure your input image is not in cmyk colorspace.
johnfl68
Posts: 33
Joined: 2012-07-09T18:31:26-07:00
Authentication code: 13

Re: LevelColors

Post by johnfl68 »

OK, I figured this one out, at least it seems to be working right now.

fmw42 -Thanks for the suggestion, but as in the example I cited, I intended to set only the black-point color, as that is how you get the results I am after in the black to red cow example. In the command line version you specifically leave the comma in place:

Code: Select all

convert cow.gif   +level-colors red,   cow_red.gif
So the following works for me in perl, recoloring a black icon with transparent background to red, or what ever color I choose as the black-point color (akin to color overlay in Photoshop):

Code: Select all

$image->LevelColors('black-point' => "red", invert => 'True' );
How I found this out, (and I am not at all used to the command line version of IM) was I picked up on the fact that this was a plus (+) effect, and not a minus (-) effect. So I searched for other Perl examples of plus effects, and found that I needed to add an 'invert' to the effect.

Hopefully this will help others!

John
Post Reply