live

Stickerloom

Telegram bot that turns pictures, GIFs and video into video stickers.

Open Telegram Open GitHub

Telegram accepts exactly one shape for a video sticker: WebM with VP9, 512 pixels on the long side, at most three seconds and 256 KB. Stickerloom takes a picture, a GIF or a short video and returns a file in that shape. A still picture becomes a one second clip, so static art can sit in a video pack next to real animations.

Most of the work is fitting the size limit without ruining the source. Dense inputs are re-encoded at a rising CRF and, once that is spent, at a lower frame rate. Pixel art is scaled with nearest neighbour so its edges survive. Animated WebP is expanded through Pillow because ffmpeg cannot decode it. A link is fetched like a file, but one that resolves to a private address is refused, so a user cannot point the bot at the network it runs in.

The bot also builds and imports sticker packs and backs a pack up to a zip that it can restore. Telegram holds the only copy of a pack, so the zip is the copy that is yours. A user is in exactly one state at a time, held in a single column, and every user-facing string lives in locale files.