March 1, 2010 in PHPlargeTutorials by Nathan Lampe

This question gets asked a lot and some seem to have a hard time finding a quick and easy answer to it. So how do you resize an animated gif with PHP and ImageMagick?

It’s pretty simple.

First define the file location.

Next we want to define the current height and width of the image as well as the new max width and height.

Now here is where the magic in ImageMagick comes from. We just execute two lines of code and we are done!

Complete Code:

Your animated gif has been resized!