From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/41766 Path: main.gmane.org!not-for-mail From: palmieri@math.washington.edu (John H. Palmieri) Newsgroups: gmane.emacs.gnus.general Subject: Re: X-Face and depth Date: Tue, 08 Jan 2002 13:17:00 -0800 Sender: owner-ding@hpc.uh.edu Message-ID: References: <15411.9669.562599.141358@www.ee.ryerson.ca> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035177112 7854 80.91.224.250 (21 Oct 2002 05:11:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 05:11:52 +0000 (UTC) Return-Path: Original-Received: (qmail 12689 invoked from network); 8 Jan 2002 21:20:49 -0000 Original-Received: from malifon.math.uh.edu (mail@129.7.128.13) by mastaler.com with SMTP; 8 Jan 2002 21:20:49 -0000 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 16O3ce-0006Zl-00; Tue, 08 Jan 2002 15:17:28 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Tue, 08 Jan 2002 15:17:19 -0600 (CST) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id PAA12024 for ; Tue, 8 Jan 2002 15:17:06 -0600 (CST) Original-Received: (qmail 12623 invoked by alias); 8 Jan 2002 21:17:01 -0000 Original-Received: (qmail 12618 invoked from network); 8 Jan 2002 21:17:01 -0000 Original-Received: from euler.math.washington.edu (128.95.224.1) by gnus.org with SMTP; 8 Jan 2002 21:17:01 -0000 Original-Received: from goedel1.math.washington.edu (goedel1.math.washington.edu [128.95.224.10]) by euler.math.washington.edu (8.11.6/8.11.6) with ESMTP id g08LH1K91061 for ; Tue, 8 Jan 2002 13:17:01 -0800 (PST) Original-Received: (from palmieri@localhost) by goedel1.math.washington.edu (8.11.6/8.11.6) id g08LH0w87181; Tue, 8 Jan 2002 13:17:00 -0800 (PST) X-Authentication-Warning: goedel1.math.washington.edu: palmieri set sender to palmieri@math.washington.edu using -f Original-To: ding@gnus.org X-Face: ,;upNQ$t/)!L]^R9Po%swv4 (Steve Youngs's message of "Tue, 08 Jan 2002 10:46:52 +1000") Original-Lines: 11 User-Agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.1 (alphaev5-dec-osf5.0) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:41766 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:41766 --=-=-= I'm attaching an almost completely untested version of gnus-convert-image-to-gray-x-face, which shouldn't require the presence of xbmtoikon. Does it work for anyone else? -- J. H. Palmieri Dept of Mathematics, Box 354350 mailto:palmieri@math.washington.edu University of Washington http://www.math.washington.edu/~palmieri/ Seattle, WA 98195-4350 --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=testing.el Content-Transfer-Encoding: 8bit Content-Description: gnus-convert-image-to-gray-x-face (defun gnus-convert-image-to-gray-x-face (file depth) (let* ((mapfile (make-temp-name (expand-file-name "gnus." mm-tmp-directory))) (levels (expt 2 depth)) (step (/ 255 (1- levels))) color-alist bits bits-list mask pixel x-faces) (with-temp-file mapfile (insert "P3\n") (insert (format "%d 1\n" levels)) (insert "255\n") (dotimes (i levels) (insert (format "%d %d %d\n" (* step i) (* step i) (* step i))) (push (cons (* step i) i) color-alist))) (when (file-exists-p file) (with-temp-buffer (insert (shell-command-to-string (format "giftopnm %s | ppmnorm 2>/dev/null | pnmscale -width 48 -height 48 | ppmquant -fs -map %s 2>/dev/null | ppmtopgm | pnmnoraw" (shell-quote-argument file) mapfile))) (goto-char (point-min)) (forward-line 3) (while (setq pixel (ignore-errors (read (current-buffer)))) (push (cdr (assq pixel color-alist)) bits-list)) (setq bits-list (nreverse bits-list)) (dotimes (bit-number depth) (setq mask (expt 2 bit-number)) (with-temp-buffer (insert "P1\n48 48\n") (dolist (bits bits-list) (insert (if (zerop (logand bits mask)) "0 " "1 "))) (shell-command-on-region (point-min) (point-max) "pbmtoicon | sed '/^[ ]*[*\\\\/]/d; s/[ ]//g; s/,$//' | tr , '\\012' | tr -d '[:blank:]' | sed 's/^0x//; s/^/0x/' | pr -l1 -t -w22 -3 -s, | sed 's/,*$/,/' | compface" (current-buffer) t) (push (buffer-string) x-faces)))) (dotimes (i (length x-faces)) (insert (if (zerop i) "X-Face:" (format "X-Face-%s:" i)) (nth i x-faces)))) (delete-file mapfile))) --=-=-=--