Variable: image-type-header-regexps

image-type-header-regexps is a variable defined in image.el.gz.

Value

(("\\`/[	\n
 ]*\\*.*XPM.\\*/" . xpm)
 ("\\`P[1-6]\\(?:\\(?:\\(?:#[^
\n]*[
\n]\\)*[         
\n]\\)+\\(?:\\(?:#[^
\n]*[
\n]\\)*[0-9]\\)+\\)\\{2\\}"
  . pbm)
 ("\\`GIF8[79]a" . gif) ("\\`\211PNG
\n\n" . png)
 ("\\`[	\n
 ]*#define \\([a-z0-9_]+\\)_width [0-9]+\n#define \\1_height [0-9]+\n\\(#define \\1_x_hot [0-9]+\n#define \\1_y_hot [0-9]+\n\\)?static \\(unsigned \\)?char \\1_bits"
  . xbm)
 ("\\`\\(?:MM�\\*\\|II\\*�\\)" . tiff)
 ("\\`[	\n
 ]*%!PS" . postscript) ("\\`\377\330" . jpeg)
 ("\\`RIFF[^z-a][^z-a][^z-a][^z-a]WEBPVP8" . webp)
 ("\\(?:<\\?xml[     
\n]+[^>]*>\\)?[         
\n]*<\\(?:!--\\(?:[^-]\\|-[^-]\\)*-->[  
\n]*<\\)*\\(?:!DOCTYPE[    
\n]+[^>]*>[     
\n]*<[     
\n]*\\(?:!--\\(?:[^-]\\|-[^-]\\)*-->[      
\n]*<\\)*\\)?[Ss][Vv][Gg]"
  . svg)
 ("\\`....ftyp\\(heic\\|heix\\|hevc\\|heim\\|heis\\|hevm\\|hevs\\|mif1\\|msf1\\)"
  . heic))

Documentation

Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types.

When the first bytes of an image file match REGEXP, it is assumed to be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol. If not a symbol, IMAGE-TYPE must be a pair (PREDICATE . TYPE). PREDICATE is called with one argument, a string containing the image data. If PREDICATE returns a non-nil value, TYPE is the image's type.

Source Code

;; Defined in /usr/src/emacs/lisp/image.el.gz
(defconst image-type-header-regexps
  `(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
    ("\\`P[1-6]\\(?:\
\\(?:\\(?:#[^\r\n]*[\r\n]\\)*[ \t\r\n]\\)+\
\\(?:\\(?:#[^\r\n]*[\r\n]\\)*[0-9]\\)+\
\\)\\{2\\}" . pbm)
    ("\\`GIF8[79]a" . gif)
    ("\\`\x89PNG\r\n\x1a\n" . png)
    ("\\`[\t\n\r ]*#define \\([a-z0-9_]+\\)_width [0-9]+\n\
#define \\1_height [0-9]+\n\\(\
#define \\1_x_hot [0-9]+\n\
#define \\1_y_hot [0-9]+\n\\)?\
static \\(unsigned \\)?char \\1_bits" . xbm)
    ("\\`\\(?:MM\0\\*\\|II\\*\0\\)" . tiff)
    ("\\`[\t\n\r ]*%!PS" . postscript)
    ("\\`\xff\xd8" . jpeg)    ; used to be (image-jpeg-p . jpeg)
    ("\\`RIFF[^z-a][^z-a][^z-a][^z-a]WEBPVP8" . webp)
    (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
	     (comment-re (concat "\\(?:!--" incomment-re "*-->[ \t\r\n]*<\\)")))
	(concat "\\(?:<\\?xml[ \t\r\n]+[^>]*>\\)?[ \t\r\n]*<"
		comment-re "*"
		"\\(?:!DOCTYPE[ \t\r\n]+[^>]*>[ \t\r\n]*<[ \t\r\n]*" comment-re "*\\)?"
		"[Ss][Vv][Gg]"))
     . svg)
    ("\\`....ftyp\\(heic\\|heix\\|hevc\\|heim\\|heis\\|hevm\\|hevs\\|mif1\\|msf1\\)" . heic))
  "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types.
When the first bytes of an image file match REGEXP, it is assumed to
be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol.  If not a symbol,
IMAGE-TYPE must be a pair (PREDICATE . TYPE).  PREDICATE is called
with one argument, a string containing the image data.  If PREDICATE returns
a non-nil value, TYPE is the image's type.")