PHP | Gmagick despeckleimage() Function
The Gmagick::despeckleimage() function is an inbuilt function in PHP which is used to reduce the speckle noise in an image while preserving the edges of the original image.
Syntax:
Gmagick Gmagick::despeckleimage( void )
Parameters: This function doesn’t accept any parameter.
Return Value: This function returns a Gmagick object on success.
Exceptions: This function throws GmagickException on error.
Used Image: To capture the canvas area.
Below given programs illustrate the Gmagick::despeckleimage() function in PHP:
Program 1:
<?php
$gmagick = new Gmagick( 'geeksforgeeksgnoised.png' );
$gmagicknew = $gmagick ->despeckleimage();
header( 'Content-type: image/png' );
echo $gmagicknew ;
?>
|
Output:
Program 2:
<?php
$gmagick = new Gmagick( './geeksforgeeksnoised.png' );
$pixels = $gmagick ->getimagehistogram();
echo "Color of 100th pixel before removing noise: " ;
echo $pixels [99]->getcolor();
$gmagicknew = $gmagick ->despeckleimage();
$pixels = $gmagick ->getimagehistogram();
echo "<br>Color of 100th pixel after removing noise: " ;
echo $pixels [99]->getcolor();
?>
|
Output:
Color of 100th pixel before removing noise: rgb(0, 6682, 8995)
Color of 100th pixel after removing noise: rgb(3084, 5397, 7967)
Reference: https://www.php.net/manual/en/gmagick.despeckleimage.php
Last Updated :
17 Jan, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...