I generated 60 illustrations for two books. Not one was printable.
I generated sixty illustrations for two books this week. Not one of them was printable, and the reason had nothing to do with how good they looked.
Image generators output at screen resolution. Google Flow was handing me 896 by 1200 pixels. On an 8.5 by 11 inch page that works out to 107 dots per inch. A printer wants 300. That is not a finishing detail, it is a factor of three that decides whether the book exists at all.
Upscaling does not work
The first instinct is to upscale. It is the wrong one.
Any upscale, Lanczos included, invents intermediate pixels between the ones it knows. On a photograph that passes, the eye forgives softness. On black lines over white, every contour becomes a mushy grey transition. On screen you see nothing. In print, every line looks shaky, and a coloring book is nothing but lines.
The right answer is not to enlarge, it is to retrace
Pure black linework is the ideal case for vectorisation. There is no gradient to interpret and no texture to preserve, just closed shapes, black, on white.
potrace takes the bitmap and returns Bézier curves. Once the illustration is described by curves rather than pixels, resolution stops being a constraint. It renders sharp at any size.
The full chain is four steps:
- Threshold to pure black and white
- Supersample by three, so the tracer sees smooth edges rather than a staircase of pixels
potraceto a vector PDF- Page at the exact trim size, with the margin
Measured result: 49 kilobytes per page, resolution independent, rendering at exactly 2550 by 3300 pixels at 300 DPI. Dragon scales, stonework joints, horns: all of it survives, and the line is crisper than the original.
One setting matters more than the rest. turdsize tells potrace to drop specks below a given size. On thick simple linework a value of 8 cleans up compression dust. On detailed linework the same value erases the scales. I ended up with two profiles, one per drawing style.
The real trap was not resolution
Once vectorisation was solved, I found the serious problem somewhere else.
Out of a batch of fourteen plates, three were unusable. Not badly drawn: the model had rendered a photograph of a coloring book lying on a desk. Curved page, drop shadow, dark background, sometimes a word printed on the page. Technically an image of a coloring book. Commercially, waste.
The failure mode is consistent, and it can be measured. I compared four indicators across the good plates and the failures:
| Measure | Valid plates | "Photo" renders |
|---|---|---|
| White outer border | 97 to 100% | 0% |
| Grey pixels | 1 to 3% | 70 to 77% |
| Colour spread | 0.1 | 4.4 to 5.3 |
The separation is clean. A few lines of automated checking catch every failure without ever rejecting a good plate, which matters when you are producing sixty of them.
Two calibration mistakes, and what they taught me
My first version used the white border as the primary test. It rejected a perfectly good illustration, purely because the drawing reached the edges of the frame. The border is not a reliable signal: a full bleed composition triggers it legitimately.
The real discriminator is grey. A photograph of an object has shadows everywhere. Line art has none.
Then I switched drawing styles, and the grey threshold started rejecting the entire batch. Detailed linework produces far more anti aliased edges than thick linework: 14 to 19 percent grey instead of 1 to 5, with no drop in quality. The genuine failures were still sitting at 70 and above, so the boundary still existed, it simply was not in the same place.
A threshold calibrated on one style does not transfer to another. Obvious written down, and it cost me two round trips.
Finally, looking at the assembled plates, I found a stray line running across a page. The generator sometimes draws a frame around the illustration, sometimes only one side of one. Vectorised as is, that becomes a bar across the printed page. Across the fifty two plates produced, twenty three had a frame. An automatic check now looks for an almost fully inked line inside a band along each edge, and crops just inside it. Pleasant side effect: the illustration fills the page better.
What I take from it
The creative part was never the bottleneck. Generating sixty decent illustrations took a handful of minutes and cost nothing.
What takes time is everything between an image and a printable object: resolution, quality control, stray frames, layout, embedded fonts, dimensions to the thousandth of an inch. None of it is glamorous, and it is exactly where the difference lies between a file that goes to the printer and a folder of images on a disk.
The full pipeline is four scripts. It generates, measures, sorts, vectorises and assembles. Every stage fails loudly rather than letting a bad page through, because an incomplete book in print costs infinitely more than a script that stops.
