Online X-Face Converter

Convert Image to X-Face

Most image formats (GIF, PNG, JPEG, TIFF, ...) are supported. The closer your image is to being 48x48 monochrome with 1-bit color depth, the better the results are likely to be, but any image should work. (There is a 512kb limit on image size.)

Select Image to Convert

Enter URL


Upload image

Conversion Options

Pad Color
White, Black
Auto-stretch, Equalize, None
Edge-Enhance (amount [1-9])
Floyd-Steinberg } (threshold [0.0-1.0])
Hilbert Curve (clump size [2-100])
Bayer's ordered dither (16x16)
cluster3, cluster4, cluster8
Bitmap Cleaning
Clean (connect [1-4])

Or Enter an X-Face to Display

What is this?

An X-Face: header allows you to include a 48x48 bitmap (one bit per pixel) icon in the headers of your e-mails or Usenet news posts. Some (of "your better") e-mail and news clients can display these icons along with your message.

Traditionally, an X-Face: header is created with a program called compface (part of the faces package) which produces a highly compressed representation of a 48x48 bitmap consisting solely of printable ASCII characters. The compface program requires its input to be in the archaic and obscure ikon format. Because of this, converting images to X-Face: headers is typically a time-consuming trial-and-error process.

This page fixes all that. Using this page you can convert nearly any image into an X-Face: header.


(Under construction.)

Supported Image Formats

I believe the following image types to be supported:

GIF, TIFF, PNG, JPEG, PPM, PGM, PBM, BMP (PC bitmap), XBM, XPM, XWD (X Windows dump), Sun rasterfile, MACP (MacPaint format), BRUSH (Xerox Doodlebrush), YBM (Bennet Yee's face format), FS (UseNix Facesaver), LISPM (Lisp machine bitmap), TGA (TrueVision Targa file), PI1 (Atari Degas .pi1), PI3 (Atari Degas .pi3), SPU (Atari uncompressed Spectrum file), SPC (Atari compressed Spectrum file), MDA (Microdesign .mda file), PCX, PICT, HIPS, FITS, ILBM, MTV, QRT, XIM, G3 (group 3 fax)

(I have not tested support for all the above types. Let me know if you discover bugs.)

The image type is deduced by inspecting the files magic number, when possible. If the magic number is not recognized, then the file name extension (e.g. .xbm) is used to identify the image type. (Currently the MIME type is ignored when determining image format.)

Conversion to 48x48 Bitmap

Most of the image manipulations are performed using various utilities from the netpbm package. The steps in the conversion process are:

  1. Conversion to PNM

    The image is converted to PNM (i.e. either PPM, PGM, or PBM) (if necessary).

  2. Scaling

    If the image is larger than 48 pixels in height or width, it is scaled so that it's largest dimension is exactly 48 pixels.

  3. Padding

    The image is then padded so that it is exactly 48 pixels square. The pad color option controls the padding fill color.

  4. Desaturation

    If the image is in color (i.e. a PPM) it is converted to a grayscale image using ppmtopgm.

  5. Contrast Enhancement

    If contrast enhancement is enabled, the image contrast is adjusted using pnmnorm (for Auto-stretch mode) or pnmhisteq (for Equalize mode).

    If edge-enhancement is enabled, the image is passed through pgmenhance. The amount parameter (you guessed it!) controls the amount of enhancement.

    If you're converting a continuous tone image, like a photograph, some edge enhancement often seems to make the final dithered picture a bit clearer.

    If edge-detection is enabled, the image is passed through pgmedge. (Edge detection is probably only useful for special effects.)

  6. Dithering

    If the image is not already a bitmap (1-bit color depth), it is converted to a PBM using the pgmtopbm program. The dithering options control the behavior of this step.

    Atkinson, Floyd-Steinberg and Threshold dithering are the most useful for creating small bitmaps. (The Atkinson algorithm seems usually to produce the best results.) The other dithering types are useful (if at all) only for special effects. The threshold parameter may be specified in the range (0.0,1.0) --- it affects the Atkinson, Floyd-Steinberg and threshold dithering. (It may help to think of the threshold as a brightness or gamma control.)

    See the pgmtopbm man page for more information on the dithering options.

  7. Bitmap Cleaning

    If bitmap cleaning is enabled, the bitmap is run through pbmclean. This inverts any pixel which has less than connect identical neighbors.

    If the invert option is selected the image is inverted (white <-> black).

  8. Conversion to X-Face

    Finally, the image is piped through compface to produce the X-Face header.




This page by Jeff Dairiki. Comments are welcome.

Valid HTML 4.01!