Guide
Turning a picture into a stencil: threshold, smooth outlines, specks and bridges
A stencil is a picture reduced to two tones: material that is cut away and material that stays. The conversion from a photo or logo is simple in principle but easy to do badly, with ragged outlines, pixel stairs and tiny specks that a cutter would trace. This tool does the conversion in your browser, shows the result as you adjust it and exports a vector file in millimetres for vinyl cutters, laser cutters and plotters, or a PNG for printing.
From picture to two tones
The picture is scaled to at most 700 pixels on its longest side and each pixel is converted to a grey level with the usual luminance weights, 0.299 red, 0.587 green and 0.114 blue, with transparent areas counted as white. A box blur of the radius you choose smooths noise. The threshold comes from Otsu’s method, which picks the level that best separates the dark and light parts of the histogram, shifted by your offset. Pixels darker than the level are the parts that are cut out.
Smooth outlines
Instead of tracing the edges of the pixels, which gives staircases, the tool traces contours with marching squares and linear interpolation: where an edge crosses the threshold between two pixels, the outline passes through a point proportional to the grey values. Each outline is then simplified with the Douglas-Peucker method at 0.35 pixel, which removes nodes that lie on a straight line and keeps the shape. The result is a smooth path with few nodes, written with fill-rule evenodd so that holes in a shape stay open.
The settings
Width sets the size of the cut-out in millimetres and the height follows the proportions of the picture. Threshold changes how much becomes cut-out. Smoothing blurs more for rounder shapes and fewer stray points. Ignore specks drops outlines smaller than a number of pixels, which cleans photos. Swap black and white inverts the result, which is useful when your picture is light on dark. Add a 5 mm border draws a frame around the stencil so that it has a margin to hold.
A worked example
The sample draws a five-pointed star, a thick ring and the word OPEN in a heavy font on a 600 × 420 pixel canvas. At 100 mm wide the stencil is 100 × 70 mm. The tool finds nine outlines: the star, the outside and the hole of the ring, the O and its hole, the P and its hole, the E and the N. About 23% of the preview is black. The O and P holes and the ring’s centre are islands that would drop out of a real stencil.
Islands and bridges
Real stencils need bridges: narrow strips that attach the island to the rest. Stencil fonts have them built in. Otherwise draw the bridges across each island in your cutter software, or edit the picture to add white lines across the dark shapes before you convert it. Keep bridges wider than the width of your blade or beam, and leave enough material at thin features so that the stencil does not tear.
Limits
The tool makes a two-tone outline, not a halftone or a multi-colour separation, and does not add bridges. Photos need good contrast, and a busy background will give a messy result. Scaling is by width only, so check the size on your machine, and thin details can be lost at small sizes. Everything is done in your browser and the picture never leaves your device.
Related tools
- Image Converter changes the format of a picture before you trace it.
- SVG to PNG Converter turns the stencil into a raster image at any size.
- Laser Cutter Finger-Joint Box Generator makes a box to decorate with the stencil.
- Box Template Generator makes a folding box that a stencil can decorate.
Checked against the current version of the Stencil Maker on .

