Image conversion guides

Verify a bitmap’s colors and alpha after SVG export

·

Use the sample before placing a bitmap over a colored layout. Its BMP header explicitly defines alpha, so the semitransparent teal block and the empty space have different effects on the background.

BMP to SVG

Check the red, teal and gold blocks

Select Load example or open bitmap-color-card.bmp. The source row shows 13 × 7 pixels. Select Convert to SVG and locate the solid red block above the gold bar on the left.

The teal block on the right is half-transparent, and the corners are fully transparent. Compare the teal block against both squares of the preview checkerboard. The red block stays the same color over either square.

Download the original 13 × 7 BMP color cardMicrosoft — BITMAPV5HEADER and channel masks

Check the pixel grid in the download

Download bitmap-color-card.svg and place it over a solid color. The background shows through the teal block and fully through the corners. The output has a 13 × 7 viewport and one image element carrying a PNG data URL.

In a layout editor you can reposition and scale the image as a single object. The embedded pixels set the available detail when you enlarge it.

W3C SVG 2 — Embedded image

Inspect a bitmap that looks opaque

The sample uses a Windows V5 bitmap with an explicit alpha mask. A source with a reserved fourth byte or no alpha mask may decode as opaque. A white background may also be part of the bitmap pixels.

If the exported preview shows a solid background, check how the source represents alpha or save a new bitmap with a declared mask. Compare the conversion over a colored background again.

Microsoft — BITMAPV5HEADER and channel masks

Common questions

Why does the preview have a checkerboard?

It shows the transparent areas and partial alpha in the output. The downloaded SVG contains the PNG pixels alone, so its surrounding background comes from the application displaying it.

Can I reopen the SVG away from the BMP?

Yes. The PNG is stored in the SVG as a data URL, so the reader can display it without opening the original bitmap.

Sources

Put it into practice.

Related guides