Page 1 of 1

does it realy take this long to create an animated gif?

Posted: 2008-06-14T16:06:00-07:00
by bbunlock
I have just wrote a php script for my site (with the help of great members on here) and the last thing the script does is create an animated gif from 3 jpg images

the 3 jpg images are only 176x235 and avarege around 35kb each, however when I create an animated gif from them it takes around 5 to 7 seconds (on a duel zeon server), so as the title of this topic says "does it realy take this long to create an animated gif?"

I will paste the code im using for the animated gifs below, however if 5 to 7 seconds is average to create an animated gif from 3 jpg's of that size then at least I know im not doing anything wrong, It just that 5 to 7 seconds seem a long time for this?

Code: Select all

		$crop_image = $imageMagickPath."convert -delay 150 -dispose None "
                ." -page 176x235+0+0  screen1.gif  "
               ."  -page +0+0 screen2.jpg  "
                ." -page +0+0 screen3.jpg  "
		." -loop 0 theme.gif";
		
			exec($crop_image);
the screen1.jpg, screen2.jpg, screen3.jpg are all 176x235 and its just a simple animation looing through those 3 images.

am I doing this right?

regards

Re: does it realy take this long to create an animated gif?

Posted: 2008-06-14T16:27:12-07:00
by fmw42
I don't know if this relates to your problem directly, but see

viewtopic.php?f=3&t=11413

Re: does it realy take this long to create an animated gif?

Posted: 2008-06-14T16:35:00-07:00
by bbunlock
thanks for the quick reply fmw42

I am not sure if that applies to me or not? it may do as im actualy using an older version "ImageMagick 6.2.8"

but it would apear to be no pooint updating yet until they have repleased the patch for that (today i think gonna check it out)

anain thanks for the heads up on that, will let you know how I get on.

UPDATE

I have just done a convert of a jpg to a gif (not animated) and it took about a second to do it, so im guessing thats not my problem.

regards

Re: does it realy take this long to create an animated gif?

Posted: 2008-06-15T00:57:10-07:00
by anthony
More than likely the time is involved with color quantization and dithering, which is required to compress PNG and JPEG images containing 'millions' of colors to GIF which only allows 256 colors maximum per frame. The larger the image the harder it is to create a GIF.

You may like to look at some of the techniques looked at quickly in the IM Examples page on 'Videos' EG video to GIF conversion.
http://imagemagick.org/Usage/video/

This is looked at in even more detail on animation optimization.
http://imagemagick.org/Usage/anim_opt/

Basically GIF is only a good format when you deal with small images of uniform, and minimal colors. JPEG will make this worse as it's lossy behaviour causes simple images to suddenly contain LOTS of slight color variations. Don't use it for intermediate images if you can.