I cannot find a working example. This one is not working, it's not animated:
$imagick = new Imagick($_FILES['file']['tmp_name']);
$format = $imagick->getImageFormat();
if ($format == 'GIF') {
$imagick = $imagick->coalesceImages();
do {
$imagick->resizeImage(500, 500, Imagick::FILTER_BOX, 1);
} while ($imagick->nextImage());
$imagick = $imagick->deconstructImages();
$imagick->writeImages($name, true);
}
$imagick->clear();
$imagick->destroy();
In ImageMagick command line, this works for me
Original Animation:
convert animation.gif -coalesce -resize 500x500 -layers optimize -loop 0 resize.gif
Did you do the equivalent of -coalesce after reading your input animation? Did you do the optimize step after resizing?
Sorry, I do not use PHP Imagick or any other API.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.