twemote

A Rust library and CLI that turns one high-resolution transparent PNG into Twitch-ready emote and badge sizes — trimmed, padded, fringe-free and validated.

Rustexperimentalimage processing · cli · twitchterminal softwaresource on github

Why

A generic resizer working on straight RGBA bleeds dark fringes into transparent edges, and platform size and weight rules end up scattered across scripts. This keeps both right in one place, deterministically.

How

Decode to RGBA, find the visible alpha bounds, trim, pad onto a square master, then resample each target size from that master in premultiplied floating point. A lossless PNG optimization pass follows, then validation against the preset and an atomic write. Presets cover standard emotes (112/56/28 px, ≤1 MB) and subscriber badges (72/36/18 px, ≤25 KB). JSON output and a dedicated exit code for validation failures; golden-image tests.

twemote build ./source/hello.png   # → dist/hello_{112,56,28}.png
$ git clone https://github.com/zombocoder/twemote
← all projects