X BitMap

X BitMap

A sample XBM file
Filename extension .xbm
Internet media type image/xxbitmap, image/xxbm[1]
Type of format Image file formats
Extended from C (programming language)
Extended to X 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.[2] The XBM format was replaced by XPM for X11 in 1989.[3]

Format

XBM files differed markedly from most image files in that they took the form of C source files. This meant that they could be compiled directly into an application without any preprocessing steps, but it also made them far larger than their raw pixel data. The image data was 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.[4]

XBM data typically appeared in headers (.h files) and consisted of a series of static unsigned char arrays containing the monochrome pixel data. They featured one array per image stored in the header. The following piece of C code exemplifies an XBM file:

#define test_width 16
#define test_height 7
static 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 had two or four #define statements. The first two #defines specified the height and width of the bitmap in pixels. The second two, if they existed, specified the position of any hotspot within the bitmap. (Programmers used a hotspot within the image for bitmapped cursors to define where to position the "pointer" of the cursor, generally at 0,0.)

The image data consisted of a line of pixel values stored in a static array. Because a single bit represented each pixel (0 for white or 1 for black), each byte in the array contained 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 did not match a multiple of 8, the display mechanism ignored and discarded the extra bits in the last byte of each row.

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).[5] XBM support was removed from Internet Explorer 6, Mozilla Firefox 3.6,[6] and WebKit-based browsers.[7] There is a strong indication that Chromium (and therefore, also, Google Chrome) does not support XBM.[8] Documentation for Opera 2.12 and 6.0 indicates that XBM was at least previously supported.[9][10]

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

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.[13] XBM is also used in embedded processing (microControllers) to display Icons used in GUIs.[14]. To convert an image from or to xbm, you can use the ImageMagick tool[15] or GIMP (GNU Image Manipulation Program).

See also

References

  1. .xbm MIME type not registered at IANA
  2. Steve Kinzler (2005). "Picons Archive". Retrieved 2014-01-06. picons are in either monochrome XBM format or color XPM and GIF formats
  3. Daniel Dardailler (1996-07-15). "The XPM Story". Colas Nahaboo and Arnaud Le Hors. Retrieved 2014-01-01.
  4. James D. Murray, William vanRyper (April 1996). "Encyclopedia of Graphics File Formats, Second Edition". O'Reilly. ISBN 1-56592-161-5. Retrieved 2014-02-27.
  5. QingLong, Lu (1998-03-24). "Arena change history". Yggdrasil Computing. Archived from the original on 2003-02-28. Retrieved 2014-02-27.
  6. "504822 Remove XBM support from Mozilla". Mozilla. 2010-07-12. Retrieved 2014-10-22.
  7. "Bug 27823 Remove XBM support". WebKit. 2010-01-12. Retrieved 2014-10-22.
  8. "Issue 372898 - chromium - Chrome displays broken image icon when given direct link to XBM image. - An open-source project to help move the web forward. - Google Project Hosting". Google. 2014-06-26. Retrieved 2014-10-22.
  9. "Opera Software ASA - Opera version history". Opera Software. 2013-02-05. Retrieved 2014-10-22.
  10. "Changelog for Opera 6.0 for Unix TP 1". Opera Software. 2001-11-26. Retrieved 2014-10-22.
  11. "Image Formats". FFmpeg General Documentation. 2014. Retrieved 2014-02-23.
  12. Jeff Dairiki. "Online X-Face Converter". Retrieved 2014-03-02.
  13. various contributors. "Openbox Theme Documentation". Retrieved 2014-10-08.
  14. olikraus. "U8g2 library reference". Retrieved 2017-05-22.
  15. Aseem Kishore. "Convert Images Between Formats via the Command Line in Ubuntu". Retrieved 2017-05-22.

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.