PHP Classes

GIF Animation Resizer: Resize animations in files of the GIF format

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (10)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 72%Total: 2,572 This week: 1All time: 1,490 This week: 39Up
Version License PHP version Categories
php-gif-resizer 1.0MIT/X Consortium ...5.0PHP 5, Graphics, Video


This class can resize animations in files of the GIF format.

It can take an animated GIF image file and extracts its frames to files into a temporary directory.

The class resizes the extracted images and rebuilds the animation into a new file in the GIF format.

Innovation Award
PHP Programming Innovation award nominee
February 2012
Number 3

Prize: One downloadable copy of PhpED Professional
GIF is an image file format that can be used to present animations by showing a sequence of images stored inside the same GIF image file.

If you need to show a GIF animation in an image size different than the original, you need to extract all the animation frames, resize each of them and rebuild the animation with the desired size. This class does that.

Manuel Lemos
Picture of Taha Paksu
  Performance   Level  
Name: Taha Paksu is available for providing paid consulting. Contact Taha Paksu .
Classes: 3 packages by
Country: Turkey Turkey
Age: 40
All time rank: 1722 in Turkey Turkey
Week rank: 44 Up3 in Turkey Turkey Down
Innovation award
Innovation award
Nominee: 2x

Winner: 1x


PHP GIF Animation Resizer (written by Taha PAKSU <tpaksu (at) gmail (dot) com>) .:: INTRODUCTION ::. This class resizes GIF Animations by parsing the GIF animation into seperate GIF Images and combining them after desired resize operation. It's written because there is not so many sources about this operation and PHP's GD library didn't support it, ImageMagick succeeds it with some executable file etc. .:: DEPENDENCIES ::. - PHP 5 or higher - GD Image Library .:: FEATURES ::. - Light and easy to use - Needs a temp directory for frames - Delay Timings and Disposal Methods stay the same - Minimum diffusion - Tested with several GIF animations .:: EXAMPLES ::. See the attached examples files for more information. Just download the whole package and extract it into a web directory. After that, just call test.php script within you browser and have fun. .:: DOCUMENTATION ::. Code is partly explained in the class file. But there are some points to look first: 1. You need to create a folder and make it writeable (CHMOD 777) and set the $class->temp_dir variable to point that folder. Because it needs a folder to extract the frames. 2. The paths should be relative and existing. You should define the new file path with an existing and writeable folder. 3. This class has only one function and it is $class->resize(). It's used like this : include_once "gifresizer.php"; $gr = new gifresizer; $gr->temp_dir = "frames"; //note that it doesn't end with a "/" $gr->resize("gif/1.gif","resized/1.gif",200,300); // $gr->resize({file to be resized}, {new file to be created}, {new width}, {new height}); and that's all. .:: SUPPORT ::. If you made efforts to add features, bugfixes, complain about the uselessness of this class, or you simply want to leave a personal comment, you are welcome to write me, and explain what you have done and why.

  • 1_resized.gif
  Files folder image Files  
File Role Description
Files folder imageframes (1 file)
Files folder imagegifs (1 file)
Files folder imageresized (1 file)
Accessible without login Plain text file gifresizer.php Class Main Class File
Accessible without login Plain text file readme.txt Doc. Readme & Documentation
Accessible without login Plain text file test.php Example Test & Example File

  Files folder image Files  /  frames  
File Role Description
  Accessible without login Plain text file placeholder.txt Data File not neccessary but the folder is.

  Files folder image Files  /  gifs  
File Role Description
  Accessible without login Image file 1.gif Icon Test & Example File

  Files folder image Files  /  resized  
File Role Description
  Accessible without login Image file 1_resized.gif Output Example Output

 Version Control Unique User Downloads Download Rankings  
This week:1
All time:1,490
This week:39Up
User Ratings User Comments (3)
 All time
Its really a awesome class.
10 years ago (Dhamodharan R)
10 years ago (Guillermo Chigo)
This class is the best on web ! good job.
12 years ago (alyn)