Menu

Dithering made my GIF up to 50% bigger, and what to check first when a GIF will not shrink
📰

Dithering made my GIF up to 50% bigger, and what to check first when a GIF will not shrink

DEV Community: javascript·yue xing·14 days ago
#sMoIB2ch
#devtojavascript#devto#dev#dithering#colour
Reading 0:00
15s threshold

If a GIF refuses to get smaller, I would check the colour count and then whether dithering is switched on. Dithering sounds like a quality feature that should cost nothing, but on the animation I tested it made the file between 0.7% and 36.9% bigger in a browser tool and between 32% and 50% bigger in my own rebuild. I wanted to know why, so I counted what a GIF-style encoder actually writes.

Everything below comes from one sample, one laptop and one run per setting. The sample is MORPH.gif, 675×599, 10 frames, 3,003,893 bytes, by Kowloonese on Wikimedia Commons, CC BY-SA 3.0. I re-encoded it for the tests. It is a photo-like fade with text, and almost every pixel changes in every frame. Sizes are plain bytes. A screen recording with flat colour blocks may behave very differently, and I did not test one.

Check the palette size first

For the first set of numbers I used the animation workshop in ImgIng https://imging.ai/ in a desktop browser, exporting GIF with the colour count and dithering set by hand.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.