Paint by Numbers Generator

Paint by Numbers Generator

Turn any photo into a paint-by-numbers template. Segment an image into 2–255 colors with region outlines and numbers — free and private.

Photo to Art

Upload an image

Drag an image here or click to select

JPG, PNG, WebP or GIF — everything is processed in your browser

Or try an example:

All processing happens locally in your browser. Your image never leaves your device.

Keywords

paint by numbers generatorimage to paint by numberscolor segmentation toolposterize imagereduce image colorscolor quantizationcustom paint by numbers from photo

Need something else?

How to use

1

Drop or select an image (JPG, PNG, WebP, or GIF). The page scrolls straight to your photo once it loads.

2

Work in the column beside the sheet: keep the starting color count, pick a preset (2, 4, 8, 16, 32, 64), or type your own. Detail, smoothing, focus and the “Merge similar colors” slider all redraw the preview while the sheet stays in view.

3

Switch between the colored poster and the numbered black-and-white sheet. Zoom in to inspect the small regions and drag the sheet to move around, then press Fit to see the whole page again.

4

Choose your download size — exact pixels, or paper size and DPI. The notice above the sheet reports how many regions need a leader line at that size, and “Show these regions” outlines exactly those regions so you can see where they fall.

5

Download the result as a scalable SVG or a print-ready PNG, with a numbered color legend.

Features

Every Region Gets a Number

A region big enough holds its number inside. Anything too small gets a leader line instead — the number sits just outside on a thin line pointing back at it — so nothing on the sheet is left unlabeled.

See Which Regions Need a Leader Line

A toggle beside the count outlines exactly those regions on screen, in a highlight color you choose, so you can tell whether they land on a face or scatter through the background. The highlight is a screen aid: it never appears in the SVG or PNG you download.

Curved Outlines, Not Staircases

Borders are collected along the pixel lattice, simplified, then rounded into quadratic Bézier curves wherever a vertex is a shallow zig-zag rather than a real corner — so a shoulder reads as a drawn line, not a flight of steps.

Perceptual K-Means With a Separation Floor

Colors are clustered in CIELAB, and two palette entries that land closer together than your “Merge similar colors” value can be collapsed so the freed slot goes to a distinct color the palette was leaving out.

Editors Beside the Sheet, With Zoom

The controls sit in their own column and the sheet stays in view while you scroll them. The viewer zooms in and out, drags to pan, and returns to the whole page with Fit. On a phone the columns stack, sheet first.

Why Choose This Tool?

Your Photos Never Leave Your Device

Every step — decoding, color clustering, region tracing, and rendering — runs entirely in your browser using the Canvas API and Web Workers. Your images are never uploaded, never stored, and never seen by anyone but you. That matters for family portraits and any picture you would not want sitting in a stranger's upload folder.

Nothing on the Sheet Is Left Unnumbered

Every region carries a number: one that fits sits inside the shape, one that does not gets a leader line pointing at it from just outside. That count is reported in physical print units, so it genuinely differs between A5 and A3 — a printed digit has a millimetre height, not a pixel height. A toggle outlines exactly those regions on screen so you can decide whether to print larger, merge them away in one click, or leave them; the highlight never reaches your download.

A Palette That Spends Less of Itself on Near-Identical Browns

When two palette colors sit closer together than the “Merge similar colors” value and the photo holds a distinct color the palette missed, that pair collapses into its area-weighted blend and the freed slot is re-seeded on the color that was missing. On three real portraits this recovered a blue that was absent entirely and a lip red that had never been paintable. It is a trade, not a free win: on a photo dominated by one hue you can gain the missing feature and still end up with a worse mean color error overall. Set the control to Off to keep the palette exactly as k-means measured it.

Print-Ready Scalable Output

The numbered template is exported as pure vector SVG: outlines are real paths and numbers are real text, so you can scale the sheet to A4, A3, or a wall-sized canvas with perfectly crisp edges. A region left with no paintable interior is absorbed into its closest neighbour in color, so you never get one-pixel dots. And because the sheet knows the size you are printing at, it tells you beforehand how many numbers will need a leader line there.

How Photo-to-Paint-by-Numbers Conversion Works: Quantization, Regions and Numbering

