Skip to content
Related Articles

Related Articles

Improve Article

PHP | Imagick optimizeImageLayers() Function

  • Last Updated : 27 Aug, 2019

The Imagick::optimizeImageLayers() function is an inbuilt function in PHP which is used to remove the repeated portions of images to optimize. This function compares each image the GIF disposed forms of the previous image in the sequence.


bool Imagick::optimizeImageLayers( void)

Parameters: This function does not accepts any paramenters.

Return Value: This function returns TRUE on success.

Errors/Exceptions: This function throws ImagickException on error.

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


// Create a new imagick object
$imagick = new Imagick(
// Optimizing the image layers 
header("Content-Type: image/jpg");
// Display the output image
echo $imagick->getImageBlob();



My Personal Notes arrow_drop_up
Recommended Articles
Page :