On Fri, 24 Nov 2006 14:31:37 -0500
Miark <[EMAIL PROTECTED]> wrote:

Hello Miark,

> Okay Joe, give it up. How'd you generate the color
> face/x-face for Claws?

Use the following script to convert a JPEG into the correct
format/size, then enter it into the Headers of Claws as Face (*not*
X-Face; they're different).  It's not a script of my making, and the
author is obviously so generous, he doesn't even credit himself.

You'll need ppmnorm, pnmscale, ppmquant, pnmtopng and mimencode in your
$PATH.


#!/bin/bash

jpg=$1
png=$2

if [ "$jpg" = "" -o "$png" = "" ]; then
   echo "Usage: make-face <JPG-FILE> <BASE64-FILE>"
   exit
fi

quant=16
found=false
tmp=/tmp/make-face.$$.tmp

while [ "$found" = "false" ]; do
    echo -n "Trying quantization $quant ($jpg)..."
    djpeg "$jpg"\
        | ppmnorm\
        | pnmscale -width 48 -height 48\
        | ppmquant $quant\
        | pnmtopng\
        | mimencode > $tmp
    size=`ls -l $tmp | awk '{ print $5; }'`
    if [ $size -lt 993 ]; then
        echo -n "Face:" > "$png"
        for i in `cat $tmp`; do
            echo -n " " >> "$png"
            echo "$i" >> "$png"
        done
        rm $tmp
        found=true
        echo "done"
    else
        quant=`expr $quant - 2`
        echo "too big ($size)"
    fi
done




-- 
 Regards  _
         / )           "The blindingly obvious is
        / _)rad        never immediately apparent"

It couldn't adapt so it couldn't survive
The Great British Mistake - The Adverts

Attachment: signature.asc
Description: PGP signature

Reply via email to