Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Animated gifs don't resize well sometimes (Imagick)

When resizing this image:

I get this:

Note that I didn't specify it to be cropped, just smaller with the same ratio.

I noticed that merely saving the file using this code:

$image = new \Phalcon\Image\Adapter\Imagick($filePath);
$image->save($filePath);

Produces this exception:

images are not the same size /var/www/storage/media/397.gif @ error/layer.c/OptimizeLayerFrames/1026

Only when I get this exception, the resize is screwed up.

This happens not to all animated gifs, but maybe 50% of the ones I've tested.



79.5k
Accepted
answer
edited 25d ago

in my experience its best to use shell_exec to perform image magick operations.

imagick is a php wrapper extention that is not maintained for a VERY long time ( the guy said he has very little spare time to fix it )

So eather its image magick problem ( which i doubt ) or more likely imagick's fault.

//phalcon is just calling imagick functions, nothing special there.



59.9k
edited 18d ago

I don't think that \Phalcon\Image\Adapter\Imagick should be in the core Zephir extension but instead in the Composer package as PHP.