A plain photo of me didn't fit this site. Everything on the desk looks printed or made, and a phone photo has its own lighting and colour, so it looked pasted on. I wanted two portraits that look printed: a two-colour riso and copper dots on a circuit board. I could have used a filter app, but I wanted to know what actually happens to the pixels. So I wrote it. All the code is in portrait-filters on my GitHub.

Original cutout, riso print and copper halftoneOriginal cutout, riso print and copper halftone

1- What does the computer actually see?

Three numbers per pixel: red, green and blue, each from 0 to 1. Print doesn't care about colour, only about how much ink goes where, so the first step is collapsing those three numbers into one brightness value (luma):

How a photo becomes a riso print data table
ChannelWeightWhy
Red0.2126Mid sensitivity
Green0.7152Our eyes are most sensitive to green
Blue0.0722We barely read blue as brightness

That is a dot product per pixel: a kernel that is one pixel wide but three channels deep. Averaging the three equally makes skin look flat, which is why the weights aren't 1/3.

2- What is a kernel?

A small grid of weights you slide over the image. At every pixel you multiply the neighbours by the weights and add them up. That's a convolution. Change the weights and you change what survives:

How a photo becomes a riso print data table
KernelWeights (3×3)SumEffect
Gaussian blur1 2 1 / 2 4 2 / 1 2 1, ÷161Averages neighbours, detail fades
Sharpen0 −1 0 / −1 5 −1 / 0 −1 01Exaggerates pixels that differ from their neighbours
Edge−1 −1 −1 / −1 8 −1 / −1 −1 −10Flat areas go to 0, only edges survive

The sum is the rule of thumb: weights that add to 1 keep the overall brightness, weights that add to 0 throw it away and keep only change.

Luma, blur, sharpen and edge kernels on the same photoLuma, blur, sharpen and edge kernels on the same photo

Before printing, I sharpen with an unsharp mask: blur the image, subtract the blur from the original (what's left is the detail), and add that detail back on top. Hair and glasses survive the next step much better.

3- How does the riso version work?

A risograph prints one flat ink per pass, so there is no grey: each spot gets ink or it doesn't. I split the image with two thresholds. Shadows go to the dark green ink, and everything below the highlights goes to the orange ink.

A hard threshold would look like a stencil, so each layer is dithered with a 4×4 Bayer matrix. It is a tile of 16 thresholds arranged so neighbours are as different as possible, which turns a smooth grey into an even dot pattern:

BAYER4 = np.array([[ 0,  8,  2, 10],
                   [12,  4, 14,  6],
                   [ 3, 11,  1,  9],
                   [15,  7, 13,  5]]) / 16

t = tile(BAYER4, gray.shape)
dark  = gray < 0.35 + 0.3 * (t - 0.5)   # green layer
light = gray < 0.75 + 0.4 * (t - 0.5)   # orange layer

Two details sell the effect. The orange layer is shifted 3 pixels right and 2 down, because real riso drums never line up perfectly. And the inks combine by multiplying (paper × orange × green), which is how translucent ink actually behaves on paper.

4- How does the copper version work?

The image is cut into 9×9 squares, and each square becomes one copper dot on a dark board. A brighter square gets a bigger dot.

The interesting decision is how big. A dot's area grows with the radius squared, so the tone-accurate choice is radius = √brightness. I tried that and the face went flat. A radius that grows roughly linearly shrinks the mid-tone dots, which reads as more contrast, so I broke the rule on purpose. The repo has both (area_correct=True).

The copper version also uses histogram equalisation (spread the tones so every brightness is used equally often) and a very wide unsharp mask for local contrast. Without them, the eyes and glasses disappear into the dots.

Try it on your own photo

git clone https://github.com/JplepeckiBR/portrait-filters
cd portrait-filters && pip install -r requirements.txt
python -m portrait_filters riso   my_photo.png riso.png
python -m portrait_filters copper my_photo.png copper.png

A transparent PNG with the background removed gives the cleanest result. The convolve function in kernels.py is a plain loop on purpose, so you can see exactly what a convolution does before reaching for a library.

What's next

These filters run on a laptop. The color analysis device I'm planning needs the same first steps (RGB to something meaningful, kernels to clean it up) running on a camera board, which is a much tighter budget.