Image ContrastStretch parameter syntax novice question

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
TPM

Image ContrastStretch parameter syntax novice question

Post by TPM »

Another beginer question:-

What is the syntax for the parameters needed for contrast stretch?

bool Imagick::contrastStretchImage ( float $black_point, float $white_point [, int $channel] )

I am trying to test basic capability to perform contrast adjustments. the following code executes but produces no transform of the output compared to the input image, I have tried experimenting with values for black point and whitepoint, which is not a very productive use of time, I tried strings, hex values etc.... Am I missing something or just doing somthing stupid......?

<?php

/*
Test of Contrast Stretch
*/

header( 'Content-Type: image/jpeg' );

$Imagick = new Imagick();
$infilename="c:/tmp/bigimagedark.jpg" ; // Artificaly compresed contrast test image
$Imagick->readImage( $infilename );
$Imagick->ContrastStretchImage();
$outimage="c:/tmp/testoutimage.jpg" ;
$Imagick->writeImage($outimage);

?>
Post Reply