A paint-by-numbers template turns a continuous-tone photograph into flat color regions, each labeled with a number that maps to a paint: a limited palette, areas big enough to paint, a legible number on every one. Here is what this tool actually does at each stage.

K-Means in CIELAB, Seeded With K-Means++

K-means partitions the pixels into k groups, each joining the cluster whose center is nearest; that center is the mean of its members, which is why every palette color is the average of the pixels it stands for. Seeding uses k-means++ — each new seed picked with probability proportional to its squared distance from those already chosen — so two clusters do not chase one color while a whole hue goes unrepresented. All of it runs in CIELAB, where distance approximates perceived difference.

Keeping Palette Colors Apart — and What It Costs

K-means alone still spends slots where the pixels are, not where the interest is: skin dominates a portrait, so a dozen entries can land in browns while a lip red never wins one. The tool therefore enforces a minimum perceptual separation, using the same threshold as the “Merge similar colors” control. Over three rounds it looks for the closest pair of centroids nearer than that threshold, and for a bin of the image's own colors further than the threshold from every centroid. When both exist, the pair collapses into its area-weighted mean — the color you would get mixing the two paints in proportion to the canvas each covers — and the freed centroid is re-seeded on the best-scoring candidate bin, scored by area times distance to its nearest centroid.

This is a deliberate trade, not a universal improvement. On a photograph that really is all one hue, or whose palette is already well spread, one side of the trade is unavailable and the centroids are left exactly as k-means produced them. When it does fire, you gain a color that was absent and pay in overall fidelity: measured on three real portraits, one gained a missing blue and a second lip red and improved overall, one improved slightly, and one made its lips paintable while its mean color error got worse. Set the control to Off to keep the palette k-means measured.

From Colors to Paintable Regions

Once every pixel carries a palette number the image splits into connected regions of the same number, and two passes clean that up. The first asks whether two neighbours are really one color to someone holding a brush: it walks adjacent pairs in order of how close they are in CIELAB, merges any pair within the threshold into their area-weighted blend, and repeats — merging changes the survivor's color, which can bring a third neighbour into range. That is what stops a face breaking into a mosaic of slivers, and it runs first so everything downstream sees fewer, less thin regions. The second pass absorbs any region left with no paintable interior into its closest neighbour in color.

Outlines: Boundary Edges, Then Curves

Outlines here are not produced by edge detection. Every unit edge of the pixel lattice where the two adjacent regions differ is collected as a boundary edge, and those edges are stitched into closed rings — which is why neighbours share one gap-free line rather than two nearly-coincident ones. Each shared run of boundary is simplified once with the Ramer–Douglas–Peucker algorithm, at the tolerance your “Smooth edges” setting picks, then shared verbatim by both regions bordering it. That still leaves the zig-zag a pixel grid makes of a curve, so a final pass judges each remaining vertex by how sharply the outline turns across a short window either side of it: more than 30° is a real corner, kept exactly; less is tolerance residue on a smooth edge, rounded into a quadratic Bézier curve anchored on the midpoints of its neighbouring edges. That is what makes a shoulder read as a drawn line, not a staircase.

Placing the Numbers, and Why Some Need a Leader Line

Each number has to sit clearly inside its region, even for a curved or L-shaped area whose geometric center falls outside it. The tool computes a distance transform per region and places the number at the "pole of inaccessibility" — the interior point farthest from any border. The distance there is the region's inscribed radius. Whether a number fits is only meaningful relative to the size you print: a digit of your chosen millimetre height occupies (mm ÷ 25.4) × DPI pixels on the sheet, and dividing by the output pixels per segmentation pixel converts that into the radius's own units. Any region below half that gets a leader line — sixteen directions are sampled from its label point, the one leaving the region fastest wins, and the number sits just beyond the exit with a line drawn back in. Because the requirement is anchored to a physical millimetre, the same photograph genuinely needs more leader lines on A5 than on A3.

When a Photo Is Too Much Work

All of this runs in your browser, and a segmentation ceiling protects the tab from a run that would never finish. High-detail photographs — sand, fur, foliage — used to cross it; the color-merging stage is where such a run spends nearly all its time, and it is now dramatically cheaper, so a photo that took over a minute in Firefox and gave up finishes in a few seconds. The ceiling has not gone away, because some photograph will always be too much work. What changed is that hitting it now names the two settings that measurably reduce the work — fewer colors, and a higher “Merge similar colors” value — instead of leaving an empty panel.

