PHP | Imagick linearStretchImage() Function
Last Updated :
08 Aug, 2019
The Imagick::linearStretchImage() function is an inbuilt function in PHP which is used to stretch with saturation the image intensity. The calculation of Imagick::linearStretchImage() function is carry by pixels multiples with blackPoint and whitePoint simultaneously.
Syntax:
bool Imagick::linearStretchImage( $blackPoint, $whitePoint )
Parameters: This function accepts two parameters as mentioned above and described below:
- $blackPoint: This parameter holds the image black point.
- $whitePoint: This parameter holds the image white point.
Return Value: This function returns TRUE on success FALSE on failure.
Below example illustrates the Imagick::linearStretchImage() function in PHP:
Program: This program uses Imagick::linearStretchImage() function to stretch with saturation the image intensity.
<?php
$imagePath =
$blackThreshold = 23;
$whiteThreshold = 45;
$imagick = new \Imagick( $imagePath );
$pixels = $imagick ->getImageWidth() * $imagick ->getImageHeight();
$imagick ->linearStretchImage( $blackThreshold * $pixels , $whiteThreshold * $pixels );
header( "Content-Type: image/jpeg" );
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagick.linearstretchimage.php
Share your thoughts in the comments
Please Login to comment...