TODO: why can they make it smaller than convert? Are they just selecting better more minimal diff rectangles, or something else? See also: How do I create an animated gif from still images (preferably with the command line)? Gifsicle -resize 256x256 out-convert.gif > out-gifsicle.gifĪnd both produced an even smaller correctly looking 1.5 MiB output. I also tried out the following commands: ffmpeg -i out-convert.gif -vf scale=256:-1 out-ffmpeg-small.gif Not considerably smaller than out-coalesce.gif, but I think this is just because the black ground compresses really well, and it could be very significant in general. Out-deconstruct.gif: compressed frames, final output size 1.9 MiB. Output looks visually correct, but the output file size is 2.0 MiB, which is larger than out-deconstruct.gif Out-coalesce.gif: all frames are 256x256 and have the correct offset 0+0. Visually incorrect, since those approximately 256x256 frames have a non-zero offset, e.g. gif >output.gif Often ported commands need. Out.gif: All frames are 256x256 or larger, and huge at about 5MiB, TODO why? This ARexx script gives wildcard support to commands which dont support. Then, if we compare the three conversions: gifsicle -i anim.gif -O3 -colors 256 -o anim-opt.gif. $ identify out-deconstruct.gif | head -n 3 Use gifsicle (available for Mac OS X, Windows, DOS, Debian, FreeBSD and NetBSD). $ convert out-convert.gif -coalesce -resize 256x -deconstruct out-deconstruct.gif $ convert out-convert.gif -coalesce -resize 256x out-coalesce.gif $ convert out-convert.gif -resize 256x out.gif Using the test data from this answer: How do I create an animated gif from still images (preferably with the command line)? we can see this clearly with identify: $ identify out-convert.gif | head -n 3 coalesce then expands all the frames to the original size, which makes the resize work, but it does not re-compress the frames again as your input image: -deconstruct is needed for that! The root cause of the problem is that your input GIF was properly minimized: GIF allows the next frame to be just the modified rectangle from the previous one at an offset. If you have the time and patience, I recommend -O3 as was able to get much more optimized GIFs with this method.After -coalesce, you likely want to add a -deconstruct: convert in.gif -coalesce -resize 256x -deconstruct out-deconstruct.gif Gifsicle -O3 animation.gif -o animation-optimized.gif -O3 Try several optimization methods (usually slower, sometimes better results).-O2 Also uses transparency to shrink the file further.-O1 Stores only the changed portion of each image.Gifsicle has three types of GIF optimization to choose from: gifsicle can resize GIFs, merge GIFs, and do just about anything you'd hope you could do with a GIF. Another handy GIF manipulation library, gifsicle, has a few built in methods for optimizing GIFs.īefore jumping into the GIF optimization commands, it's important to point out that gifsicle is much more than a GIF optimizer. Since GIFs can be taxing on the user's machine, it's best to optimize GIFs for top performance. I've written a lot about converting different media types lately, especially GIFs, including Convert Video to GIF or GIF to Video, Detect if a GIF is Animated, and Get the First Frame of an Animated GIF with ImageMagick, but whether it's ImageMagick or ffmpeg doing the work, GIFs do not always come out optimized.
0 Comments
Leave a Reply. |