Imagick::optimizeImageLayers
PHP function
Edit on GitHub ✎
(PECL imagick 2, PECL imagick 3)
Removes repeated portions of images to optimize
Description
Imagick::optimizeImageLayers(): bool
Compares each image the GIF disposed forms of the previous image in the sequence. From this it attempts to select the smallest cropped image to replace each frame, while preserving the results of the animation. 0x629
Parameters Parameters
Return Values
Success
Errors/Exceptions
Throws
Examples
Using Imagick::optimizeImageLayers()
Reading, optimizing and writing a GIF image
php
<?php
/* create new imagick object */
$im = new Imagick("test.gif");
/* optimize the image layers */
$im->optimizeImageLayers();
/* write the image back */
$im->writeImages("test_optimized.gif", true);
?>