Function: image-type-from-file-header

image-type-from-file-header is an autoloaded and byte-compiled function defined in image.el.gz.

Signature

(image-type-from-file-header FILE)

Documentation

Determine the type of image file FILE from its first few bytes.

Value is a symbol specifying the image type, or nil if type cannot be determined.

Source Code

;; Defined in /usr/src/emacs/lisp/image.el.gz
;;;###autoload
(defun image-type-from-file-header (file)
  "Determine the type of image file FILE from its first few bytes.
Value is a symbol specifying the image type, or nil if type cannot
be determined."
  (unless (or (file-readable-p file)
	      (file-name-absolute-p file))
    (setq file (image-search-load-path file)))
  (and file
       (file-readable-p file)
       (with-temp-buffer
	 (set-buffer-multibyte nil)
	 (insert-file-contents-literally file nil 0 8192)
	 (image-type-from-buffer))))