Gnus development mailing list
 help / color / mirror / Atom feed
* Image formats for gnus-(x-)face-from-file
@ 2005-10-13 20:12 Reiner Steib
  2005-10-14  7:21 ` James Cloos
  0 siblings, 1 reply; 9+ messages in thread
From: Reiner Steib @ 2005-10-13 20:12 UTC (permalink / 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/

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

end of thread, other threads:[~2006-04-13  8:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-13 20:12 Image formats for gnus-(x-)face-from-file Reiner Steib
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

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).