X BitMap

From HandWiki
Short description: File format
X BitMap
Blarg.xbm.png
A sample XBM file
Filename extension.xbm
Internet media typeimage/x-xbitmap, image/x-xbm[1]
Uniform Type Identifier (UTI)public.xbitmap-image[2]
Type of formatImage file formats
Extended fromC (programming language)
Extended toX PixMap (XPM)

In computer graphics, the X Window System used X BitMap (XBM), a plain text binary image format, for storing cursor and icon bitmaps used in the X GUI.[3] The XBM format is superseded by XPM, which first appeared for X11 in 1989.[4]

Format

XBM files differ markedly from most image files in that they take the form of C source files. This means that they can be compiled directly into an application without any preprocessing steps, but it also makes them far larger than their raw pixel data. The image data is encoded as a comma-separated list of byte values, each written in the C hexadecimal notation, '0x13' for example, so that multiple ASCII characters are used to express a single byte of image information.[5]

XBM data consists of a series of static unsigned char arrays containing the monochrome pixel data. When the format was in common use, an XBM typically appeared in headers (.h files) which featured one array per image stored in the header. The following piece of C code exemplifies the XBM file Blarg displayed in the panel at right:

#define test_width 16
#define test_height 7
static unsigned char test_bits[] = {
0x13, 0x00, 0x15, 0x00, 0x93, 0xcd, 0x55, 0xa5, 0x93, 0xc5, 0x00, 0x80,
0x00, 0x60 };

In place of the usual image-file-format header, XBM files has two or four #define statements. The first two #defines specify the height and width of the bitmap in pixels. The second two, if any, specify the position of any hotspot within the bitmap. (In the case of bitmapped cursors, the "hotspot" refers to the position of the cursor "point", generally at 0,0.)

XBM image data consists of a line of pixel values stored in a static array. Because a single bit represents each pixel (0 for white or 1 for black), each byte in the array contains the information for eight pixels, with the upper left pixel in the bitmap represented by the low bit of the first byte in the array. If the image width does not match a multiple of 8, the extra bits in the last byte of each row are ignored.

Support

Some web browsers support displaying XBM images as a holdover from the early days of the World Wide Web, when XBM was the minimal non-proprietary image file format. The Arena web browser had full support since version 0.3.34 (25 July 1997).[6] XBM support was removed from Internet Explorer 6, Mozilla Firefox 3.6,[7] and WebKit-based browsers.[8] There is a strong indication that Chromium (and therefore, also, Google Chrome) does not support XBM.[9] Documentation for Opera 2.12 and 6.0 indicates that XBM was at least previously supported.[10][11]

Some image viewers/converters, e.g., XnView, FFmpeg and IrfanView, support XBM.[12] A 48×48 XBM can be converted to Ikon and eventually X-Face with Netpbm tools.[13]

Despite having been superseded by the XPM format, XBM is still used by some modern but lightweight window managers like Openbox to define simple button images in a window's title bar, such as the iconify/minimize, restore, and maximize buttons.[14] XBM is also used in embedded processing (microControllers) to display Icons used in GUIs.[15] ImageMagick[16] supports converting images both to and from XBM. GIMP may be used to create or modify images using the XBM format, and also supports converting images to and from the XBM format.

See also

References

  1. .xbm MIME type not registered at IANA
  2. "System-Declared Uniform Type Identifiers". Uniform Type Identifiers Reference. Apple Inc. https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html. 
  3. Steve Kinzler (2005). "Picons Archive". http://kinzler.com/picons/ftp/index.html. "picons are in either monochrome XBM format or color XPM and GIF formats" 
  4. Daniel Dardailler (1996-07-15). "The XPM Story". http://www.w3.org/People/danield/xpm_story.html. 
  5. James D. Murray; William van Ryper (April 1996). Encyclopedia of Graphics File Formats, Second Edition. O'Reilly. ISBN 1-56592-161-5. https://archive.org/details/mac_Graphics_File_Formats_Second_Edition_1996. Retrieved 2014-02-27. 
  6. QingLong, Lu (1998-03-24). "Arena change history". Yggdrasil Computing. http://www.yggdrasil.com/Products/Arena/release/CHANGES.html. 
  7. "504822 – Remove XBM support from Mozilla". Mozilla. 2010-07-12. https://bugzilla.mozilla.org/show_bug.cgi?id=504822. 
  8. "Bug 27823 – Remove XBM support". WebKit. 2010-01-12. https://bugs.webkit.org/show_bug.cgi?id=27823. 
  9. "Issue 372898: Chrome displays broken image icon when given direct link to XBM image". 2014-06-26. https://code.google.com/p/chromium/issues/detail?id=372898. 
  10. "Opera Software ASA - Opera version history". Opera Software. 2013-02-05. http://www.opera.com/docs/history/presto/#o2. 
  11. "Changelog for Opera 6.0 for Unix TP 1". Opera Software. 2001-11-26. http://www.opera.com/docs/changelogs/unix/600tp1/. 
  12. "Image Formats". FFmpeg General Documentation. 2014. http://www.ffmpeg.org/general.html#Image-Formats. 
  13. Jeff Dairiki. "Online X-Face Converter". http://www.dairiki.org/xface/. 
  14. "Openbox Theme Documentation". http://openbox.org/wiki/Help:Themes#Button_images. 
  15. olikraus. "U8g2 library reference". https://github.com/olikraus/u8g2/wiki/u8g2reference#drawxbm. 
  16. Aseem Kishore (8 May 2010). "Convert Images Between Formats via the Command Line in Ubuntu". http://helpdeskgeek.com/linux-tips/convert-images-between-formats-via-the-command-line-in-ubuntu/.