How a photo becomes pen lines

Three things happen between a photo and a plot: tone becomes marks, marks follow the picture's structure, and the marks get ordered so the pen wastes no time in the air. The four visualisations below show them live. Move the sliders.

1. Error diffusion decides where the dots go

A photo has 256 greys; a pen has one. Error diffusion walks the pixels in order, rounds each one to ink or paper, and hands the rounding error to the neighbours it has not visited yet. The mistake on one pixel is paid back on the next, so the average over any small patch matches the photo. Watch the error, shown in pink, flow right and down as the scan advances. The weights here are Floyd–Steinberg dithering, the classic kernel.

2. Three ways to fake grey with black

Ordered dithering compares each pixel with a fixed tile of thresholds, so the pattern is crisp but you can see the tile. Blue noise uses a tile designed to have no low-frequency structure, so the grain is even and fades at a distance. Error diffusion has no tile at all; it earns its smoothness by carrying the error forward, and pays with the occasional worm. Same gradient, same number of dots. Try each on a photo: Bayer 8×8, blue noise dithering and Floyd–Steinberg.

3. Structure tensors turn edges into a flow

Every pixel has a gradient, the direction brightness changes fastest. Averaging the gradients over a neighbourhood gives a structure tensor, whose minor axis points along the edges rather than across them. Lines that follow that direction look like an artist drew them, because that is what artists do: hatch along the form. Here particles ride the field of a lion's face; the darker the pixel, the more particles are released there. The Flow style traces evenly spaced lines through this kind of field to make flow field art from a photo.

4. Sorting the paths halves the plot

A drawing is a bag of strokes. Drawn in the order they were generated, the pen spends most of its time flying between them. A nearest-neighbour sort, refined by 2-opt swaps, cuts that pen-up travel by 50 to 90 percent. Pink is the pen in the air. Toggle the sort and watch the total travel change. Plotcaster sorts paths this way by default before export; the pen plotter guide covers the other export steps.

Try it on a photo Read the guides