oscar_cape_crop.png
[Hide] (920.3KB, 1920x1080) gifsicle-after.gif
[Hide] (477.7KB, 1440x1080) Pai_up_yours.gif
[Hide] (392.4KB, 1410x1080) >>97641
I have a million tricks I use to make GIFs smaller, and many are very laborious, so I don't always do all of them. I couldn't possibly cram all of them into one post.
One extremely important trick is to manually delete repeated animation frames (anime isn't typically animated at the full video framerate) because GIF handles repeated but very slightly different frames about as poorly as completely different frames. Related to this trick, you can manually delete what does not visually change between frames using an image editor such as GIMP. In the 1st image, you can see me working on an image I edited heavily to remove the repeated animation frames, as well as what does not change between frames. The 2nd image is the resulting GIF.
Another important trick is to output your finished GIF as several PNG frames at first and use a program called pngquant to dither them. This is where it gets messy, to output all your layers as separate images in GIMP, you have to output an ".ora" file. It's essentially just a .zip file full of PNGs in a data/ subdirectory, it will have your layers in reverse order, you can fix the order by clicking "Layer -> Stack -> Reverse layer order" in GIMP before outputting the .ora file. pngquant produces much higher quality dithered images than ffmpeg, GIMP, and any other program I know. I used to create palettes by hand, and pngquant is better than that too. If you make a GIF that pans a whole image like I did in the OP, run pngquant in the original image, not the panning frames. You can reduce the strength of the dithering with the --floyd argument, this will improve GIF compression and reduce visible dithering, but reduce color accuracy. You can then convert your dithered PNG images to GIF with ffmpeg.
Another important trick is to create a lossy GIF with gifsicle. You can assemble your GIF with gifsicle, or feed it an assembled GIF, it figures out the details, although if you assemble it with gifsicle you need to learn how to specify the frame timings with gifsicle. Read the manual. Once you output your (almost) final GIF, process it with gifsicle to sacrifice a little quality for smaller filesize. My 3rd and 4th images are the same screenshot before and after gifsicle, they look practically the same, but gifsicle made the image half the original size. The command used for creating the 4th image was this:
>gifsicle -o gifsicle-after.gif -O3 --lossy=40 gifsicle-before.gif
-o specifies the output file.
-O3 performs lossless optimization, gifsicle can losslessly improve GIFs too, although the gains are generally small.
--lossy=40 is where the lossy optimization happens. A bigger argument to --lossy makes the resulting image lower quality and smaller filesize, while a smaller argument to --lossy makes the resulting image higher quality but reduces the filesize less. You have to play with the exact value because some images can look good at very high --lossy values, while others look bad at the default of 20.
One less important trick that you can't use every time is called "restore to previous" or disposal method 3. GIF lets you specify what happens to a frame before playing the next. All the disposal methods are of interest, but there is one almost nobody knows which is "Restore to previous.". What this does is that before playing the next frame, it restores the canvas to the previous frame. It's useless most of the time, but in the OP image, when it finishes panning all the way to the right and begins to pan to the left, I could have used it to save 1 frame and make the image slightly smaller with no loss in quality by restoring the canvas to the frame it was going to pan to. I actually did this, but I forgot gifsicle has a bug that makes specifying "-O3" also remove this trick, so the resulting image doesn't have it. However, I already made several GIFs in which I use this trick, so here is one, it's my 5th file. Thanks to this trick, I do not need to redraw what was under Pai's hand between each frame in the image, restoring to the previous frame does it for me without wast