Related tools on the same colour engine

To see the exact palette this generator would pick — in HEX, RGB and HSL, with each colour's share of the picture — run the photo through the colour palette generator first; it is handy for matching paints or printing a swatch card next to the canvas. And if what you actually want is the filled, coloured vector of a logo or flat illustration rather than a numbered template, the image to SVG converter shares this tool's region tracing but keeps the fills.

Frequently Asked Questions

How does the tool choose the colors?

It runs k-means clustering in the perceptual CIELAB color space, seeded with k-means++ so the colors come out as visually distinct as possible, and each palette color is the average of the pixels assigned to it. A separation pass can then collapse two palette colors closer than your “Merge similar colors” value, re-seeding the freed slot on a distinct color the palette was leaving out.

What is a leader line, and why does the count change between A5 and A3?

A leader line is what a region gets when its number will not fit inside it: the number sits just outside, with a thin line pointing back in. Whether a digit fits depends on the size you print, because a printed digit has a millimetre height — so the same photo genuinely needs more leader lines on A5 than on A3. DPI alone does not move the count.

Will the region highlight appear in my download?

No. “Show these regions” outlines exactly the regions that need a leader line, in the highlight color you pick (red by default), so you can see where they fall before committing to a print size. The downloaded SVG and PNG contain no highlight at all.

Does “Merge similar colors” make the colors more accurate?

Not universally — it is a trade. It moves palette capacity off near-duplicate colors and onto a distinct color the palette was missing, which is how a portrait gains a lip red or a blue that was absent entirely. Measured on three real portraits, two came out better overall and one came out worse on average while gaining paintable lips. Set the control to Off to keep the palette k-means measured.

Does the tool detect faces automatically?

It offers, it never switches. When it is confident your photo contains a face, an “Apply Faces focus” button appears beside the Focus control; clicking it concentrates detail on the face rather than spreading it evenly. The detector is deliberately conservative and misses a lot — roughly two faces in three at the resolution it runs — so treat it as a shortcut when it appears, and set Focus by hand when it does not.

What happens if my photo is too detailed to finish?

A segmentation ceiling stops a run hanging your tab, and some photograph will always be too much work for it. When a run crosses the ceiling the tool says so and names the two settings that measurably reduce the work: fewer colors, and a higher “Merge similar colors” value — both shrink the color-merging stage, where such a run spends nearly all its time.

Are my images uploaded to a server?

No. Decoding, clustering, tracing, and rendering all run locally in your browser using the Canvas API and a Web Worker. Your images are never transmitted and never stored, which makes the tool safe for personal photos and portraits.

How many colors should I use?

The tool starts at 24, the floor its own testing settled on for faces — below that, skin flattens into a single tone. Change it with a preset (2, 4, 8, 16, 32, 64) or by typing your own: two colors give a bold two-tone poster, 6–16 suits most photographs, and higher values capture fine shading at the cost of many small regions.

Why is the SVG download better than PNG for printing?

The numbered SVG is pure vector: outlines are real paths and numbers are real text, so it stays crisp at any print size, from A4 to a wall-sized canvas. A PNG is a fixed-resolution raster that blurs when enlarged. Use SVG for printing and PNG for a quick raster image.

How does it avoid tiny, unpaintable regions?

Two passes. First, neighbouring regions the eye reads as one color are merged, which keeps a face from breaking into a mosaic of slivers. Then any region with no paintable interior is absorbed into its closest neighbour in color. Small regions that survive are not dropped — they keep their number on a leader line, and you can merge them away from the notice above the sheet.

How big can my image be, and will the same photo always give the same sheet?

There is no hard file limit; very large images are downsampled to about two megapixels for segmentation, which has no visible effect on a template that simplifies the image anyway. Every stage is deterministic, so the same photo and settings reproduce an identical sheet in the same browser. Across browsers it can differ slightly, because each engine decodes and resizes the photo a little differently first.

How do I see the palette the generator picked, in HEX, before painting?

Run the same photo through the colour palette generator in this category: it uses the identical CIELAB clustering engine, lists every colour with HEX/RGB/HSL and its share of the picture, and exports the list so you can match paints or print a swatch card alongside your canvas.

Related Articles

Learn more