X-Face Headers and Mutt
 cb | debian | bridge | irc | df7cb | projects  
By inserting a "X-Face:" header, you can transmit a 48x48 monochrome picture in messages. Here's my setup for Mutt.

Displaying the X-Face

There are 3 ways to display the X-Faces:
  • using an external viewer and a message-hook, or (least intrusive setup)
  • a patch for Mutt with the slrnface program, or (broken, use w3mimgdisplay instead)
  • a patch for Mutt that uses w3mimgdisplay. (recommended if you build your own mutt)

message-hook, procmail, external viewer

You need the compface package. Set up message-hooks to call a $display_filter to display the image: (x-face muttrc snippet)
message-hook .			'unset display_filter'
message-hook '~h X-Face'	'set display_filter="procmail -pm $HOME/.mutt/x-face.procmailrc"'

my_hdr X-Face: (nN@x(D\\O)J!Qu\\q4fh8W^7WGq ...
I'm using procmail to extract the header and call the viewer: (x-face.procmailrc: procmail filter)
# procmailrc to display X-Face images
# (c) 2004 Christoph Berg, GNU GPL.
# 2004-06-13 cb: initial version

:0
# check if $DISPLAY is non-empty (needs procmail -p)
* DISPLAY ?? .
# extract X-Face: header (at least 16 chars, cf. "X-Face: ;-)")
* ^X-Face: *\/.................*
{
	:0c
	# pipe it through uncompface
	| echo $MATCH \
		| { echo '/* Width=48, Height=48 */'; uncompface; } \
		| icontopbm \
		| xv -quit - &
	:0fhw
	# remove the header for mutt
	| formail -I 'X-Face:'
}

# spit mail back to stdout
:0
|
Christian Ebert extended the script to also decode "Face:" headers: face.procmailrc

slrnface

Note: slrnface is abandoned by its author and broken with recent X11 libs, so be careful... (2004-07-21)
Note: the slrnface is broken with mutt starting ~1.5.8 (2005-03)

w3mimgdisplay

Takahashi Tamotsu wrote a new patch for displaying X-Faces in Mutt using w3m's w3mimgdisplay.

Building the X-Face

Install the compface and imagemagick packages. Then use quote-x-face to quote it for inclusion into your muttrc.
$ echo -n "X-Face:" > my_image.face
$ convert -despeckle -geometry 48x48 my_image.jpg xbm:- | compface >> my_image.face
$ ./quote-x-face my_image.face > muttrc.face
Alternatively, you can use a Makefile.x-face skeleton to create an X-Face header.

See also:

 
 Christoph Berg | Page last changed Thu Nov 8 18:49:18 2007 CET