Function: gnus-face-from-file

gnus-face-from-file is an interactive and byte-compiled function defined in gnus-fun.el.gz.

Signature

(gnus-face-from-file FILE)

Documentation

Return a Face header based on an image FILE.

Depending on gnus-convert-image-to-face-command it may accept different input formats.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-fun.el.gz
;;;###autoload
(defun gnus-face-from-file (file)
  "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 "")
	  (quant 16))
      (while (and (not done)
		  (> quant 1))
	(setq attempt
	      (let ((coding-system-for-read 'binary))
		(gnus-shell-command-to-string
		 (format gnus-convert-image-to-face-command
			 (shell-quote-argument (expand-file-name file))
			 quant))))
	(if (> (length attempt) 726)
	    (progn
	      (setq quant (- quant (if (< quant 10) 1 2)))
	      (gnus-message 9 "Length %d; trying quant %d"
			    (length attempt) quant))
	  (setq done t)))
      (if done
	  (mm-with-unibyte-buffer
	    (insert attempt)
	    (gnus-face-encode))
	nil))))