Files
StarPunk/docs/design/v2.21.1/2026-11-28-animated-gif-uploads.md
T
PhilandClaude Opus 5.5 18d667db74 fix: keep every frame of animated GIF uploads (v2.21.1)
optimize_image() re-saved animated GIFs without save_all=True, so Pillow
wrote only the first frame. Save all frames, and skip resized variants for
animated GIFs (they would be stills; feeds and syndication fall back to the
original).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 18:57:08 -07:00

1.3 KiB

v2.21.1: Animated GIF uploads stay animated

Why

https://starpunk.thesatelliteoflove.com/note/20261128164646 showed its GIF as a still image. The stored file had one frame, but still carried the loop extension and a 150 ms frame duration, so it had been animated when uploaded.

optimize_image() notices animated GIFs so it can skip resizing, then re-serialized them with img.save(output, format='GIF'). Without save_all=True Pillow writes only the current frame. The one test for this, test_gif_animation_preserved, used a single-frame GIF, so it couldn't catch it.

Changes

Area Change
media.optimize_image Animated GIFs are saved with save_all=True: every frame, per-frame durations and the loop count are kept
media.save_media Animated GIFs get no thumb/small/medium/large variants. Those would be stills of the first frame, and syndication sends the large variant when there is one. With no variants, feeds and syndication use the original, as they already do for pre-v1.4.0 media
Tests test_gif_animation_preserved uses a real 3-frame GIF with different durations; test_save_animated_gif_stays_animated checks the stored file and that no variants are made

Animated GIFs uploaded earlier are already stored as one frame and can't be recovered. Upload them again to fix them.