How Photo to Line Art Conversion Works (Step by Step)
A plain-language walkthrough of the photo to line art filter: greyscale, two blurs, local contrast, threshold and line weight, and what each one changes.
There is no AI model in this converter
It would be reasonable to assume a photo to line art converter runs a neural network. This one does not. It is classical image processing, the same family of filters that shipped in photo editors in the nineties, executed on a canvas in your browser. That choice is why the tool is instant, free, offline-friendly and private: there is no model to download and no server to send a photo to.
The trade-off is honest: a filter cannot understand what is in the picture. It cannot tell a collar from a shadow, or decide that a wire in the background is irrelevant. It finds local contrast and draws it. A generative model would make prettier decisions and make them differently every time; a filter makes the same decision every time, which is what you want when you are batch-processing a set of pages.
The seven passes, in order
1. Scale to a working size. The photo is drawn onto a canvas with its longest edge at 1500 pixels. This is a speed decision, not an aesthetic one: the filter touches every pixel several times, and a 12 megapixel photo would take long enough for the browser to feel frozen. 1500 pixels still prints sharply at A4.
2. Convert to greyscale, then stretch the contrast. Colour carries no useful line information here, so each pixel becomes a single brightness value using the standard luminance weights (roughly 30 percent red, 59 percent green, 11 percent blue). A gentle percentile stretch then maps the darkest one percent of the photo to black and the brightest one percent to white, so an underexposed indoor shot still has range to work with.
3. Blur the image twice, at two different strengths. One pass uses a narrow blur, the other a blur about 1.65 times wider. Both run as three box passes each, which is a fast approximation of a Gaussian.
4. Subtract the wide blur from the narrow one. This is the whole trick, and it is called a difference of Gaussians. Where detail is finer than the wide blur, the two blurs disagree and the difference is large. Where brightness changes slowly, a sky, a painted wall, a studio backdrop, both blurs see the same value and the difference collapses to zero. That is why smooth backgrounds come out pure white without anyone having to cut them out.
The subtraction has a second benefit: it is brightness-independent. A dark photo and a bright photo of the same scene produce the same strokes, because only the local difference survives, not the absolute value.
5. Normalise by the local contrast. The raw difference is divided by how much contrast there usually is around that spot. Fluent light and flat phone shots produce weak differences everywhere, and without this step nothing would reach the threshold. The divisor has a floor, so a genuinely empty area cannot be amplified into texture.
6. Threshold into ink, with a soft edge. The normalised value is compared against a threshold. Pixels above it are paper, pixels below it become ink, and the transition is a narrow ramp rather than a hard switch. That ramp is what gives anti-aliased strokes instead of the jagged one-pixel staircases that a binary edge map produces; it also means the drawing survives being scaled or printed.
7. Join the gaps, drop the specks. A stroke that is one pixel away from its neighbour is joined, so contours read as continuous rather than dotted. Isolated single pixels with no neighbours at all are removed, which is where sensor noise and JPEG artefacts used to show up.
Why the two sliders behave the way they do
Detail is the threshold, so it changes the drawing itself. On a portrait, going from high to low can take you from a hundred strokes of hair to a clean silhouette.
Line weight changes the size of the detail the filter measures and the width of the soft ramp at the same time. A heavier setting draws wider, calmer strokes and stops responding to the finest texture, which is why it is the right slider for printing on something absorbent, or for a subject with very fine detail you do not want drawn.
That asymmetry gives you a useful order of operations. Set Detail first, with line weight at its lowest, until the drawing has the lines you want and no more. Then raise line weight for the medium you are printing on. Doing it the other way round means changing thickness to compensate for detail you should have removed.
What the presets actually are
The four presets are not four different algorithms. They are four pairs of slider positions plus one flag. Ink outline sits at medium detail and medium weight. Fine pen raises detail and drops weight to the minimum. Bold marker lowers detail and thickens the stroke. Pencil sketch keeps a middle detail and draws the ink in grey with a little per-pixel variation so it looks less like a machine did it.
That is worth knowing because it means you are never locked in. Pick the preset closest to what you want and move the sliders; the presets are conveniences, not modes.
What it still cannot do
Be clear-eyed about the limits. There is no object recognition, so a busy background stays busy: a patterned sofa behind a sleeping cat will draw as tightly packed lines. Shadows with hard edges draw as lines, because a hard shadow edge is a real contrast edge. Fine hair at the working resolution turns into a texture rather than individual strands, and lowering Detail is the fix, not zooming.
The honest comparison is with the other kind of tool. Some converters redraw your photo with a generative model, which produces a confident, stylised sketch and can quietly change the face. This one traces the photo that you gave it, stroke for stroke, and will never invent a line that was not there.
Why nothing is uploaded
The conversion is a few hundred lines of JavaScript operating on an ImageData buffer. There is no backend because none is needed, which means the privacy claim on this site is architectural rather than a promise: there is no upload endpoint to trust. It also means the tool keeps working on a weak connection once the page has loaded, and that a photo under an NDA is no different from a photo of a cat.
For the practical side, how to turn a photo into a coloring page applies the same passes to a specific job. The converter itself is where any of it happens.
Frequently asked questions
Does this converter use AI?
No. It is classical image processing: a difference-of-Gaussians pass, a local contrast normalisation, a threshold and a soft-edge ink render, all running in your browser with plain JavaScript. No model is downloaded and no photo is sent anywhere.
What is the difference between Detail and Line weight?
Detail sets the threshold, so it decides which contrasts become ink. Line weight sets the size of the detail the filter looks at, so heavier settings draw wider strokes and skip the finest detail. If a drawing is too busy, Detail is the slider you want; if the lines feel thin or scratchy, Line weight is.
Why is my exported PNG not the full resolution of my photo?
The longest edge is scaled to 1500 pixels before conversion. That keeps the filter fast on phones and still prints sharply at A4 sketch size. It is not a limitation of the browser, it is a deliberate speed and quality trade-off.
Why does a plain background stay white?
Because the filter only draws local contrast. A sky, a painted wall or a studio backdrop changes brightness slowly across the frame, two blurs of different size see the same value there, and the difference is zero, so nothing is drawn. Slowly changing backgrounds disappear on their own.
Why is the result deterministic?
Because every decision is a fixed threshold rather than a learned model. The same photo and the same settings give the same drawing every time, which is what you need when you are processing a set of pages that should look consistent.
Can it tell what the objects in the picture are?
No. A filter sees brightness, not meaning, so a cluttered background still becomes cluttered lines and a patterned cushion is just pattern. Cropping before you start is more effective than any slider. Tools that redraw the picture with a generative model make that judgement for you; this one traces the photo you gave it.