The XBM image format is a simple image file format that can only be used for black and white line art. But the cool thing about XBM files is that you can create them through JavaScript. This means you can add an image to a web page without using an image file. Instead the image is text within the HTML source code. Although black and white line art isn’t very fancy it does have the advantage of not allowing the user to right click on the image to save it.
The following sample code will create a little trash can icon but it does not work in Internet Explorer. Try to view this in Firefox instead. I was unable to get an example to work properly in this blog entry. You will need to create your own web page.
<HTML> <HEAD> <TITLE>XBM Image Format</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <script type="text/javascript"> var strXBM = "#define trash_width 16\n" strXBM = strXBM + "#define trash_height 16\n" strXBM = strXBM + "static char trash_bits[] = {" strXBM = strXBM + "0x00, 0x01, 0xe0, 0x0f, 0x10, 0x10, 0xf8, 0x3f, 0x10, 0x10, 0x50, 0x15," strXBM = strXBM + "0x50, 0x15, 0x50, 0x15, 0x50, 0x15, 0x50, 0x15, 0x50, 0x15, 0x50, 0x15," strXBM = strXBM + "0x50, 0x15, 0x10, 0x10, 0xe0, 0x0f, 0x00, 0x00};" </SCRIPT> <H1>XBM Image Format</H1> <IMG SRC="javascript:strXBM"> </BODY> </HTML>