The Face Header

Since the mid-nineties the X-Face header has gotten somewhat popular in certain circles. The X-Face header allows people to include a black-and-white 48x48 image in the headers of the news and mail messages they send out, and many news and mail readers display this image.

The primary limitation here is that these images are black-and-white. Not gray scale, but a one-bit image. This usually means that you have to squint and use your imagination to determine what the images are supposed to represent.

On the plus side, these images are typically represented by 100-200 bytes in each message, so their impact on message size is slight.

Ten years on, I think it's time to move on. The X-Face header was fun, but it would be even more fun to be able to put prettier images into the messages. Enter the Face header.

The Face header is a 48x48 PNG image. The number of colors are not to any set palette. The main limitation is that the header has to be less than 998 characters long, since that's a hard limit imposed by some news and mail servers. Messages that have a header longer than this are rejected by these servers.

The Face images are base64-encoded, which adds a 33% encoding overhead. This means that the total size of the PNG must be at most 725 bytes.

Here's the math:

In total, 998 characters.

When converting larger images to these 48x48 images, this can usually be achieved pretty easily by quantizing the image to a low number of colors. Most images can be squeezed to within these limits by quantizing to 8 or 10 colors.

This is the spec for the Face header:

  1. Width: 48 pixels
  2. Height: 48 pixels
  3. Format: PNG
  4. Maximum unencoded size: 725 bytes
  5. Maximum encoded header length: 998 characters
  6. Maximum line length: 79 characters

The Face header representing the image above looks like this:


An example command line to create such an image could be something like this:

djpeg face.jpg | ppmnorm | pnmscale -width 48 -height 48 | ppmquant 7 | pnmtopng > face.png

You then have to base64 encode this in some manner. News agents like Gnus will do that for you, and provides conveniency functions like gnus-face-from-file to create these headers.

If you're using some other news/mail reader, you might find this shell script helpful.

Here's an implementation for Microsoft Windows XP.

List of some mail readers that use/generate the Face header

  1. Claws Mail
  2. Script for Face in 40tude Dialog
  3. Thunderbird Extension
  4. Gnus
  5. Gmane
  6. kmail seems to be getting support for it
  7. Balsa Q

I dedicate the Face header to those ailing broadband companies, and hope that this will help bump up the network volume in these trying times.

Lars Magne Ingebrigtsen Last modified: Wed Aug 17 07:10:01 CEST 2005