Skip to content
Related Articles

Related Articles

Improve Article

PHP | Imagick sigmoidalContrastImage() Function

  • Last Updated : 11 Dec, 2019

The Imagick::sigmoidalContrastImage() function is an inbuilt function in PHP which is used to adjust the contrast of an image with a non-linear sigmoidal contrast algorithm.

Syntax:

bool Imagick::sigmoidalContrastImage( bool $sharpen, float $alpha,
                 float $beta, int $channel = Imagick::CHANNEL_DEFAULT)

Parameters: This function accepts four parameters as mentioned above and described below:

  • $sharpen: It specifies whether to increase or decrease the contrast. The true value increases the contrast and the false value decreases the contrast.
  • $alpha: It specifies the amount of contrast to apply.
  • $beta: It specifies the midpoint of the gradient.
  • $channel: It is optional parameter that hold the channel constant. The default value is Imagick::CHANNEL_DEFAULT.

Return Value: This function returns TRUE on success.

Exceptions: This function throws ImagickException on error.



Below programs illustrate the Imagick::sigmoidalContrastImage() function in PHP:

Program 1:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Adjust the contrast
$imagick->sigmoidalContrastImage(true, 10, 32000);
  
// Show the output
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>

Output:

Program 2:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Adjust the contrast
$imagick->sigmoidalContrastImage(false, 10, 31000);
  
// Show the output
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>

Output:

Reference: https://www.php.net/manual/en/imagick.sigmoidalcontrastimage.php




My Personal Notes arrow_drop_up
Recommended Articles
Page :