#!/bin/sh # # xbm2face # convert an X11 bitmap to a Blit ikon bitmap, and then to a face # compressed bitmap for use in the mail X-Face header. Requires some # bitmap filters from the pbmplus package, and the compface program # from the faces package. # # Anthony Thyssen 17 Dec 1993 anthony@cit.gu.edu.au # Additions by Tim Connors Aug 2002 tconnors@astro.DIE.SPAMMING.BARSTARDS!.swin.edu.au (remove the spammers first) #TimC comments: #apt-get install compface netpbm #To convert a jpg (or pretty much anything else) to xbm, use the GIMP, or even easier: #mogrify -format xbm foo.jpg foo.xbm #Run this program supplying foo.xbm file, and it pipes the xface to stdout compface=`xbmtopbm "$@" | pbmtoicon | sed -e 1,2d -e '$s/$/,/' | tr -d '\011\012' | tr ',' '\012' | pr -l1 -t -w22 -3 -s, | sed -e 's/$/,/' -e 's/\(0x....\)\(0x....\)\(0x....\),/\1,\2,\3,/' | compface` #get rid of newlines and spaces: compface=`echo $compface | sed 's/ //g'` #no quotes around $compface because we want echo to discard newlines. echo "X-Face: $compface" #You import this line verbatim into the headers. #You may need to escape the %'s and "'s and /'s in programs like slrn. #Slrn in xface_header requires escapes of "'s and % and \ with another \ in front. #in followup_xface_header it requires the same, except that % needs to be escaped with %. #Stupid crappy stupidness! # | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/%/%%/g'