Gnus development mailing list
 help / color / mirror / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
Subject: Image formats for gnus-(x-)face-from-file
Date: Thu, 13 Oct 2005 22:12:35 +0200	[thread overview]
Message-ID: <v98xwxuqfg.fsf@marauder.physik.uni-ulm.de> (raw)

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

Hi,

the following patch allows for use different input image formats by
using convert(1) to generate Face and X-Face headers.
Currently `gnus-x-face-from-file' requires GIF and
`gnus-face-from-file' requires JPEG.

For me, the current `gnus-x-face-from-file' command doesn't even work
(and I saw similar reports on Google):

$ giftopnm face.gif | ppmnorm | pnmscale -width 48 -height 48 | ppmtopgm |\
  pgmtopbm | pbmtoxbm | compface
giftopnm: Reading Image Sequence 0
ppmnorm: remapping 65..233 to 0..255
compface: (warning) <stdin>: excess data ignored
compface: (warning) <stdin>: excess data ignored
$


Is it okay to change the defaults?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rs-gnus-fun-face-w-convert.patch --]
[-- Type: text/x-patch, Size: 2861 bytes --]

--- gnus-fun.el	29 Aug 2005 16:37:45 +0200	7.9
+++ gnus-fun.el	13 Oct 2005 21:56:20 +0200	
@@ -45,21 +45,37 @@
   :group 'gnus-fun
   :type 'string)
 
-(defcustom gnus-convert-image-to-x-face-command "giftopnm %s | ppmnorm | pnmscale -width 48 -height 48 | ppmtopgm | pgmtopbm | pbmtoxbm | compface"
+(defcustom gnus-convert-image-to-x-face-command
+  "convert -resize 48x48 %s xbm:- | xbm2xface.pl"
   "Command for converting an image to an X-Face.
+The command must take a image filename (use \"%s\") as input.
+The output must be the Face header data on stdout in PNG format.
+
 By default it takes a GIF filename and output the X-Face header data
 on stdout."
   :version "22.1"
   :group 'gnus-fun
-  :type 'string)
+  :type '(choice (const :tag "giftopnm, netpbm (GIF input only)"
+			"giftopnm %s | ppmnorm | pnmscale -width 48 -height 48 | ppmtopgm | pgmtopbm | pbmtoxbm | compface")
+		 (const :tag "convert"
+			"convert -resize 48x48 %s xbm:- | xbm2xface.pl")
+		 (string)))
 
-(defcustom gnus-convert-image-to-face-command "djpeg %s | ppmnorm | pnmscale -width 48 -height 48 | ppmquant %d | pnmtopng"
+(defcustom gnus-convert-image-to-face-command
+  "convert -resize 48x48 %s -colors %d png:-"
   "Command for converting an image to a Face.
-By default it takes a JPEG filename and output the Face header data
-on stdout."
+
+The command must take an image filename (first format
+argument\"%s\") and the number of colors (second format argument:
+\"%d\") as input.  The output must be the Face header data on
+stdout in PNG format."
   :version "22.1"
   :group 'gnus-fun
-  :type 'string)
+  :type '(choice (const :tag "djpeg, netpbm (JPG input only)"
+			"djpeg %s | ppmnorm | pnmscale -width 48 -height 48 | ppmquant %d | pnmtopng")
+		 (const :tag "convert"
+			"convert -resize 48x48 %s -colors %d png:-")
+		 (string)))
 
 (defcustom gnus-face-properties-alist (if (featurep 'xemacs)
 					  '((xface . (:face gnus-x-face)))
@@ -125,8 +141,11 @@
 
 ;;;###autoload
 (defun gnus-x-face-from-file (file)
-  "Insert an X-Face header based on an image file."
-  (interactive "fImage file name (by default GIF): ")
+  "Insert an X-Face header based on an image file.
+
+Depending on `gnus-convert-image-to-x-face-command' it may accept
+different input formats."
+  (interactive "fImage file name: ")
   (when (file-exists-p file)
     (gnus-shell-command-to-string
      (format gnus-convert-image-to-x-face-command
@@ -134,8 +153,11 @@
 
 ;;;###autoload
 (defun gnus-face-from-file (file)
-  "Return a Face header based on an image file."
-  (interactive "fImage file name (by default JPEG): ")
+  "Return a Face header based on an image file.
+
+Depending on `gnus-convert-image-to-face-command' it may accept
+different input formats."
+  (interactive "fImage file name: ")
   (when (file-exists-p file)
     (let ((done nil)
 	  (attempt "")

[-- Attachment #3: Type: text/plain, Size: 114 bytes --]


Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

             reply	other threads:[~2005-10-13 20:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13 20:12 Reiner Steib [this message]
2005-10-14  7:21 ` James Cloos
2005-10-14 16:51   ` Reiner Steib
2005-10-27 14:21     ` face quantization (was: Image formats for gnus-(x-)face-from-file) Didier Verna
2005-10-27 15:11       ` face quantization Reiner Steib
2005-10-28  8:32         ` Didier Verna
2005-10-28 10:52           ` Reiner Steib
2005-10-28 12:43             ` Didier Verna
2006-04-13  8:25               ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v98xwxuqfg.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).