The Face Header

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:

Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEX9/ftIS5IsNImXjKgc
 I3Dh29sdnA7JAAAB60lEQVR4nI2US5ajMAxFXeF4HtlhXlZ7AdCCBWCcORTx/rfSkgyEyqg14uii
 pw8SpnzaRmrm/8yWD0dZqn80G5WlUOVEnsCPNKp6D2w98JsWHcJuiOiCPnXGNPDIU/U7BuKPGe7G
 fAW/rNPhl+A4bqkC6IZDiwOwXb0CnKBtpjMJhgZoB96bXl5Gtftfr+AHJ4LlhRm8VOvmJlCvwM3U
 d41f9maX1dOADG4cQe1lDD3RAzVH+DXMhhUTfjOIkWexvAHRkCSiyZmuYBWlGpGfV0CihDyrW8yh
 bOYDaFU5d+8AU8YXqtQNEz5P92KskWFq54h/ONWs4OtpbDoiGCzmNatc05rmBE6AtQpKsdsOfoLD
 UBgci6JAqgqI8bI2F+AwjleAew6OwFYSWA8CVgFdrQqfCnIW8MKAdexscwWTbOML8Q0myV4y8218
 7FIKomwvf5bO0ph+gZFbZCD7q2DZAc7nyQxv4FSLTcHjkLo5KS/Ox41lPHIExyEZRb4lP5zgR7c8
 BV822d6UTiAjiQnGVfyyIZfpYmZg+gpiTvHsg4EzHOIVsMC9lsvP0He2B+qHmHOO6fsAAehpqSc+
 yBNIF1wUgOXzCJDVBIB0Icfd2vKAN2jAubRfOvt3INsO+3XvdgGBgAH/OepfoIJ/RyuNKjhmbCAA
 AAAASUVORK5CYII=

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