Re: [GD-DEVEL] resize anim gif

From: Date: Fri, 28 Mar 2008 11:27:07 +0000
Subject: Re: [GD-DEVEL] resize anim gif
References: 1  Groups: php.gd.devel 
Request: Send a blank email to php-gd-devel+get-401@lists.php.net to get a copy of this message
Hi, On Fri, Mar 28, 2008 at 12:11 PM, aergis@gmail.com <aergis@gmail.com> wrote: > i'd like to resize gif containing multiple frames. > if i try this it only saves first frame :( > > FILE *fp=0; > gdImagePtr im, im2; > int width,height,error=0; > fp = fopen("1.gif", "rb"); > if (!fp) return -1; > im = gdImageCreateFromGif(fp); > fclose(fp); > fp = fopen("2.gif", "wb"); > gdImageGif(im,fp); > fclose(fp); > gdImageDestroy(im); > > someone possibly has that obviously terribly complex code that reads, > resizes and saves all frames ? GD can't read animated GIF in its current stable version (2.0.x). It is on our todo for gd 2.1 and a patch is available here: http://bugs.libgd.org/?do=details&task_id=57&pagenum=2 > i did find one solution with imagemagick convert, but it is surprisingly > slow, way slower than imagemagick mogrify - which does not work correctly, > would gd version work ok, faster ? It really depends on a couple of things: - how many frames (obviously) - how large are each frame (GIF frames can have different sizes) - the interpolation you use (bicubic, nearest, etc.) I'm working on the new resize and affine transformation today and should hit CVS tonight. It should then not be very hard to find the faster way to do this task. However, the bottleneck is certainly to read the GIF anim (for small images). Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org

« previous php.gd.devel (#401) next »