Paint by Numbers Generator
NEW!

Paint by Numbers Generator

Turn any photo into a paint-by-numbers template. Segment an image into 2–64 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

2

PNG

3

WebP

4

or GIF).

5

The tool proposes a recommended number of colors — or pick a preset (2

6

4

7

8

8

16

9

32

10

64) or type any custom value from 2 to 64.

11

Toggle between the colored poster and the black-and-white numbered template

12

and turn region outlines on or off.

13

Download the result as a scalable SVG or a print-ready PNG

14

with a numbered color legend.

Features

Smart Color Recommendation

An elbow heuristic analyzes your image and suggests the color count that best captures its palette, so you get a good result before touching a slider.

Perceptual K-Means Segmentation

Colors are clustered in CIELAB space, so the palette is made of the most visually distinct colors possible — each one the true average of the pixels it represents.

Vector Outlines & Numbers

Region borders are traced as clean, watertight SVG paths and each area is numbered, producing a template you can print at any size without blur.

Two Output Modes

Export a posterized color image or a classic black-and-white paint-by-numbers sheet with a matching color legend.

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 to a server, never stored, and never seen by anyone but you. This matters for personal photos, family portraits, and any picture you would not want sitting in a stranger's upload folder.

Genuinely Disjoint, Averaged Colors

Instead of naively rounding colors, this generator runs k-means clustering seeded with k-means++ so the chosen colors are as separated as possible while each output color is the exact mean of the pixels assigned to it. Clustering happens in the perceptual CIELAB color space, which matches how the human eye judges color difference far better than raw RGB. The result is a palette that looks balanced and paintable rather than muddy.

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. Tiny specks are automatically merged into neighboring regions so you never end up with unpaintable one-pixel dots or numbers that do not fit.

Full Control From 2 to 64 Colors

A single click changes the color count anywhere from a bold two-tone poster to a richly detailed 64-color portrait. Outlines toggle on or off, and you can switch between the colored preview and the numbered sheet instantly without reprocessing. This lets you dial in exactly the difficulty and style you want, whether the template is for a child, a hobbyist, or a gallery piece.

How Photo-to-Paint-by-Numbers Conversion Works: Color Quantization Explained

A paint-by-numbers template turns a continuous-tone photograph — which may contain tens of thousands of distinct colors — into a small, fixed set of flat color regions, each labeled with a number that maps to a paint. Producing a good template is fundamentally a color quantization problem: choosing a limited palette that best represents the original image, then dividing the picture into paintable areas. This guide explains the algorithms behind the process and how to get the best results.

What Color Quantization Actually Does

Color quantization reduces the number of distinct colors in an image while keeping it recognizable. The naive approach — posterization — simply rounds each color channel to a few fixed levels. It is fast but produces harsh, arbitrary palettes because it ignores which colors actually appear in the picture. A far better approach is clustering: look at the colors that are genuinely present and group them into a handful of representative clusters. This tool uses k-means clustering, the workhorse algorithm for this task.

K-Means and Why Each Color Is an Average

K-means partitions all the image's pixels into k groups so that each pixel belongs to the cluster whose center is nearest to it. The center of each cluster — called the centroid — is the mean of every pixel assigned to it. That is why every color in the output palette is literally the average of the pixels it represents: it is the mathematically optimal single color to stand in for that whole group. The algorithm alternates two steps until it settles: assign each pixel to the nearest centroid, then recompute each centroid as the average of its members.

Getting Disjoint Colors With K-Means++

K-means is sensitive to where its clusters start. Poor initialization can leave two clusters chasing nearly the same color while an entire hue goes unrepresented. To avoid this, the tool seeds the clusters with k-means++, which picks starting colors that are spread far apart — each new seed is chosen with probability proportional to its squared distance from the seeds already picked. The practical effect is a palette of colors that are as disjoint as possible, so a portrait does not waste three of its colors on almost-identical skin tones.

Why CIELAB Instead of RGB

Distances in raw RGB do not match human perception: two colors that are numerically close in RGB can look very different, and vice versa. This generator converts colors to the CIELAB color space before clustering. In CIELAB, the straight-line distance between two colors approximates how different they look to the eye, so "the most distinct colors possible" genuinely means visually distinct. The centroids are averaged in CIELAB too, then converted back to RGB for display and painting.

From Colors to Paintable Regions

Once every pixel has a palette number, the image is split into connected regions — contiguous areas sharing the same color. Real photos produce a lot of tiny specks along edges and in noisy areas, which would be impossible to paint and would clutter the sheet with unreadable numbers. The tool performs region cleanup: any region below a minimum area is merged into the neighbor it shares the longest border with. The remaining regions are outlined by tracing the exact boundaries between differently colored pixels, producing watertight vector paths where neighboring regions share a single, gap-free line.

Placing the Numbers

