← back

Generative cover images for every post

Every blog post shared on social media needs an image. Without one, the platform picks something arbitrary — usually nothing good. The standard fix is og:image: a 1200×630 image in the post’s front matter that Twitter, LinkedIn, and iMessage use for the preview card.

I needed images for thirty-odd posts. The obvious route — Midjourney, Flux, DALL·E — felt wrong for this. AI image generators produce work that looks like AI image generators. Everything comes out with the same aesthetic fingerprint. Worse, the images bear no relationship to the post itself; they are decorative noise.

What I actually wanted was closer to what Sol LeWitt described as a wall drawing: a rule, applied consistently, that produces something distinct each time. Mathematical art fits this exactly. The image is not chosen or generated by taste — it follows from the input. Same post, same image, always.

There are several families of patterns that work well at this scale: flow fields (particles traced through a vector field), Truchet tiles (quarter-circle arcs on a grid), string art (straight lines connecting points around circles), Lissajous curves (parametric loops whose shape changes with two integer ratios). Each family is distinct. Each produces images that look designed rather than generated. And crucially, none of them require an API call, a GPU, or a model.

How it works on this blog

A Node.js script takes a post’s slug, hashes it to a seed, and uses that seed to deterministically pick a pattern family, a color palette, and all the parameters within. Same slug, same image, always. The rake np task that creates new posts now runs the script automatically — new post, new image, no manual step.

The images live in assets/images/posts/ as SVGs and are referenced in front matter. jekyll-seo-tag picks up the image: field and emits the right OG tags.

The cover you see at the top of this post is string art — points distributed around two circles, connected by straight lines skipping a fixed interval. The resulting curves look hand-drawn and mathematical at once. Every post on this blog has one, and no two are alike.