Page 1 of 1

LevelColors

Posted: 2013-04-03T09:47:27-07:00
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

Re: LevelColors

Posted: 2013-04-03T09:50:14-07:00
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.

Re: LevelColors

Posted: 2013-04-03T23:51:25-07:00
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