How I gave every pen sketch the same ink colour with inkmap

Eight generated pen sketches for webdesignvernon had ink hues from 227 to 235 degrees and darkness that spread 38 points on a 0 to 255 scale. A 176-line Rust tool, inkmap, put all eight at hue 211 and a 2.2 spread.

By Mackenzie Bowes · mackenzie@mackenziebowes.com · @_mackenziebowes on X

Contents

If you generate pen sketches with an image model, no two come out the same ink. Ours came out as eight royal-blue drawings in eight different blues and darknesses, and a page with two of them on it looked unfinished. This is how we made them one colour with a 176-line Rust tool, the numbers we measured on all eight, and where the tool stops.

How different were the sketches?

We measured the ink of each raw generated scene: the average colour of its darkest 3% of pixels. The eight are the raw PNGs the model returned for our scene series.

SceneInk hue (degrees)Ink lightness (0 to 255)
pilot-lake-2k23549.7
orchard23054.0
main-street22752.3
vineyard23087.7
contact bench22958.3
examples market22770.1
examples shops23455.9
examples ladder22763.4

The hue ranged from 227 to 235 degrees, all royal blue. The lightness ranged from 49.7 to 87.7, a spread of 38.0. The vineyard's ink is almost twice as light as the lake's. Put two of these on one page and the paler pen reads as a different pen.

Why not a colour lookup table?

The ticket named lutgen-rs, an MIT-licensed Rust tool that applies a colour palette to an image.[1] We chose to write our own. A palette maps one set of colours to another, and our problem was two things at once: the hue was off, and the pale pens were pale. We expected a palette lookup to fix the hue and leave the darkness alone.

How does inkmap work?

It treats each picture as paper plus ink. The paper is the colour of its lightest pixels. The ink level is the lightness of its darkest 3% of pixels. Every pixel becomes a coverage from 0 (paper) to 1 (full ink), and is painted as that much of the chosen ink on the chosen paper. A pale sketch and a dark one land on the same colour and each keeps its own line weight. The mapping is a 256-entry table per picture.[2]

A transparent cutout, a drawing stored in the alpha channel, keeps its alpha and takes the ink colour. The command takes --ink, --paper and --out. The house ink for webdesignvernon is #6786A8 for scenes and #4C74A0 for note objects, set by Pennant on 2026-10-27.[2]

Did it work?

We ran inkmap on the same eight pictures and measured the results the same way.

Hue range (degrees)Lightness spread (0 to 255)
Before227 to 23538.0
After211 to 2112.2

All eight ended at hue 211, lightness between 131.8 and 134.0. The metric uses the same luminance weighting as the tool, so this checks that inkmap did what it was written to do. It does not say the result looks right; for that, look at the pictures.

What does it cost?

inkmap writes the format it reads. PNG in gives PNG out, and WebP in gives lossless WebP out, which is large: a 187 KB WebP came back at 1.55 MB. The scenes on the live site are JPEG files of 296 KB and 314 KB. The re-encode that got them there was a manual step outside the repository, and nothing records how it was done. The README says to re-encode WebP with cwebp or magick before it goes on a site. A lossy output option in inkmap itself would remove that step. It is the next thing to build.

inkmap has one commit, from 2026-10-27, and has so far been used on two of the site's scenes, both committed on 2026-10-27 with inkmap named in the commit message.[2][4]

What can you take from this?

  1. Measure the ink before you choose a tool. Hue and darkness were off by different amounts, and darkness moved more.
  2. Fix the sketch after generation. Repainting is cheaper than prompting until the model draws the same pen twice.
  3. Run it. Install it with cargo install --git https://github.com/mackenziebowes/inkmap --tag v0.1.0.[3] inkmap --ink '#6786A8' --out DIR picture.png writes the repainted copy to DIR. It reads JPEG, PNG and WebP.

If you generate illustrations and want one consistent look, I'd like to compare notes: mackenzie@mackenziebowes.com or @_mackenziebowes.

Sources

  1. lutgen-rs, ozwaldorf, MIT licence. github.com/ozwaldorf/lutgen-rs
  2. inkmap, MIT licence, Mackenzie Bowes, built 2026-10-27. github.com/mackenziebowes/inkmap
  3. inkmap v0.1.0, published 2026-10-28T02:03Z (2026-10-27 19:03 Pacific). github.com/mackenziebowes/inkmap/releases/tag/v0.1.0
  4. webdesignvernon repository, commits 89deee0 and 4c3316f, 2026-10-27. webdesignvernon.com