By Mohamad Wael

Posted :

How to create an xbm file ?

How to create an xbm file , featured image

XBM stands for X bitmap , which is just a mapping of bits , where each bit , can be one of two colors .

X stands for the X protocol . XBM is a format , which can be used for creating X application icons .

An example of an XBM file , contents , is as follows:

#define icon-is_width 40
#define icon-is_height 40
static char icon-is_bits[] = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
    0x80, 0x0F, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00,
    0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x20, 0x60, 0x00, 0x00, 0x00,
    0x20, 0xC0, 0x00, 0x00, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x20, 0x00,
    0x0E, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00,
    0x00, 0x20, 0x00, 0x08, 0x00, 0x00, 0x20, 0x20, 0x08, 0x00, 0x00, 0x20,
    0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };

The visualization of the previous XBM file content , is the following :

XBM icon visualization image

To create such files , there is the bitmap tool , which does not seem to work correctly , at least on Debian .

An alternative approach , is just use for example , Lunacy or sketch , or any other tool, to create your design , save it as a PNG file , and use the imagemagick program , which is available for linux , windows , and macOS , to convert between file formats .

This can be done , by issuing the following command : ./magick icon.png icon.xbm .