Fitting animated stickers under 512 KB in the browser with Rust and WebAssembly
rust
dev.to
Discord's custom asset limits are notoriously tight: 320×320 px under 512 KB (APNG or PNG) for stickers, and 128×128 px under 256 KB (PNG or GIF) for emojis. Standard image compressors usually fail here for two reasons: They optimize for visual quality, not a hard byte ceiling. Running oxipng or gifsicle once might shrink a 1.8 MB animation to 720 KB—still rejected on upload. APNG and GIF have completely different compression bottlenecks. An APNG stores full 32-bit RGBA frames unless you qu