when an animated gif image is resized sometimes it breaks the gif. Its still animated but messes up the images in the sequence.
In imageapi_imagemagick.module line 115
function imageapi_imagemagick_image_resize(&$image, $width, $height)
Was
$image->ops[] = '-resize '. (int) $width .'x'. (int) $height .'!';
changed it to
if($image->info['mime_type'] == 'image/gif'){
$image->ops[] = '-coalesce -resize '. (int) $width .'x'. (int) $height .'!';
}else{
$image->ops[] = '-resize '. (int) $width .'x'. (int) $height .'!';
}
Adding the -coalesce function, now the animated gif image resize correctly
Comments
Comment #1
morbiD CreditAttribution: morbiD commentedI just ran into this issue and the ImageMagick "-coalesce" switch is indeed required for correctly resizing animated gifs without messing them up. The above fix corrects the issue.
However, the ImageMagick documentation says:
Does that mean it shouldn't really be applied to all gif files? Is there any way to specifically detect animated gifs in the PHP logic or something?
Comment #2
crea CreditAttribution: crea commentedSubscribing.
Comment #3
NaX CreditAttribution: NaX commented@jagermonster
Thanks, this worked for me. The animations are now showing correctly.
I hacked the resize function as follows.
If I had the time I would consider creating a gif safe imagecache resize action.
Comment #4
sunCorresponding ImageMagick issue: #1802534: ImageMagick scale breaks animated gifs
Comment #5
dboulet CreditAttribution: dboulet commented