Page 1 of 1

MagickLevelImage parameters

Posted: 2007-02-09T05:32:40-07:00
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.

Re: MagickLevelImage parameters

Posted: 2009-10-17T09:16:06-07:00
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

Re: MagickLevelImage parameters

Posted: 2009-10-17T13:08:38-07:00
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