Convert XBM images to PNG; transparency is preserved.
FluffyShieldProtected workspace
From
To
Loading the tool…
The tool didn't load. Reload the page, or check whether an extension or network filter blocks .
Free · No upload · No sign-up · No usage quotas
PNG options here: browser or advanced encoder; RGBA, RGB, grayscale or indexed color; 8- or 16-bit; Fast, Balanced or Maximum compression; interlacing. Which PNG settings are worth changing?
How it works
Choose XBM files
→Pick PNG, JPG or WebP
→Convert
→Download your copies
What it does
Opens XBM as a picture
Turns the C text inside an XBM into a PNG, JPG or WebP.
Photo sample as PNG: 73.0% smaller
Writes XBM too
Turn any picture into an XBM, in black and white.
One icon or many
Convert a folder of icons in one run, all on your device.
Limits An XBM holds black and white only.
Is an XBM file a picture or a program?
It's both: a black-and-white picture written out as C code. FluffyBench's XBM converter turns it into a PNG that opens anywhere and takes far less space than the text, and it can make an XBM from your own pictures too.
FluffyBench · 6 min read · Measured with FluffyBench's XBM converter
How can a list of numbers draw a picture?
Open an XBM in a text editor and you'll see something that looks like a program. Picture a row of light switches: each number sets eight of them, and every switch is either on (black) or off (white).
The first lines of our sample XBM file, as a text editor shows them.
Line in the file
What it says
#define dahlia_width 128
#define dahlia_height 96
Two lines give the picture's width and height as plain text.
static unsigned char dahlia_bits[] = {
The list of numbers that draws the picture starts here.
Each 0x number sets eight pixels, one bit apiece. A 1 bit is black, so 0xff is eight black pixels.
The first lines of the sample file, with the rest of the list cut. How we measured
Programs on the X Window System used XBM for small icons and mouse cursors, and early web browsers could show it before other image formats caught on. Spelling switches out as text is roomy, though. Most of the file is commas, spaces and 0x prefixes, not picture, and that's where a converted copy saves its space.
How much smaller is the picture as a PNG?
Less than a third of the size, in both browsers we tried. A PNG packs the same black and white pixels tightly, with none of the spelled-out text.
Our photo's XBM text file was 9.6 KB. FluffyBench's PNG of it came to 2.6 KB, smaller than the WebP and JPG copies too.
The PNG was 27% of the XBM text file's size, the smallest copy
XBM text file9.6 KB
PNG2.6 KB
WebP3.5 KB
JPG5.4 KB
024681012
File size, KB
The same picture as the XBM text file and as three copies made by FluffyBench; sizes are rounded to 0.1 KB.
So leave To on PNG unless an app asks for something else. Color won't come back, though. Whoever made the XBM already threw it away, and a PNG can only show what the file held.
Doing it in FluffyBench's XBM converter
FluffyBench's XBM converter does the whole job in your browser, so the file stays on your device. These steps follow one file from Choose images to Download.
Pick the XBM file with Choose images. To is already PNG, so the copy opens in any image app.
On a phone, the gear button opens Settings, which holds the size choice. Under Size, Original keeps the picture's pixel size.
Close Settings with the gear button, then press Convert to make the PNG.
The tile shows the PNG's dimensions and file size. Download saves the PNG.
Our photo sample was done 400 ms after we chose it. Got a folder of icons? Add them all at once: our batch of 1,000 files finished with “1000 of 1000 done · 9.6 MB → 2.6 MB · 73% saved.”
How does a picture become an XBM?
A photo saved as XBM ends up as a hard-edged pattern, like a stencil. With XBM as the To format, FluffyBench lays any transparency onto white and turns each pixel into a shade of gray. The Black & white setting starts on Threshold, which makes every pixel above the midpoint white and the rest black.
Our photo before saving, and as the XBM FluffyBench writes from it.
The photo
The XBM
The photo before and after its trip to black and white. Before, it's a full-color picture, with every shade of blue in the lake. In the XBM, every pixel above the midpoint of gray is white and the rest black, so the peak becomes a white shape and the lake's blues all land on black. · Photo: NPS Photo, Public domain, U.S. federal work; Public Domain Mark 1.0, via Wikimedia Commons / National Park Service.
Our photo came out as a 9.6 KB file from either a PNG or a JPG, close to the size of the sample XBM. Opening it again gave back the same black and white pixels, so nothing more is lost after that first trip. The other Black & white choice, Floyd-Steinberg, scatters dots to suggest shading. The file stays the same size; only the dots move.
What if an XBM won't open, or looks inverted?
Some files can't be read, and FluffyBench says why instead of drawing half a picture. A file cut to half its length reports “The XBM byte array is missing.” An older X10-style file, where the bits sit in a shorter list, reports “This older short-array XBM layout is not handled by this converter.” Either way the tile also says “This image couldn't be processed.”
If another program shows your XBM with black and white swapped, the picture isn't broken. Python's Pillow library did that with every one of our files, while FluffyBench follows the X11 rule that a 1 bit is black.
Once the PNG looks right, it's the copy to view and share. Keep the XBM itself if a program uses it as source code. For trimming or turning the icon, there's one more FluffyBench tool.
You need just part of the icon, or it faces the wrong way.