XBM Mask Generator

Use this tool to create an XBM (X Bitmap) mask file from a GIF or PNG image with transparent pixels. An XBM mask is necessary for Perl/Tk programs if you want the window icon to have transparency in it.

Upload an Icon Use this form to upload an icon to be converted. The icon must be a GIF or PNG image and it must used an indexed palette (not truecolor).

About This Program

The XBM Mask Generator is a web-based tool for creating XBM mask files, specifically for use within Perl Tk. See the tutorial Perl/Tk Transparent Icons for more information.

About X BitMaps

X BitMap (XBM) images are an ASCII-based monochrome image format used by the X Window System for storing cursor and icon bitmaps. An XBM image has only two colors: white and black. For an XBM Mask, black pixels indicate parts of the source image that are solid, and white pixels are parts that are transparent.

Having said that, animated GIFs will not work. If you upload one, only the first frame of the GIF will be used.

Learn more about X BitMaps at Wikipedia.


  1. Upload the GIF or PNG image that you want to use as your Perl/Tk window icon. The image must have transparent pixels (otherwise the masking is pointless) and has to be an indexed-color image (truecolor images aren't allowed).
  2. Click on "Create Mask Image". If your image meets the requirements outlined below, a temporary download directory will be created and you will be presented with a link to the XBM file that was generated for you. You can then download your XBM image and use it in your Perl/Tk program. See the tutorial linked to above for more information about how to use your XBM image.
Requirements and Restrictions:
  1. Your image must be of the GIF or PNG format.
  2. Your image must be using an indexed-color palette.
  3. Your image must be less than 1 MB in size and smaller than 256x256 pixels.


Casey Kirsle © 2009