Each region needs its number in a spot where it clearly sits inside the shape, even for curved or L-shaped areas where the geometric center could fall outside the region entirely. The generator computes a distance transform for every region and places the number at the "pole of inaccessibility" — the interior point farthest from any border. The size of each number scales with the space available, so large sky regions get bold numbers while small highlights get modest ones.

Choosing the Right Number of Colors

  • 2–4 colors produce bold, poster-like results and very easy templates — great for children or minimalist wall art.
  • 6–10 colors hit the sweet spot for most photographs: recognizable subjects with a manageable number of paints.
  • 12–18 colors capture portraits and landscapes with convincing shading and gradients.
  • 20–64 colors yield gallery-quality detail but demand patience and a large canvas so the smallest regions stay paintable. Very high counts work best with the vividness boost so the added colors stay distinct.

The recommended value is a good starting point derived from an elbow analysis of your specific image, but the best count depends on your patience, your canvas size, and how many paints you have. Because switching color counts is instant, it is worth trying two or three values and comparing the previews before you print.

Printing and Painting Tips

Download the numbered template as SVG whenever possible: because it is vector, it prints crisply at any size, from a postcard to a meter-wide canvas. Print the color legend on the same page so you can mix or buy the matching paints. When transferring to canvas, larger prints make the small numbered regions much easier to fill. If some regions feel too fiddly, reduce the color count by one or two and regenerate — fewer colors means larger, simpler regions.

Frequently Asked Questions

How does the tool choose the colors?

It runs k-means clustering on your image in the perceptual CIELAB color space, seeded with k-means++ so the colors come out as visually distinct as possible. Each palette color is the exact average (centroid) of all the pixels assigned to it, which is the mathematically optimal single color to represent that group of pixels.

Are my images uploaded to a server?

No. Decoding, color clustering, region tracing, and rendering all run locally in your browser using the Canvas API and a Web Worker. Your images are never transmitted over the network and are never stored anywhere. This makes the tool safe for personal photos, portraits, and any confidential picture.

What does the recommended number of colors mean?

The tool analyzes a downsampled copy of your image and uses an elbow heuristic to estimate the color count that best captures its palette — the point where adding more colors stops meaningfully improving the result. It is a suggested starting point; you can override it with a preset (2, 4, 8, 16, 32, 64) or any custom value from 2 to 64.

How many colors can I use?

Choose a preset (2, 4, 8, 16, 32, 64) or type any custom value from 2 to 64. Two colors produce a bold two-tone poster, mid-range values (6–16) suit most photographs, and higher values (up to 64) capture fine shading in portraits and landscapes at the cost of many small regions.

What is the difference between the colored and numbered modes?

The colored mode shows a posterized version of your image with each region filled in its palette color. The numbered mode is the classic paint-by-numbers sheet: white regions outlined in black, each labeled with a number that matches the color legend. You can switch between them instantly without reprocessing.

Can I remove the region outlines?

Yes. In colored mode an outline toggle turns the black region borders on or off, so you can view a clean posterized image or one with visible region divisions. The numbered template always shows outlines, since they define the areas you paint.

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 the template stays perfectly crisp at any print size — from A4 up to a wall-sized canvas. A PNG is a fixed-resolution raster that becomes blurry or pixelated when enlarged. Use SVG for printing and PNG when you need a quick raster image.

How does it avoid tiny, unpaintable regions?

After clustering, the tool finds all connected same-color regions and merges any region below a minimum size into the neighbor it shares the longest border with. This removes one-pixel specks and slivers, so every region on the final sheet is large enough to paint and to hold a legible number.

Does it work with transparent PNGs?

Yes. Fully transparent pixels are ignored during color clustering so they do not skew the palette. The visible subject is segmented normally. For the cleanest result with transparency, a subject on a plain background works best.

Why are colors clustered in CIELAB instead of RGB?

Distances in RGB do not match how the eye perceives color difference, so RGB clustering can pick colors that look similar while missing distinct hues. CIELAB is designed so that numerical distance approximates perceived difference, which produces a more balanced, visually distinct palette — exactly what a paint-by-numbers template needs.

How big can my image be?

There is no hard file limit, but very large images are automatically downsampled to a working resolution of about two megapixels for the segmentation step to keep processing fast and responsive. This has no visible effect on a paint-by-numbers template, which intentionally simplifies the image anyway.

Can I use this to make a custom paint-by-numbers kit?

Yes. Generate the numbered template, print it as SVG at your canvas size, and print the color legend to match or mix your paints. The legend lists each number alongside its exact hex color so you can reproduce the palette accurately.

Will the same image always produce the same template?

Yes. The clustering uses a fixed, seeded random sequence, so the same image with the same number of colors reproduces an identical palette and template every time. This makes results predictable and easy to recreate.

Learn more