Convert XPM 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 XPM files
→Pick PNG, JPG or WebP
→Convert
→Download your copies
What it does
Reads the color legend
Follows the file's color table and draws the picture it describes.
Photo sample as PNG: 61.4% smaller
Keeps see-through areas
A color marked “none” stays clear in the PNG.
One icon or many
Convert a folder of icons in one run, all on your device.
Limits XPM can't hold soft, partly clear edges.
Where's the picture in an XPM file?
In rows of letters, with a legend at the top saying which color each letter pair stands for. FluffyBench's XPM converter reads that legend and hands back an ordinary PNG, without the file leaving your device.
FluffyBench · 6 min read · Measured with FluffyBench's XPM converter
Why is a picture written as C code?
Open an XPM in a text editor and it looks like a program: a list of text strings a programmer could paste straight into an application. Linux and X11 desktop software did exactly that for toolbar icons and cursors, so the picture shipped inside the program with no separate file to lose.
It works like a coloring-by-numbers page, which suits an icon with a few dozen colors and gets clumsy with a photo.
The first lines of our sample XPM file, as a text editor shows them.
Line in the file
What it says
/* XPM */
The XPM marker.
static const char *dahlia_xpm[] = {
A C array declaration.
"128 96 52 2",
The header: this file is 128 pixels wide and 96 tall, with 52 colors in its legend and two letters standing for each color.
"AA c #002455",
The legend: “AA” means the color #002455, a dark blue. Each following line names another color.
"AB c #0024aa",
"AC c #0049aa",
"AAAAAAAAAAAAAAAAAAAAAAAAAAA...
A row of the picture: a line of letter pairs, one pair for each pixel. The rest of this row is cut.
The first lines of the sample file, with the rest of the legend and the rows cut. How we measured
Doing it in FluffyBench's XPM converter
FluffyBench's XPM converter reads the legend for you and works in your browser, so nothing leaves your device.
Pick the XPM 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 sample, a small photo saved as an XPM of 25.9 KB, became a PNG of 10.0 KB, less than half the size. Its colors look coarse next to the original photo, and that's the file, not the converter: the sample was squeezed into a small palette before it reached us.
The left half of the original photo, and of our sample XPM as FluffyBench opens it.
The photo
The XPM
Look at the sky: smooth in the photo, banded in the XPM. The original photo has thousands of colors, and its sky shades smoothly. In the XPM the sky is split into flat bands, because the file's legend holds only 52 colors, and flat patches of blue and green replace the lake's shading. · Photo: NPS Photo, Public domain, U.S. federal work; Public Domain Mark 1.0, via Wikimedia Commons / National Park Service.
Small files make for quick batches: our run of 1,000 files reported “1000 of 1000 done · 25.9 MB → 10.0 MB · 61.4% saved” when it was done.
Why does an XPM I save come out so large?
Going the other way is where XPM gets expensive. Saving to XPM keeps every color exactly, and each distinct color gets its own line in the legend. A photo has thousands of them.
A photo that is 31.5 KB as a PNG came out at 201.4 KB as an XPM.
Saved with every color, the photo's XPM was 6.4 times its PNG
PNG31.5 KB
Reduced-color XPM sample25.9 KB
XPM saved with every color201.4 KB
050100150200250300
File size, KB
The sample XPM is small only because its colors were cut first; sizes are rounded to 0.1 KB.
The upside is exactness. Both photos we saved, one from a PNG and one from a JPG, reopened with no pixel changed, because no color was ever merged or rounded. If you just want a small file, save a PNG instead. XPM earns its keep as source code for tiny built-in icons.
What happens to soft, see-through edges?
XPM can mark one color as “none,” meaning see-through, and that's the whole story: a pixel is either fully there or fully gone. A feathered edge can't survive. When we saved our Earth picture, whose rim fades out gradually, and opened it again, 1,985 pixels of 9,216 had changed.
One patch of the Earth's rim, enlarged: the cutout, and the XPM FluffyBench saves from it.
The cutout
The saved XPM
Look at the rim: soft in the cutout, hard in the saved XPM. Fully clear pixels let the checkerboard show; the checkerboard is drawn behind the picture. Pixels along the cutout's rim are partly clear, so the planet fades out. In the XPM each pixel is either there or gone, so the fade snaps to one side. · Photo: NASA, Public domain, NASA-created image, via Wikimedia Commons.
A picture saved from a JPG, which has no transparency to lose, reopened with nothing changed. If your artwork has soft edges, keep it as a PNG.
Which XPM files cause trouble?
FluffyBench turns away files it can't read, with a plain message. A photo XPM cut to half its length opens as a failed tile with the detail “The XPM pixel row is truncated.” An XPM2 file, an older variant without the C wrapper, is refused with “That file does not contain an XPM marker.”
Other programs can be pickier. Python's Pillow library read our photo XPM exactly but couldn't open either file that uses the see-through color. If a program of yours chokes on an XPM with transparency, give it a PNG copy.
And if you only want a closer look at an icon, you don't have to convert it at all.