Gnus development mailing list
 help / color / mirror / Atom feed
* Coloured faces: 740 bytes is too much.
@ 2003-04-13 13:48 Gaute B Strokkenes
  2003-04-15 21:48 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Gaute B Strokkenes @ 2003-04-13 13:48 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 652 bytes --]

I recently received some advice on gnu.emacs.gnus on how to get this
working.  However, I believe that the specification of the Face:
header is wrong in one respect.  It states that, because of
limitations on how large a news/mail header can be and the base64
encoding that is used, the png image can be at most 740 bytes long.

As luck would have it, the 10-colour version of the 9-colour image
that I have in this image is precisely 739 bytes.  When I base64
encode it I get a header that is too long.  A suitably modified
version of the make-face shell script seems to agree with me as well.

It seems that the calculations here need to be redone.


[-- Attachment #2: My pretty face --]
[-- Type: image/png, Size: 739 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: Not just a pretty face --]
[-- Type: text/x-sh, Size: 826 bytes --]

#!/bin/bash

png1=$1
png2=$2

if [ "$png1" = "" -o "$png2" = "" ]; then
   echo "Usage: make-face <PNG-FILE> <BASE64-FILE>"
   exit
fi

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

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

    

[-- Attachment #4: Type: text/plain, Size: 101 bytes --]



-- 
Big Gaute                               http://www.srcf.ucam.org/~gs234/
Are we on STRIKE yet?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-17 23:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-13 13:48 Coloured faces: 740 bytes is too much Gaute B Strokkenes
2003-04-15 21:48 ` Lars Magne Ingebrigtsen
2003-04-17 23:05   ` Gaute B Strokkenes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).