Re: [GM-help] Splitting Animated Gif + Montage - Most Efficient Way?
Swiss army knife of image processing
Brought to you by:
bfriesen
From: Bob F. <bfr...@si...> - 2013-01-25 03:49:25
|
On Thu, 24 Jan 2013, Umbrae wrote: > Hi folks, > I previously asked about splitting a gif into frames, which got me a fairly long > way: http://comments.gmane.org/gmane.comp.video.graphicsmagick.help/1704 > > I'm a bit deeper into this now and I've got one more question if you don't mind. I'm trying to split a gif into its frames and then > restitch those gifs into one large gif, concatenated vertically, via the command line. So far the best way I've found to do it is the > following: > > gm convert source-animated.gif \ > -verbose +adjoin -coalesce miff:- | \ > gm montage - -mode concatenate -tile 1x dest-concatenated.gif > > > This works well, and produces images like: http://i.imgur.com/ZyxQg2v.gif > > However, in some cases this is taking a very long time to complete - sometimes up to 40 seconds on my macbook air. The starting gif is > about 1.9 megs to be fair, but I'm curious if there may be an obvious way to optimize this that I'm missing? Have you tried using gm convert - -append dest-concatenated.gif rather than montage? This a little bit faster. Whenever one is dealing with writing GIF files, most of the time is likely to be spent doing color quantization to find the best set of colors to represent the output image with its limit of 256 colors, and then remap all of the pixels to use those colors. This has always been slow. Adding +dither is likely to make GIF output faster but with less quality, and particularly less quality for photos: gm convert - -append +dither dest-concatenated.gif The documentation also says that -treedepth may be a useful tunable. It accepts values between 2 and 8: gm convert - -append -treedepth 4 dest-concatenated.gif I don't find this one to be so useful. The best thing to do is to avoid GIF and other formats which require color reduction if you can. Bob -- Bob Friesenhahn bfr...@si..., http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ |