2
votes

I am using this script to resize a gif with imagemagick and php: (using the php Imagick extention) : http://www.phpro.org/examples/Thumbnail-From-Animated-GIF.html

The problem is that if the gif has many frames the process of resizing each frame is very sever intensive and takes several minutes to complete a request.

I have found these two imagemagick commands:

convert big.gif -coalesce coalesce.gif
convert -size 200x100 coalesce.gif -resize 200x10 small.gif

however I do not know how to implement them to the Imagick extension, as they are raw commands. Would these commands speed up the processs of GIF conversion?

2

2 Answers

1
votes

You can execute that command buy doing

exec('convert big.gif -coalesce coalesce.gif', $output);
exec('convert -size 200x100 coalesces.gif -resize 200x10 small.gif', $output);

$output will bring back the command line results. exec() is a function in php to execute command/bash line commands. See the following for more of and explanation of the function. http://php.net/manual/en/function.exec.php

1
votes

The example on PHP.net is the only code I've found that actually keeps the frame timing in the GIF.