hn.today

Making a 88x31 button book using ImageMagick

k.sosnierz.me3 points0 comments
Screenshot of Making a 88x31 button book using ImageMagick

This documents how to turn a plain-text book into an animated 88×31 “button” GIF using ImageMagick on a POSIX system. It argues that tiny, deeply constrained displays can still carry long works, so the project uses a tiny bitmap-like font (TomThumb, ~6×4 with spacing) because standard fonts need ~10 px height to be legible. Given an 88×31 canvas and that font, the layout fits five rows of 22 characters; text must therefore be pre-wrapped and cleaned. The write-up notes that GIFs have effectively no practical frame-count limit and that animation can run for hours, so the approach is feasible even for Moby-Dick.

The how-to covers the whole pipeline: obtain and trim a plain-text copy, collapse newlines and wrap to 22 columns using cat, tr and fold, sanitize multibyte characters with sed/grep, and optionally insert chapter breaks. Render frames by piping the wrapped text into ImageMagick’s convert with -page, -background, -font tom.ttf and -pointsize 6, then crop off extra margin (-crop 88x31+0+0), set frame delay (-set delay 600) and coalesce. A small Python helper centers lines by prefixing spaces. Examples include a first-chapter GIF and a full-book result (about 4.2 MB and roughly 19 hours long).

Read on k.sosnierz.me0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Web

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.