PHP | Imagick previewImages() Function

The Imagick::previewImages() function is an inbuilt function in PHP which is used to quickly pin-point appropriate parameters for image processing. It tiles 9 thumbnails of the specified image with an image processing operation applied at varying strengths.

Syntax:

bool Imagick::previewImages( int $preview )

Parameters: This function accepts single parameter $preview which holds the preview type constants. Click here to get the list of preview type constants.

Return Value: This function returns TRUE on success and FALSE on Error or Failure.

Errors/Exceptions: It throws ImagickException while error occured.



Below program illustrates the Imagick::previewImages() function in PHP:

Program:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php 
  
// Store the image source into variable
$imagePath =
  
// Create new Imagick object
$imagick = new \Imagick($imagePath);
  
// Use previewImages() function
$imagick->previewImages(imagick::PREVIEW_EDGEDETECT);
  
header("Content-Type: image/png");
  
// Display output image
echo $imagick->getImageBlob();
  
?>

chevron_right


Output:

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

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.