BMP to SVG: Palette-Accurate Vector Tracing

A palette BMP already knows its colours: the file carries a table, and every pixel is an index into it. This page reads that table before it traces anything, so a 16-colour bitmap comes out as an SVG with those same 16 fills — not sixteen colours invented by a quantiser. Decoded and traced in the tab, never uploaded.

1 / 4 / 8 / 16 / 24 / 32 bppExact paletteBlack & white modeNo upload

1. Drop a BMP

parsed in this tab
Drop a .bmp here
or
No file loaded yet — drop a BMP, or start from the sample.

2. Tracing

applies on change
Mode
Detail7
Smoothing6
Clean up
Decimalspath precision

3. Preview & export

—
Load a BMP to trace it
One <path> per colour, fill-rule="evenodd" so that holes stay holes.

A BMP is the most transparent image format there is: a 14 byte file header, a device independent header, an optional colour table, then the pixels. Because that table is in the file, a BMP to SVG conversion can be exact about colour — the tracer does not have to guess a palette, it can read the one the image was authored with, which is what a screen printer, an embroiderer or a vinyl shop means by "the same red".

What is actually inside a BMP

Five parts, and each one explains a quirk you may have hit elsewhere:

PartSizeWhat it holds
File header14 bytesThe letters BM, the file size and the offset where pixel data starts
Info header40 to 124 bytesWidth, height, bit depth, compression, palette count. Version 4 and 5 add colour space and alpha masks
Colour table0 to 1024 bytesUp to 256 entries of B, G, R, reserved. Present only at 1, 4, 8 bpp and sometimes 16 and 24
Pixel arrayrow paddedIndex values or colour triples, every row padded to a 4 byte boundary
Row order—Bottom-up when the height is positive, top-down when it is negative. Reading it the other way up is the classic "my BMP is mirrored" bug

The 4 byte row padding is worth knowing about because it is not in the pixel count: a 100 pixel wide 24 bit BMP uses 300 bytes of colour and 300 is already a multiple of four, but a 101 pixel wide one uses 303 bytes plus one byte of padding per row. Every reader that gets this wrong produces a diagonal smear, and every file that gets it wrong is 1 byte per row larger than expected.

Bit depth decides how good the trace can be

DepthColours in the fileWhat tracing gives you
1 bpp2Perfect for line art and faxes: two colours, clean edges, the smallest SVG this page can produce
4 bppUp to 16Exactly 16 fills, no approximation at all — this is the ideal input for screen printing separations
8 bppUp to 256Exact up to 64 entries, then reduced; the usual input for indexed GIF era artwork and old clip art
16 bpp32K or bitfieldsThe 5-5-5 default and custom BI_BITFIELDS masks are both read; expect banding on gradients
24 bpp16.7MTrue colour with no palette, so quantisation is needed: choose 8 to 16 colours for flat art
32 bpp16.7M + alphaAlpha is kept when the file actually uses it, so transparent areas stay transparent in the SVG

Exact palette, reduce, or black and white

Three modes, and the choice matters more than any slider on the page:

A palette BMP decoded in the tool, showing the header fields, the colour table as swatches with pixel counts, and the traced SVG beside it
The header and colour table are read straight from the file, so the swatches are the real palette entries and the traced fills reuse them. · swipe to see it all

Black and white mode, and why half the file disappears

An 8 bit scan of a pen drawing usually carries a table of 256 greys, most of them one or two pixels wide along each stroke. Trace that as-is and every stroke becomes three concentric shapes: dark core, mid grey halo, light fringe. Thresholding collapses all three into one shape, which is both what a cutter can use and what the drawing actually was before the scanner antialiased it. Set the threshold by watching the preview: the right value is the one where the strokes stop thinning out but the paper texture has already gone.

The same reasoning applies to screens and stamps. If you then want the artwork in a single colour, SVG Color Changer replaces every fill in one step, and SVG Validator will tell you whether the export kept its viewBox and namespace.

Edge cases this decoder handles

Where the traced BMP goes next

Palette BMPs are the classic input for screen printing and for cutting: one file per colour, each a single path, which is exactly what a vinyl cutter and a screen exposure want. Trim the empty margin with SVG Crop, Flip & Rotate, then check the machine limits in SVG for Silhouette Cameo or PNG to SVG for Cricut. For a JPEG source the noise profile is different enough that a dedicated page is better: JPG to SVG runs a heavier denoise and a majority filter before tracing. And if the artwork is already a clean transparent bitmap, PNG to SVG is the shortest path.

Frequently asked questions

Why not just open the BMP in the browser and trace that?

Because the browser throws the palette away. A 1, 4 or 8 bit BMP stores an index per pixel plus a colour table, and painting it to a canvas gives back 24 bit RGB with no record of which entry each pixel came from. This page parses the header and the table itself, so a 16 colour BMP comes out as exactly those 16 colours.

Does the SVG keep my exact palette colours?

Yes, up to 64 colours, in palette mode: each fill is copied from the BMP's colour table byte for byte, with no quantisation step. Files with a larger table are reduced to the 64 most used entries and the rest are mapped to the nearest one, which the palette line above the swatches reports.

Which BMP variants can be read?

1, 4, 8, 16, 24 and 32 bits per pixel; BI_RGB, BI_RLE8, BI_RLE4 and BI_BITFIELDS; bottom-up and top-down row order; OS/2 version 1 headers; and 32 bit files that carry a real alpha channel. BI_JPEG and BI_PNG compressed files are rejected with a message, because they are not bitmaps with a palette at all.

What is black and white mode for?

One bit art: faxes, stamps, PCB masks, screened scans, pen plots. It thresholds on luminance and traces two colours, which typically halves the path data compared with the same file at full palette, and it is what a laser or vinyl cutter wants anyway.

Is the BMP uploaded anywhere?

No. The bytes are read with FileReader and decoded in the tab. There is no upload endpoint on this page and no external script — disconnect the network and it keeps working.

Related SVG workflows

More free SVG tools