MagickLevelImage parameters

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
aditan22

MagickLevelImage parameters

Post by aditan22 »

Reading Anthony's ImageMagick Examples here: http://www.imagemagick.org/Usage/color/#levels
While adjusting the black and white 'points' inward will increase the overall contrast of the image, a little...

convert rose: -level 5%,95%,1.0 rose_contrast.gif

Or increase the contrast a LOT...

convert rose: -level 20%,80%,1.0 rose_contrast2.gif


How to implement this in MagickWand PHP? I know there's a function MagickLevelImage, but it seems I cannot use percentage in the function's parameters.
sambessey
Posts: 22
Joined: 2008-01-04T18:26:40-07:00

Re: MagickLevelImage parameters

Post by sambessey »

Yep I can't get this to work either... The image is always white. Could you be a bit more specific in what parameters it accepts please?

Thanks
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: MagickLevelImage parameters

Post by el_supremo »

The IM source code implies that the inputs are within the quantum range, so if you wanted to pass arguments equivalent to "-level 5%,95%,1.0", In C you would use (I presume PHP is similar):

Code: Select all

	MagickLevelImage(magick_wand,5*QuantumRange/100,1.0,95*QuantumRange/100);
Note that the arguments are black_point, gamma, white_point


Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
Post Reply