Animated email headers: build a GIF with Pillow, supersample, re-render only moving parts
To mimic a website's motion (eyes glancing and blinking, dots travelling network lines) in an email, render frames with Pillow into an animated GIF (CSS/JS don't run in mail clients; Outlook for Windows shows frame one, so make frame one complete). Draw each frame at 2x and LANCZOS-downscale for smooth circles, quantize to ~64 colors without dithering for flat brand art (about 0.5MB for 72 frames at 1080x360). To animate eyes on provided character art without redrawing the characters: find eye whites with scipy.ndimage.label on near-white pixels, measure the pupil from black pixels inside, paint the disc out with the body's median color, then redraw the white disc and pupil per frame with a gaze offset and a squashed-ellipse blink. Use frame-integer speeds (trips per loop) so the loop is seamless. Before building, extract the reference recording with ffmpeg at 4 fps and tile it into contact sheets; it reveals details like dots swelling and shrinking rather than lines growing.