1226048Sobrien
268349Sobrien#------------------------------------------------------------------------------
3284193Sdelphij# $File: images,v 1.102 2015/01/02 02:36:35 christos Exp $
4186690Sobrien# images:  file(1) magic for image formats (see also "iff", and "c-lang" for
5186690Sobrien# XPM bitmaps)
668349Sobrien#
768349Sobrien# originally from jef@helios.ee.lbl.gov (Jef Poskanzer),
868349Sobrien# additions by janl@ifi.uio.no as well as others. Jan also suggested
968349Sobrien# merging several one- and two-line files into here.
1068349Sobrien#
1168349Sobrien# little magic: PCX (first byte is 0x0a)
1268349Sobrien
1368349Sobrien# Targa - matches `povray', `ppmtotga' and `xv' outputs
1468349Sobrien# by Philippe De Muyter <phdm@macqel.be>
1568349Sobrien# at 2, byte ImgType must be 1, 2, 3, 9, 10 or 11
1668349Sobrien# at 1, byte CoMapType must be 1 if ImgType is 1 or 9, 0 otherwise
1768349Sobrien# at 3, leshort Index is 0 for povray, ppmtotga and xv outputs
1868349Sobrien# `xv' recognizes only a subset of the following (RGB with pixelsize = 24)
1968349Sobrien# `tgatoppm' recognizes a superset (Index may be anything)
2068349Sobrien1	belong&0xfff7ffff	0x01010000	Targa image data - Map
21267843Sdelphij!:strength + 2
2268349Sobrien>2	byte&8			8		- RLE
23267843Sdelphij>12	leshort			>0		%d x
24267843Sdelphij>14	leshort			>0		%d
2568349Sobrien1	belong&0xfff7ffff	0x00020000	Targa image data - RGB
26267843Sdelphij!:strength + 2
2768349Sobrien>2	byte&8			8		- RLE
28267843Sdelphij>12	leshort			>0		%d x
29267843Sdelphij>14	leshort			>0		%d
3068349Sobrien1	belong&0xfff7ffff	0x00030000	Targa image data - Mono
31267843Sdelphij!:strength + 2
3268349Sobrien>2	byte&8			8		- RLE
33267843Sdelphij>12	leshort			>0		%d x
34267843Sdelphij>14	leshort			>0		%d
3568349Sobrien
3668349Sobrien# PBMPLUS images
3768349Sobrien# The next byte following the magic is always whitespace.
38267843Sdelphij# strength is changed to try these patterns before "x86 boot sector"
39267843Sdelphij0	search/1	P1		
40267843Sdelphij>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PBM image text
41267843Sdelphij>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
42267843Sdelphij>>3	regex		=\ [0-9]{1,50}	\b%s
43267843Sdelphij!:strength + 45
44186690Sobrien!:mime	image/x-portable-bitmap
45267843Sdelphij0	search/1	P2		
46267843Sdelphij>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PGM image text
47267843Sdelphij>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
48267843Sdelphij>>3	regex		=\ [0-9]{1,50}	\b%s
49267843Sdelphij!:strength + 45
50186690Sobrien!:mime	image/x-portable-greymap
51267843Sdelphij0	search/1	P3
52267843Sdelphij>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PPM image text
53267843Sdelphij>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
54267843Sdelphij>>3	regex		=\ [0-9]{1,50}	\b%s
55267843Sdelphij!:strength + 45
56186690Sobrien!:mime	image/x-portable-pixmap
57267843Sdelphij0	string		P4		
58267843Sdelphij>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PBM "rawbits" image data
59267843Sdelphij>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
60267843Sdelphij>>3	regex		=\ [0-9]{1,50}	\b%s
61267843Sdelphij!:strength + 45
62186690Sobrien!:mime	image/x-portable-bitmap
63267843Sdelphij0	string		P5		
64267843Sdelphij>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PGM "rawbits" image data
65267843Sdelphij>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
66267843Sdelphij>>3	regex		=\ [0-9]{1,50}	\b%s
67267843Sdelphij!:strength + 45
68186690Sobrien!:mime	image/x-portable-greymap
69267843Sdelphij0	string		P6		
70267843Sdelphij>3	regex		=[0-9]{0,50}\ [0-9]{0,50}		Netpbm PPM "rawbits" image data
71267843Sdelphij>3	regex		=[0-9]{1,50}\ 		\b, size = %sx
72267843Sdelphij>>3	regex		=\ [0-9]{1,50}	\b%s
73267843Sdelphij!:strength + 45
74186690Sobrien!:mime	image/x-portable-pixmap
7569216Sobrien0	string		P7		Netpbm PAM image file
76186690Sobrien!:mime	image/x-portable-pixmap
7768349Sobrien
7869216Sobrien# From: bryanh@giraffe-data.com (Bryan Henderson)
7969216Sobrien0	string		\117\072	Solitaire Image Recorder format
8069216Sobrien>4	string		\013		MGI Type 11
8169216Sobrien>4	string		\021		MGI Type 17
8269216Sobrien0	string		.MDA		MicroDesign data
8369216Sobrien>21	byte		48		version 2
8469216Sobrien>21	byte		51		version 3
8569216Sobrien0	string		.MDP		MicroDesign page data
8669216Sobrien>21	byte		48		version 2
8769216Sobrien>21	byte		51		version 3
8869216Sobrien
8968349Sobrien# NIFF (Navy Interchange File Format, a modification of TIFF) images
90186690Sobrien# [GRR:  this *must* go before TIFF]
9168349Sobrien0	string		IIN1		NIFF image data
92186690Sobrien!:mime	image/x-niff
9368349Sobrien
94226048Sobrien# Canon RAW version 1 (CRW) files are a type of Canon Image File Format
95226048Sobrien# (CIFF) file. These are apparently all little-endian.
96226048Sobrien# From: Adam Buchbinder <adam.buchbinder@gmail.com>
97226048Sobrien# URL: http://www.sno.phy.queensu.ca/~phil/exiftool/canon_raw.html
98226048Sobrien0	string		II\x1a\0\0\0HEAPCCDR	Canon CIFF raw image data
99226048Sobrien!:mime	image/x-canon-crw
100226048Sobrien>16	leshort		x	\b, version %d.
101226048Sobrien>14	leshort		x	\b%d
102226048Sobrien
103226048Sobrien# Canon RAW version 2 (CR2) files are a kind of TIFF with an extra magic
104226048Sobrien# number. Put this above the TIFF test to make sure we detect them.
105226048Sobrien# These are apparently all little-endian.
106226048Sobrien# From: Adam Buchbinder <adam.buchbinder@gmail.com>
107226048Sobrien# URL: http://libopenraw.freedesktop.org/wiki/Canon_CR2
108226048Sobrien0	string		II\x2a\0\x10\0\0\0CR	Canon CR2 raw image data
109226048Sobrien!:mime	image/x-canon-cr2
110226048Sobrien>10	byte		x	\b, version %d.
111226048Sobrien>11	byte		x	\b%d
112226048Sobrien
11368349Sobrien# Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
11468349Sobrien# The second word of TIFF files is the TIFF version number, 42, which has
11568349Sobrien# never changed.  The TIFF specification recommends testing for it.
11668349Sobrien0	string		MM\x00\x2a	TIFF image data, big-endian
117186690Sobrien!:mime	image/tiff
118284193Sdelphij>(4.L)	use		\^tiff_ifd
11968349Sobrien0	string		II\x2a\x00	TIFF image data, little-endian
120186690Sobrien!:mime	image/tiff
121284193Sdelphij>(4.l)	use		tiff_ifd
12268349Sobrien
123284193Sdelphij0	name		tiff_ifd
124284193Sdelphij>0	leshort		x		\b, direntries=%d
125284193Sdelphij>2	use		tiff_entry
126284193Sdelphij
127284193Sdelphij0	name		tiff_entry
128284193Sdelphij# NewSubFileType
129284193Sdelphij>0	leshort		0xfe
130284193Sdelphij>>12	use		tiff_entry
131284193Sdelphij>0	leshort		0x100
132284193Sdelphij>>4	lelong		1
133284193Sdelphij>>>12	use		tiff_entry
134284193Sdelphij>>>8	leshort		x		\b, width=%d
135284193Sdelphij>0	leshort		0x101
136284193Sdelphij>>4	lelong		1
137284193Sdelphij>>>8	leshort		x		\b, height=%d
138284193Sdelphij>>>12	use		tiff_entry
139284193Sdelphij>0	leshort		0x102
140284193Sdelphij>>8	leshort		x		\b, bps=%d
141284193Sdelphij>>12	use		tiff_entry
142284193Sdelphij>0	leshort		0x103
143284193Sdelphij>>4	lelong		1		\b, compression=
144284193Sdelphij>>>8	leshort		1		\bnone
145284193Sdelphij>>>8	leshort		2		\bhuffman
146284193Sdelphij>>>8	leshort		3		\bbi-level group 3
147284193Sdelphij>>>8	leshort		4		\bbi-level group 4
148284193Sdelphij>>>8	leshort		5		\bLZW
149284193Sdelphij>>>8	leshort		6		\bJPEG (old)
150284193Sdelphij>>>8	leshort		7		\bJPEG
151284193Sdelphij>>>8	leshort		8		\bdeflate
152284193Sdelphij>>>8	leshort		9		\bJBIG, ITU-T T.85
153284193Sdelphij>>>8	leshort		0xa		\bJBIG, ITU-T T.43
154284193Sdelphij>>>8	leshort		0x7ffe		\bNeXT RLE 2-bit
155284193Sdelphij>>>8	leshort		0x8005		\bPackBits (Macintosh RLE)
156284193Sdelphij>>>8	leshort		0x8029		\bThunderscan RLE
157284193Sdelphij>>>8	leshort		0x807f		\bRasterPadding (CT or MP)
158284193Sdelphij>>>8	leshort		0x8080		\bRLE (Line Work)
159284193Sdelphij>>>8	leshort		0x8081		\bRLE (High-Res Cont-Tone)
160284193Sdelphij>>>8	leshort		0x8082		\bRLE (Binary Line Work)
161284193Sdelphij>>>8	leshort		0x80b2		\bDeflate (PKZIP)
162284193Sdelphij>>>8	leshort		0x80b3		\bKodak DCS
163284193Sdelphij>>>8	leshort		0x8765		\bJBIG
164284193Sdelphij>>>8	leshort		0x8798		\bJPEG2000
165284193Sdelphij>>>8	leshort		0x8799		\bNikon NEF Compressed
166284193Sdelphij>>>8	default		x	
167284193Sdelphij>>>>8	leshort		x		\b(unknown 0x%x)
168284193Sdelphij>>>12	use		tiff_entry
169284193Sdelphij>0	leshort		0x106		\b, PhotometricIntepretation=
170284193Sdelphij>>8	leshort		0		\bWhiteIsZero
171284193Sdelphij>>8	leshort		1		\bBlackIsZero
172284193Sdelphij>>8	leshort		2		\bRGB
173284193Sdelphij>>8	leshort		3		\bRGB Palette
174284193Sdelphij>>8	leshort		4		\bTransparency Mask
175284193Sdelphij>>8	leshort		5		\bCMYK
176284193Sdelphij>>8	leshort		6		\bYCbCr
177284193Sdelphij>>8	leshort		8		\bCIELab
178284193Sdelphij>>>8	leshort		x		\b(unknown=0x%x)
179284193Sdelphij>>12	use		tiff_entry
180284193Sdelphij# FillOrder
181284193Sdelphij>0	leshort		0x10a
182284193Sdelphij>>4	lelong		1
183284193Sdelphij>>>12	use		tiff_entry
184284193Sdelphij# DocumentName
185284193Sdelphij>0	leshort		0x10d
186284193Sdelphij>>(8.l)	string		x		\b, name=%s
187284193Sdelphij>>>12	use		tiff_entry
188284193Sdelphij# ImageDescription
189284193Sdelphij>0	leshort		0x10e
190284193Sdelphij>>(8.l)	string		x		\b, description=%s
191284193Sdelphij>>>12	use		tiff_entry
192284193Sdelphij# Make
193284193Sdelphij>0	leshort		0x10f
194284193Sdelphij>>(8.l)	string		x		\b, manufacturer=%s
195284193Sdelphij>>>12	use		tiff_entry
196284193Sdelphij# Model
197284193Sdelphij>0	leshort		0x110
198284193Sdelphij>>(8.l)	string		x		\b, model=%s
199284193Sdelphij>>>12	use		tiff_entry
200284193Sdelphij# StripOffsets
201284193Sdelphij>0	leshort		0x111
202284193Sdelphij>>12	use		tiff_entry
203284193Sdelphij# Orientation
204284193Sdelphij>0	leshort		0x112		\b, orientation=
205284193Sdelphij>>8	leshort		1		\bupper-left
206284193Sdelphij>>8	leshort		3		\blower-right
207284193Sdelphij>>8	leshort		6		\bupper-right
208284193Sdelphij>>8	leshort		8		\blower-left
209284193Sdelphij>>8	leshort		9		\bundefined
210284193Sdelphij>>8	default		x
211284193Sdelphij>>>8	leshort		x		\b[*%d*]
212284193Sdelphij>>12	use		tiff_entry
213284193Sdelphij# XResolution
214284193Sdelphij>0	leshort		0x11a
215284193Sdelphij>>8	lelong		x		\b, xresolution=%d
216284193Sdelphij>>12	use		tiff_entry
217284193Sdelphij# YResolution
218284193Sdelphij>0	leshort		0x11b
219284193Sdelphij>>8	lelong		x		\b, yresolution=%d
220284193Sdelphij>>12	use		tiff_entry
221284193Sdelphij# ResolutionUnit
222284193Sdelphij>0	leshort		0x128
223284193Sdelphij>>8	leshort		x		\b, resolutionunit=%d
224284193Sdelphij>>12	use		tiff_entry
225284193Sdelphij# Software
226284193Sdelphij>0	leshort		0x131
227284193Sdelphij>>(8.l)	string		x		\b, software=%s
228284193Sdelphij>>12	use		tiff_entry
229284193Sdelphij# Datetime
230284193Sdelphij>0	leshort		0x132
231284193Sdelphij>>(8.l)	string		x		\b, datetime=%s
232284193Sdelphij>>12	use		tiff_entry
233284193Sdelphij# HostComputer
234284193Sdelphij>0	leshort		0x13c
235284193Sdelphij>>(8.l)	string		x		\b, hostcomputer=%s
236284193Sdelphij>>12	use		tiff_entry
237284193Sdelphij# WhitePoint
238284193Sdelphij>0	leshort		0x13e
239284193Sdelphij>>12	use		tiff_entry
240284193Sdelphij# PrimaryChromaticities
241284193Sdelphij>0	leshort		0x13f
242284193Sdelphij>>12	use		tiff_entry
243284193Sdelphij# YCbCrCoefficients
244284193Sdelphij>0	leshort		0x211
245284193Sdelphij>>12	use		tiff_entry
246284193Sdelphij# YCbCrPositioning
247284193Sdelphij>0	leshort		0x213
248284193Sdelphij>>12	use		tiff_entry
249284193Sdelphij# ReferenceBlackWhite
250284193Sdelphij>0	leshort		0x214
251284193Sdelphij>>12	use		tiff_entry
252284193Sdelphij# Copyright
253284193Sdelphij>0	leshort		0x8298
254284193Sdelphij>>(8.l)	string		x		\b, copyright=%s
255284193Sdelphij>>12	use		tiff_entry
256284193Sdelphij# ExifOffset
257284193Sdelphij>0	leshort		0x8769
258284193Sdelphij>>12	use		tiff_entry
259284193Sdelphij# GPS IFD
260284193Sdelphij>0	leshort		0x8825		\b, GPS-Data
261284193Sdelphij>>12	use		tiff_entry
262284193Sdelphij
263284193Sdelphij#>0	leshort		x		\b, unknown=0x%x
264284193Sdelphij#>>12	use		tiff_entry
265284193Sdelphij
266234250Sobrien0	string		MM\x00\x2b	Big TIFF image data, big-endian
267234250Sobrien!:mime	image/tiff
268234250Sobrien0	string		II\x2b\x00	Big TIFF image data, little-endian
269234250Sobrien!:mime	image/tiff
270234250Sobrien
27168349Sobrien# PNG [Portable Network Graphics, or "PNG's Not GIF"] images
27268349Sobrien# (Greg Roelofs, newt@uchicago.edu)
27368349Sobrien# (Albert Cahalan, acahalan@cs.uml.edu)
27468349Sobrien#
27568349Sobrien# 137 P N G \r \n ^Z \n [4-byte length] H E A D [HEAD data] [HEAD crc] ...
27668349Sobrien#
277226048Sobrien0	string		\x89PNG\x0d\x0a\x1a\x0a		PNG image data
278186690Sobrien!:mime	image/png
279267843Sdelphij>16	belong		x		\b, %d x
280267843Sdelphij>20	belong		x		%d,
281186690Sobrien>24	byte		x		%d-bit
282186690Sobrien>25	byte		0		grayscale,
283186690Sobrien>25	byte		2		\b/color RGB,
284186690Sobrien>25	byte		3		colormap,
285186690Sobrien>25	byte		4		gray+alpha,
286186690Sobrien>25	byte		6		\b/color RGBA,
287186690Sobrien#>26	byte		0		deflate/32K,
288186690Sobrien>28	byte		0		non-interlaced
289186690Sobrien>28	byte		1		interlaced
29068349Sobrien
291186690Sobrien# possible GIF replacements; none yet released!
292186690Sobrien# (Greg Roelofs, newt@uchicago.edu)
293186690Sobrien#
294186690Sobrien# GRR 950115:  this was mine ("Zip GIF"):
295186690Sobrien0	string		GIF94z		ZIF image (GIF+deflate alpha)
296186690Sobrien!:mime	image/x-unknown
297186690Sobrien#
298186690Sobrien# GRR 950115:  this is Jeremy Wohl's Free Graphics Format (better):
299186690Sobrien#					
300186690Sobrien0	string		FGF95a		FGF image (GIF+deflate beta)
301186690Sobrien!:mime	image/x-unknown
302186690Sobrien#
303186690Sobrien# GRR 950115:  this is Thomas Boutell's Portable Bitmap Format proposal
304186690Sobrien# (best; not yet implemented):
305186690Sobrien#					
306186690Sobrien0	string		PBF		PBF image (deflate compression)
307186690Sobrien!:mime	image/x-unknown
308186690Sobrien
30968349Sobrien# GIF
31068349Sobrien0	string		GIF8		GIF image data
311186690Sobrien!:mime	image/gif
312191736Sobrien!:apple	8BIMGIFf
31368349Sobrien>4	string		7a		\b, version 8%s,
31468349Sobrien>4	string		9a		\b, version 8%s,
315267843Sdelphij>6	leshort		>0		%d x
316267843Sdelphij>8	leshort		>0		%d
31768349Sobrien#>10	byte		&0x80		color mapped,
31868349Sobrien#>10	byte&0x07	=0x00		2 colors
31968349Sobrien#>10	byte&0x07	=0x01		4 colors
32068349Sobrien#>10	byte&0x07	=0x02		8 colors
32168349Sobrien#>10	byte&0x07	=0x03		16 colors
32268349Sobrien#>10	byte&0x07	=0x04		32 colors
32368349Sobrien#>10	byte&0x07	=0x05		64 colors
32468349Sobrien#>10	byte&0x07	=0x06		128 colors
32568349Sobrien#>10	byte&0x07	=0x07		256 colors
32668349Sobrien
32768349Sobrien# ITC (CMU WM) raster files.  It is essentially a byte-reversed Sun raster,
32868349Sobrien# 1 plane, no encoding.
32968349Sobrien0	string		\361\0\100\273	CMU window manager raster image data
33068349Sobrien>4	lelong		>0		%d x
33168349Sobrien>8	lelong		>0		%d,
33268349Sobrien>12	lelong		>0		%d-bit
33368349Sobrien
33468349Sobrien# Magick Image File Format
33568349Sobrien0	string		id=ImageMagick	MIFF image data
33668349Sobrien
33768349Sobrien# Artisan
33868349Sobrien0	long		1123028772	Artisan image data
33968349Sobrien>4	long		1		\b, rectangular 24-bit
34068349Sobrien>4	long		2		\b, rectangular 8-bit with colormap
34168349Sobrien>4	long		3		\b, rectangular 32-bit (24-bit with matte)
34268349Sobrien
34368349Sobrien# FIG (Facility for Interactive Generation of figures), an object-based format
344186690Sobrien0	search/1	#FIG		FIG image text
34568349Sobrien>5	string		x		\b, version %.3s
34668349Sobrien
34768349Sobrien# PHIGS
34868349Sobrien0	string		ARF_BEGARF		PHIGS clear text archive
34968349Sobrien0	string		@(#)SunPHIGS		SunPHIGS
35068349Sobrien# version number follows, in the form m.n
35168349Sobrien>40	string		SunBin			binary
35268349Sobrien>32	string		archive			archive
35368349Sobrien
35468349Sobrien# GKS (Graphics Kernel System)
35568349Sobrien0	string		GKSM		GKS Metafile
35668349Sobrien>24	string		SunGKS		\b, SunGKS
35768349Sobrien
35868349Sobrien# CGM image files
35968349Sobrien0	string		BEGMF		clear text Computer Graphics Metafile
36068349Sobrien
36168349Sobrien# MGR bitmaps  (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
36268349Sobrien0	string	yz	MGR bitmap, modern format, 8-bit aligned
36368349Sobrien0	string	zz	MGR bitmap, old format, 1-bit deep, 16-bit aligned
36468349Sobrien0	string	xz	MGR bitmap, old format, 1-bit deep, 32-bit aligned
36568349Sobrien0	string	yx	MGR bitmap, modern format, squeezed
36668349Sobrien
36768349Sobrien# Fuzzy Bitmap (FBM) images
36868349Sobrien0	string		%bitmap\0	FBM image data
36968349Sobrien>30	long		0x31		\b, mono
37068349Sobrien>30	long		0x33		\b, color
37168349Sobrien
37268349Sobrien# facsimile data
37368349Sobrien1	string		PC\ Research,\ Inc	group 3 fax data
37468349Sobrien>29	byte		0		\b, normal resolution (204x98 DPI)
37568349Sobrien>29	byte		1		\b, fine resolution (204x196 DPI)
376110949Sobrien# From: Herbert Rosmanith <herp@wildsau.idv.uni.linz.at>
377110949Sobrien0	string		Sfff		structured fax file
37868349Sobrien
379267843Sdelphij# From: Joerg Jenderek <joerg.jen.der.ek@gmx.net>
380267843Sdelphij# most files with the extension .EPA and some with .BMP
381267843Sdelphij0	string		\x11\x06	Award BIOS Logo, 136 x 84
382267843Sdelphij!:mime	image/x-award-bioslogo
383267843Sdelphij0	string		\x11\x09	Award BIOS Logo, 136 x 126
384267843Sdelphij!:mime	image/x-award-bioslogo
385267843Sdelphij#0	string		\x07\x1f	BIOS Logo corrupted?
386267843Sdelphij# http://www.blackfiveservices.co.uk/awbmtools.shtml
387267843Sdelphij# http://biosgfx.narod.ru/v3/
388267843Sdelphij# http://biosgfx.narod.ru/abr-2/
389267843Sdelphij0	string		AWBM		
390267843Sdelphij>4	leshort		<1981		Award BIOS bitmap
391267843Sdelphij!:mime	image/x-award-bmp
392267843Sdelphij# image width is a multiple of 4
393267843Sdelphij>>4	leshort&0x0003	0		
394267843Sdelphij>>>4		leshort	x		\b, %d
395267843Sdelphij>>>6		leshort	x		x %d
396267843Sdelphij>>4	leshort&0x0003	>0		\b,
397267843Sdelphij>>>4	leshort&0x0003	=1		
398267843Sdelphij>>>>4		leshort	x		%d+3
399267843Sdelphij>>>4	leshort&0x0003	=2		
400267843Sdelphij>>>>4		leshort	x		%d+2
401267843Sdelphij>>>4	leshort&0x0003	=3		
402267843Sdelphij>>>>4		leshort	x		%d+1
403267843Sdelphij>>>6		leshort	x		x %d
404267843Sdelphij# at offset 8 starts imagedata followed by "RGB " marker
405110949Sobrien
406186690Sobrien# PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
407267843Sdelphij# http://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.\
408267843Sdelphij# 28bitmap_information_header.29
409186690Sobrien0	string		BM
410186690Sobrien>14	leshort		12		PC bitmap, OS/2 1.x format
411186690Sobrien!:mime	image/x-ms-bmp
41268349Sobrien>>18	leshort		x		\b, %d x
41368349Sobrien>>20	leshort		x		%d
414186690Sobrien>14	leshort		64		PC bitmap, OS/2 2.x format
415186690Sobrien!:mime	image/x-ms-bmp
41668349Sobrien>>18	leshort		x		\b, %d x
41768349Sobrien>>20	leshort		x		%d
418186690Sobrien>14	leshort		40		PC bitmap, Windows 3.x format
419186690Sobrien!:mime	image/x-ms-bmp
42068349Sobrien>>18	lelong		x		\b, %d x
42168349Sobrien>>22	lelong		x		%d x
42268349Sobrien>>28	leshort		x		%d
423267843Sdelphij>14	leshort		124		PC bitmap, Windows 98/2000 and newer format
424267843Sdelphij!:mime	image/x-ms-bmp
425267843Sdelphij>>18	lelong		x		\b, %d x
426267843Sdelphij>>22	lelong		x		%d x
427267843Sdelphij>>28	leshort		x		%d
428267843Sdelphij>14	leshort		108		PC bitmap, Windows 95/NT4 and newer format
429267843Sdelphij!:mime	image/x-ms-bmp
430267843Sdelphij>>18	lelong		x		\b, %d x
431267843Sdelphij>>22	lelong		x		%d x
432267843Sdelphij>>28	leshort		x		%d
433186690Sobrien>14	leshort		128		PC bitmap, Windows NT/2000 format
434186690Sobrien!:mime	image/x-ms-bmp
435186690Sobrien>>18	lelong		x		\b, %d x
436186690Sobrien>>22	lelong		x		%d x
437186690Sobrien>>28	leshort		x		%d
438133359Sobrien# Too simple - MPi
439133359Sobrien#0	string		IC		PC icon data
440133359Sobrien#0	string		PI		PC pointer image data
441133359Sobrien#0	string		CI		PC color icon data
442133359Sobrien#0	string		CP		PC color pointer image data
44368349Sobrien# Conflicts with other entries [BABYL]
44468349Sobrien#0	string		BA		PC bitmap array data
44568349Sobrien
44668349Sobrien# XPM icons (Greg Roelofs, newt@uchicago.edu)
447186690Sobrien0	search/1	/*\ XPM\ */	X pixmap image text
448234250Sobrien!:mime	image/x-xpmi
44968349Sobrien
45068349Sobrien# Utah Raster Toolkit RLE images (janl@ifi.uio.no)
45168349Sobrien0	leshort		0xcc52		RLE image data,
45268349Sobrien>6	leshort		x		%d x
45368349Sobrien>8	leshort		x		%d
45468349Sobrien>2	leshort		>0		\b, lower left corner: %d
45568349Sobrien>4	leshort		>0		\b, lower right corner: %d
45668349Sobrien>10	byte&0x1	=0x1		\b, clear first
45768349Sobrien>10	byte&0x2	=0x2		\b, no background
45868349Sobrien>10	byte&0x4	=0x4		\b, alpha channel
45968349Sobrien>10	byte&0x8	=0x8		\b, comment
46068349Sobrien>11	byte		>0		\b, %d color channels
46168349Sobrien>12	byte		>0		\b, %d bits per pixel
46268349Sobrien>13	byte		>0		\b, %d color map channels
46368349Sobrien
46468349Sobrien# image file format (Robert Potter, potter@cs.rochester.edu)
46568349Sobrien0	string		Imagefile\ version-	iff image data
46668349Sobrien# this adds the whole header (inc. version number), informative but longish
46768349Sobrien>10	string		>\0		%s
46868349Sobrien
46968349Sobrien# Sun raster images, from Daniel Quinlan (quinlan@yggdrasil.com)
47068349Sobrien0	belong		0x59a66a95	Sun raster image data
47168349Sobrien>4	belong		>0		\b, %d x
47268349Sobrien>8	belong		>0		%d,
47368349Sobrien>12	belong		>0		%d-bit,
47468349Sobrien#>16	belong		>0		%d bytes long,
47568349Sobrien>20	belong		0		old format,
47668349Sobrien#>20	belong		1		standard,
47768349Sobrien>20	belong		2		compressed,
47868349Sobrien>20	belong		3		RGB,
47968349Sobrien>20	belong		4		TIFF,
48068349Sobrien>20	belong		5		IFF,
48168349Sobrien>20	belong		0xffff		reserved for testing,
48268349Sobrien>24	belong		0		no colormap
48368349Sobrien>24	belong		1		RGB colormap
48468349Sobrien>24	belong		2		raw colormap
48568349Sobrien#>28	belong		>0		colormap is %d bytes long
48668349Sobrien
48768349Sobrien# SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
48868349Sobrien#
48968349Sobrien# See
49068349Sobrien#	http://reality.sgi.com/grafica/sgiimage.html
49168349Sobrien#
49268349Sobrien0	beshort		474		SGI image data
49368349Sobrien#>2	byte		0		\b, verbatim
49468349Sobrien>2	byte		1		\b, RLE
49568349Sobrien#>3	byte		1		\b, normal precision
49668349Sobrien>3	byte		2		\b, high precision
49768349Sobrien>4	beshort		x		\b, %d-D
49868349Sobrien>6	beshort		x		\b, %d x
49968349Sobrien>8	beshort		x		%d
50068349Sobrien>10	beshort		x		\b, %d channel
50168349Sobrien>10	beshort		!1		\bs
50268349Sobrien>80	string		>0		\b, "%s"
50368349Sobrien
50468349Sobrien0	string		IT01		FIT image data
50568349Sobrien>4	belong		x		\b, %d x
50668349Sobrien>8	belong		x		%d x
50768349Sobrien>12	belong		x		%d
50868349Sobrien#
50968349Sobrien0	string		IT02		FIT image data
51068349Sobrien>4	belong		x		\b, %d x
51168349Sobrien>8	belong		x		%d x
51268349Sobrien>12	belong		x		%d
51368349Sobrien#
51468349Sobrien2048	string		PCD_IPI		Kodak Photo CD image pack file
51584685Sobrien>0xe02	byte&0x03	0x00		, landscape mode
51684685Sobrien>0xe02	byte&0x03	0x01		, portrait mode
51784685Sobrien>0xe02	byte&0x03	0x02		, landscape mode
51884685Sobrien>0xe02	byte&0x03	0x03		, portrait mode
51968349Sobrien0	string		PCD_OPA		Kodak Photo CD overview pack file
52068349Sobrien
52168349Sobrien# FITS format.  Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
52268349Sobrien# FITS is the Flexible Image Transport System, the de facto standard for
52368349Sobrien# data and image transfer, storage, etc., for the astronomical community.
52468349Sobrien# (FITS floating point formats are big-endian.)
52568349Sobrien0	string	SIMPLE\ \ =	FITS image data
52668349Sobrien>109	string	8		\b, 8-bit, character or unsigned binary integer
52768349Sobrien>108	string	16		\b, 16-bit, two's complement binary integer
52868349Sobrien>107	string	\ 32		\b, 32-bit, two's complement binary integer
52968349Sobrien>107	string	-32		\b, 32-bit, floating point, single precision
53068349Sobrien>107	string	-64		\b, 64-bit, floating point, double precision
53168349Sobrien
53268349Sobrien# other images
53368349Sobrien0	string	This\ is\ a\ BitMap\ file	Lisp Machine bit-array-file
53468349Sobrien
53568349Sobrien# From SunOS 5.5.1 "/etc/magic" - appeared right before Sun raster image
53668349Sobrien# stuff.
53768349Sobrien#
53868349Sobrien0	beshort		0x1010		PEX Binary Archive
53968349Sobrien
54068349Sobrien# DICOM medical imaging data
54168349Sobrien128	string	DICM			DICOM medical imaging data
542186690Sobrien!:mime	application/dicom
54374784Sobrien
544133359Sobrien# XWD - X Window Dump file.
54574784Sobrien#   As described in /usr/X11R6/include/X11/XWDFile.h
54674784Sobrien#   used by the xwd program.
54774784Sobrien#   Bradford Castalia, idaeim, 1/01
548226048Sobrien#   updated by Adam Buchbinder, 2/09
549226048Sobrien# The following assumes version 7 of the format; the first long is the length
550226048Sobrien# of the header, which is at least 25 4-byte longs, and the one at offset 8
551226048Sobrien# is a constant which is always either 1 or 2. Offset 12 is the pixmap depth,
552226048Sobrien# which is a maximum of 32.
553226048Sobrien0	belong	>100
554226048Sobrien>8	belong	<3
555226048Sobrien>>12	belong	<33
556226048Sobrien>>>4	belong	7			XWD X Window Dump image data
557226048Sobrien!:mime	image/x-xwindowdump
558226048Sobrien>>>>100	string	>\0			\b, "%s"
559226048Sobrien>>>>16	belong	x			\b, %dx
560226048Sobrien>>>>20	belong	x			\b%dx
561226048Sobrien>>>>12	belong	x			\b%d
56274784Sobrien
56374784Sobrien# PDS - Planetary Data System
56474784Sobrien#   These files use Parameter Value Language in the header section.
56574784Sobrien#   Unfortunately, there is no certain magic, but the following
56674784Sobrien#   strings have been found to be most likely.
56774784Sobrien0	string	NJPL1I00		PDS (JPL) image data
56874784Sobrien2	string	NJPL1I			PDS (JPL) image data
56974784Sobrien0	string	CCSD3ZF			PDS (CCSD) image data
57074784Sobrien2	string	CCSD3Z			PDS (CCSD) image data
57174784Sobrien0	string	PDS_			PDS image data
57274784Sobrien0	string	LBLSIZE=		PDS (VICAR) image data
57374784Sobrien
57474784Sobrien# pM8x: ATARI STAD compressed bitmap format
57574784Sobrien#
57674784Sobrien# from Oskar Schirmer <schirmer@scara.com> Feb 2, 2001
57774784Sobrien# p M 8 5/6 xx yy zz data...
57874784Sobrien# Atari ST STAD bitmap is always 640x400, bytewise runlength compressed.
57974784Sobrien# bytes either run horizontally (pM85) or vertically (pM86). yy is the
58074784Sobrien# most frequent byte, xx and zz are runlength escape codes, where xx is
58174784Sobrien# used for runs of yy.
58274784Sobrien#
58374784Sobrien0	string	pM85		Atari ST STAD bitmap image data (hor)
58474784Sobrien>5	byte	0x00		(white background)
58574784Sobrien>5	byte	0xFF		(black background)
58674784Sobrien0	string	pM86		Atari ST STAD bitmap image data (vert)
58774784Sobrien>5	byte	0x00		(white background)
58874784Sobrien>5	byte	0xFF		(black background)
58980588Sobrien
590267843Sdelphij# Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
591169962Sobrien# http://www.atarimax.com/jindroush.atari.org/afmtatr.html
592169962Sobrien0	leshort	0x0296		Atari ATR image
593169962Sobrien
59484685Sobrien# XXX:
59584685Sobrien# This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
59684685Sobrien# magic.
59780588Sobrien# SGI RICE image file <mpruett@sgi.com>
59884685Sobrien#0	beshort	0x5249		RICE image
59984685Sobrien#>2	beshort	x		v%d
60084685Sobrien#>4	beshort	x		(%d x
60184685Sobrien#>6	beshort	x		%d)
60284685Sobrien#>8	beshort	0		8 bit
60384685Sobrien#>8	beshort	1		10 bit
60484685Sobrien#>8	beshort	2		12 bit
60584685Sobrien#>8	beshort	3		13 bit
60684685Sobrien#>10	beshort	0		4:2:2
60784685Sobrien#>10	beshort	1		4:2:2:4
60884685Sobrien#>10	beshort	2		4:4:4
60984685Sobrien#>10	beshort	3		4:4:4:4
61084685Sobrien#>12	beshort	1		RGB
61184685Sobrien#>12	beshort	2		CCIR601
61284685Sobrien#>12	beshort	3		RP175
61384685Sobrien#>12	beshort	4		YUV
61484685Sobrien
615110949Sobrien# PCX image files
616110949Sobrien# From: Dan Fandrich <dan@coneharvesters.com>
617267843Sdelphij# updated by Joerg Jenderek at Feb 2013 by http://de.wikipedia.org/wiki/PCX
618267843Sdelphij# http://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
619267843Sdelphij# GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
620267843Sdelphij# test for bytes 0x0a,version byte (0,2,3,4,5),compression byte flag(0,1), bit depth (>0) of PCX or T5.DBT,T6.DBT
621267843Sdelphij0	ubelong&0xffF8fe00	0x0a000000	
622267843Sdelphij# for PCX bit depth > 0 
623267843Sdelphij>3	ubyte		>0	
624267843Sdelphij# test for valid versions
625267843Sdelphij>>1	ubyte		<6	
626267843Sdelphij>>>1	ubyte		!1	PCX
627267843Sdelphij!:mime	image/x-pcx
628267843Sdelphij#!:mime	image/pcx
629267843Sdelphij>>>>1	ubyte		0	ver. 2.5 image data
630267843Sdelphij>>>>1	ubyte		2	ver. 2.8 image data, with palette
631267843Sdelphij>>>>1	ubyte		3	ver. 2.8 image data, without palette
632267843Sdelphij>>>>1	ubyte		4	for Windows image data
633267843Sdelphij>>>>1	ubyte		5	ver. 3.0 image data
634267843Sdelphij>>>>4	uleshort	x	bounding box [%d,
635267843Sdelphij>>>>6	uleshort	x	%d] -
636267843Sdelphij>>>>8	uleshort	x	[%d,
637267843Sdelphij>>>>10	uleshort	x	%d],
638267843Sdelphij>>>>65	ubyte		>1	%d planes each of
639267843Sdelphij>>>>3	ubyte		x	%d-bit
640267843Sdelphij>>>>68	byte		1	colour,
641267843Sdelphij>>>>68	byte		2	grayscale,
642267843Sdelphij# this should not happen
643267843Sdelphij>>>>68	default		x	image,
644267843Sdelphij>>>>12	leshort		>0	%d x
645267843Sdelphij>>>>>14	uleshort	x	%d dpi,
646267843Sdelphij>>>>2	byte		0	uncompressed
647267843Sdelphij>>>>2	byte		1	RLE compressed
648133359Sobrien
649133359Sobrien# Adobe Photoshop
650226048Sobrien# From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
651133359Sobrien0	string		8BPS Adobe Photoshop Image
652186690Sobrien!:mime	image/vnd.adobe.photoshop
653226048Sobrien>4   beshort 2 (PSB)
654226048Sobrien>18  belong  x \b, %d x
655226048Sobrien>14  belong  x %d,
656226048Sobrien>24  beshort 0 bitmap
657226048Sobrien>24  beshort 1 grayscale
658226048Sobrien>>12 beshort 2 with alpha
659226048Sobrien>24  beshort 2 indexed
660226048Sobrien>24  beshort 3 RGB
661226048Sobrien>>12 beshort 4 \bA
662226048Sobrien>24  beshort 4 CMYK
663226048Sobrien>>12 beshort 5 \bA
664226048Sobrien>24  beshort 7 multichannel
665226048Sobrien>24  beshort 8 duotone
666226048Sobrien>24  beshort 9 lab
667226048Sobrien>12  beshort > 1
668226048Sobrien>>12  beshort x \b, %dx
669226048Sobrien>12  beshort 1 \b,
670226048Sobrien>22  beshort x %d-bit channel
671226048Sobrien>12  beshort > 1 \bs
672133359Sobrien
673133359Sobrien# XV thumbnail indicator (ThMO)
674133359Sobrien0	string		P7\ 332		XV thumbnail image data
675133359Sobrien
676133359Sobrien# NITF is defined by United States MIL-STD-2500A
677133359Sobrien0	string	NITF	National Imagery Transmission Format
678133359Sobrien>25	string	>\0	dated %.14s
679133359Sobrien
680133359Sobrien# GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
681133359Sobrien0	belong		0x00010008	GEM Image data
682133359Sobrien>12	beshort		x		%d x
683133359Sobrien>14	beshort		x		%d,
684133359Sobrien>4	beshort		x		%d planes,
685133359Sobrien>8	beshort		x		%d x
686133359Sobrien>10	beshort		x		%d pixelsize
687133359Sobrien
688133359Sobrien# GEM Metafile (Wolfram Kleff)
689133359Sobrien0	lelong		0x0018FFFF	GEM Metafile data
690133359Sobrien>4	leshort		x		version %d
691133359Sobrien
692133359Sobrien#
693133359Sobrien# SMJPEG. A custom Motion JPEG format used by Loki Entertainment
694133359Sobrien# Software Torbjorn Andersson <d91tan@Update.UU.SE>.
695133359Sobrien#
696133359Sobrien0	string	\0\nSMJPEG	SMJPEG
697133359Sobrien>8	belong	x		%d.x data
698133359Sobrien# According to the specification you could find any number of _TXT
699133359Sobrien# headers here, but I can't think of any way of handling that. None of
700133359Sobrien# the SMJPEG files I tried it on used this feature. Even if such a
701133359Sobrien# file is encountered the output should still be reasonable.
702133359Sobrien>16	string	_SND		\b,
703133359Sobrien>>24	beshort	>0		%d Hz
704133359Sobrien>>26	byte	8		8-bit
705133359Sobrien>>26	byte	16		16-bit
706133359Sobrien>>28	string	NONE		uncompressed
707133359Sobrien# >>28	string	APCM		ADPCM compressed
708133359Sobrien>>27	byte	1		mono
709133359Sobrien>>28	byte	2		stereo
710133359Sobrien# Help! Isn't there any way to avoid writing this part twice?
711133359Sobrien>>32	string	_VID		\b,
712133359Sobrien# >>>48	string	JFIF		JPEG
713133359Sobrien>>>40	belong	>0		%d frames
714133359Sobrien>>>44	beshort	>0		(%d x
715133359Sobrien>>>46	beshort	>0		%d)
716133359Sobrien>16	string	_VID		\b,
717133359Sobrien# >>32	string	JFIF		JPEG
718133359Sobrien>>24	belong	>0		%d frames
719133359Sobrien>>28	beshort	>0		(%d x
720133359Sobrien>>30	beshort	>0		%d)
721133359Sobrien
722133359Sobrien0	string	Paint\ Shop\ Pro\ Image\ File	Paint Shop Pro Image File
723133359Sobrien
724133359Sobrien# "thumbnail file" (icon)
725133359Sobrien# descended from "xv", but in use by other applications as well (Wolfram Kleff)
726133359Sobrien0       string          P7\ 332         XV "thumbnail file" (icon) data
727133359Sobrien
728133359Sobrien# taken from fkiss: (<yav@mte.biglobe.ne.jp> ?)
729133359Sobrien0       string          KiSS            KISS/GS
730133359Sobrien>4      byte            16              color
731133359Sobrien>>5     byte            x               %d bit
732133359Sobrien>>8     leshort         x               %d colors
733133359Sobrien>>10    leshort         x               %d groups
734133359Sobrien>4      byte            32              cell
735133359Sobrien>>5     byte            x               %d bit
736133359Sobrien>>8     leshort         x               %d x
737133359Sobrien>>10    leshort         x               %d
738133359Sobrien>>12    leshort         x               +%d
739133359Sobrien>>14    leshort         x               +%d
740133359Sobrien
741133359Sobrien# Webshots (www.webshots.com), by John Harrison
742133359Sobrien0       string          C\253\221g\230\0\0\0 Webshots Desktop .wbz file
743133359Sobrien
744133359Sobrien# Hercules DASD image files
745133359Sobrien# From Jan Jaeger <jj@septa.nl>
746133359Sobrien0       string  CKD_P370        Hercules CKD DASD image file
747133359Sobrien>8      long    x               \b, %d heads per cylinder
748133359Sobrien>12     long    x               \b, track size %d bytes
749133359Sobrien>16     byte    x               \b, device type 33%2.2X
750133359Sobrien
751133359Sobrien0       string  CKD_C370        Hercules compressed CKD DASD image file
752133359Sobrien>8      long    x               \b, %d heads per cylinder
753133359Sobrien>12     long    x               \b, track size %d bytes
754133359Sobrien>16     byte    x               \b, device type 33%2.2X
755133359Sobrien
756133359Sobrien0       string  CKD_S370        Hercules CKD DASD shadow file
757133359Sobrien>8      long    x               \b, %d heads per cylinder
758133359Sobrien>12     long    x               \b, track size %d bytes
759133359Sobrien>16     byte    x               \b, device type 33%2.2X
760133359Sobrien
761186690Sobrien# Squeak images and programs - etoffi@softhome.net
762186690Sobrien0	string		\146\031\0\0	Squeak image data
763186690Sobrien0	search/1	'From\040Squeak	Squeak program text
764133359Sobrien
765133359Sobrien# partimage: file(1) magic for PartImage files (experimental, incomplete)
766133359Sobrien# Author: Hans-Joachim Baader <hjb@pro-linux.de>
767133359Sobrien0		string	PaRtImAgE-VoLuMe	PartImage
768133359Sobrien>0x0020		string	0.6.1		file version %s
769267843Sdelphij>>0x0060	lelong	>-1		volume %d
770133359Sobrien#>>0x0064 8 byte identifier
771133359Sobrien#>>0x007c reserved
772133359Sobrien>>0x0200	string	>\0		type %s
773133359Sobrien>>0x1400	string	>\0		device %s,
774133359Sobrien>>0x1600	string	>\0		original filename %s,
775133359Sobrien# Some fields omitted
776133359Sobrien>>0x2744	lelong	0		not compressed
777133359Sobrien>>0x2744	lelong	1		gzip compressed
778133359Sobrien>>0x2744	lelong	2		bzip2 compressed
779133359Sobrien>>0x2744	lelong	>2		compressed with unknown algorithm
780133359Sobrien>0x0020		string	>0.6.1		file version %s
781133359Sobrien>0x0020		string	<0.6.1		file version %s
782133359Sobrien
783133359Sobrien# DCX is multi-page PCX, using a simple header of up to 1024
784133359Sobrien# offsets for the respective PCX components.
785133359Sobrien# From: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
786133359Sobrien0	lelong	987654321	DCX multi-page PCX image data
787133359Sobrien
788133359Sobrien# Simon Walton <simonw@matteworld.com>
789133359Sobrien# Kodak Cineon format for scanned negatives
790133359Sobrien# http://www.kodak.com/US/en/motion/support/dlad/
791133359Sobrien0	lelong  0xd75f2a80	Cineon image data
792267843Sdelphij>200	belong  >0		\b, %d x
793267843Sdelphij>204	belong  >0		%d
794133359Sobrien
795133359Sobrien
796133359Sobrien# Bio-Rad .PIC is an image format used by microscope control systems
797133359Sobrien# and related image processing software used by biologists.
798133359Sobrien# From: Vebjorn Ljosa <vebjorn@ljosa.com>
799226048Sobrien# BOOL values are two-byte integers; use them to rule out false positives.
800226048Sobrien# http://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
801226048Sobrien# Samples: http://www.loci.wisc.edu/software/sample-data
802226048Sobrien14	leshort <2
803226048Sobrien>62	leshort <2
804226048Sobrien>>54	leshort 12345		Bio-Rad .PIC Image File
805267843Sdelphij>>>0	leshort >0		%d x
806267843Sdelphij>>>2	leshort >0		%d,
807226048Sobrien>>>4	leshort =1		1 image in file
808267843Sdelphij>>>4	leshort >1		%d images in file
809133359Sobrien
810133359Sobrien# From Jan "Yenya" Kasprzak <kas@fi.muni.cz>
811133359Sobrien# The description of *.mrw format can be found at
812133359Sobrien# http://www.dalibor.cz/minolta/raw_file_format.htm
813133359Sobrien0	string	\000MRM			Minolta Dimage camera raw image data
814133359Sobrien
815186690Sobrien# Summary: DjVu image / document
816186690Sobrien# Extension: .djvu
817186690Sobrien# Reference: http://djvu.org/docs/DjVu3Spec.djvu
818186690Sobrien# Submitted by: Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
819186690Sobrien# Modified by (1): Abel Cheung <abelcheung@gmail.com>
820186690Sobrien0	string	AT&TFORM
821226048Sobrien>12	string	DJVM		DjVu multiple page document
822186690Sobrien!:mime	image/vnd.djvu
823186690Sobrien>12	string	DJVU		DjVu image or single page document
824226048Sobrien!:mime	image/vnd.djvu
825186690Sobrien>12	string	DJVI		DjVu shared document
826226048Sobrien!:mime	image/vnd.djvu
827186690Sobrien>12	string	THUM		DjVu page thumbnails
828226048Sobrien!:mime	image/vnd.djvu
829133359Sobrien
830267843Sdelphij# Originally by Marc Espie
831267843Sdelphij# Modified by Robert Minsk <robertminsk at yahoo.com>
832267843Sdelphij# http://www.openexr.com/openexrfilelayout.pdf
833267843Sdelphij0	lelong		20000630	OpenEXR image data,
834267843Sdelphij!:mime image/x-exr
835267843Sdelphij>4	lelong&0x000000ff x		version %d,
836267843Sdelphij>4	lelong		^0x00000200	storage: scanline
837267843Sdelphij>4	lelong		&0x00000200	storage: tiled
838267843Sdelphij>8	search/0x1000	compression\0	\b, compression:
839267843Sdelphij>>&16	byte		0		none
840267843Sdelphij>>&16	byte		1		rle
841267843Sdelphij>>&16	byte		2		zips
842267843Sdelphij>>&16	byte		3		zip
843267843Sdelphij>>&16	byte		4		piz
844267843Sdelphij>>&16	byte		5		pxr24
845267843Sdelphij>>&16	byte		6		b44
846267843Sdelphij>>&16	byte		7		b44a
847267843Sdelphij>>&16	byte		>7		unknown
848267843Sdelphij>8	 search/0x1000	dataWindow\0	\b, dataWindow:
849267843Sdelphij>>&10	lelong		x		(%d
850267843Sdelphij>>&14	lelong		x		%d)-
851267843Sdelphij>>&18	lelong		x		\b(%d
852267843Sdelphij>>&22	lelong		x		%d)
853267843Sdelphij>8	search/0x1000	displayWindow\0	\b, displayWindow:
854267843Sdelphij>>&10	lelong		x		(%d
855267843Sdelphij>>&14	lelong		x		%d)-
856267843Sdelphij>>&18	lelong		x		\b(%d
857267843Sdelphij>>&22	lelong		x		%d)
858267843Sdelphij>8	search/0x1000	lineOrder\0	 \b, lineOrder:
859267843Sdelphij>>&14	byte		0		increasing y
860267843Sdelphij>>&14	byte		1		decreasing y
861267843Sdelphij>>&14	byte		2		random y
862267843Sdelphij>>&14	byte		>2		unknown
863133359Sobrien
864267843Sdelphij# SMPTE Digital Picture Exchange Format, SMPTE DPX
865267843Sdelphij#
866267843Sdelphij# ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
867267843Sdelphij# Moving-Picture Exchange (DPX), v1.0, 18 February 1994
868267843Sdelphij# Robert Minsk <robertminsk at yahoo.com>
869267843Sdelphij0	string		SDPX	DPX image data, big-endian,
870267843Sdelphij!:mime image/x-dpx
871267843Sdelphij>768	beshort		<4
872267843Sdelphij>>772	belong		x	%dx
873267843Sdelphij>>776	belong		x	\b%d,
874267843Sdelphij>768	beshort		>3
875267843Sdelphij>>776	belong		x	%dx
876267843Sdelphij>>772	belong		x	\b%d,
877267843Sdelphij>768	beshort		0	left to right/top to bottom
878267843Sdelphij>768	beshort		1	right to left/top to bottom
879267843Sdelphij>768	beshort		2	left to right/bottom to top
880267843Sdelphij>768	beshort		3	right to left/bottom to top
881267843Sdelphij>768	beshort		4	top to bottom/left to right
882267843Sdelphij>768	beshort		5	top to bottom/right to left
883267843Sdelphij>768	leshort		6	bottom to top/left to right
884267843Sdelphij>768	leshort		7	bottom to top/right to left
885133359Sobrien
886133359Sobrien# From: Tom Hilinski <tom.hilinski@comcast.net>
887133359Sobrien# http://www.unidata.ucar.edu/packages/netcdf/
888159764Sobrien0	string	CDF\001			NetCDF Data Format data
889159764Sobrien
890159764Sobrien#-----------------------------------------------------------------------
891159764Sobrien# Hierarchical Data Format, used to facilitate scientific data exchange
892159764Sobrien# specifications at http://hdf.ncsa.uiuc.edu/
893159764Sobrien0	belong	0x0e031301	Hierarchical Data Format (version 4) data
894186690Sobrien!:mime	application/x-hdf
895226048Sobrien0	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) data
896186690Sobrien!:mime	application/x-hdf
897267843Sdelphij512	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 512 bytes user block
898267843Sdelphij!:mime	application/x-hdf
899267843Sdelphij1024	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 1k user block
900267843Sdelphij!:mime	application/x-hdf
901267843Sdelphij2048	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 2k user block
902267843Sdelphij!:mime	application/x-hdf
903267843Sdelphij4096	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 4k user block
904267843Sdelphij!:mime	application/x-hdf
905169942Sobrien
906267843Sdelphij
907169942Sobrien# From: Tobias Burnus <burnus@net-b.de>
908169942Sobrien# Xara (for a while: Corel Xara) is a graphic package, see
909186690Sobrien# http://www.xara.com/ for Windows and as GPL application for Linux
910169942Sobrien0	string	XARA\243\243	Xara graphics file
911186690Sobrien
912186690Sobrien# http://www.cartesianinc.com/Tech/
913186690Sobrien0	string	CPC\262		Cartesian Perceptual Compression image
914186690Sobrien!:mime	image/x-cpi
915186690Sobrien
916186690Sobrien# From Albert Cahalan <acahalan@gmail.com>
917186690Sobrien# puredigital used it for the CVS disposable camcorder
918186690Sobrien#8       lelong  4       ZBM bitmap image data
919186690Sobrien#>4      leshort x       %u x
920186690Sobrien#>6      leshort x       %u
921186690Sobrien
922186690Sobrien# From Albert Cahalan <acahalan@gmail.com>
923186690Sobrien# uncompressed 5:6:5 HighColor image for OLPC XO firmware icons
924186690Sobrien0       string C565     OLPC firmware icon image data
925186690Sobrien>4      leshort x       %u x
926186690Sobrien>6      leshort x       %u
927186690Sobrien
928186690Sobrien# Applied Images - Image files from Cytovision
929186690Sobrien# Gustavo Junior Alves <gjalves@gjalves.com.br>
930186690Sobrien0	string	\xce\xda\xde\xfa	Cytovision Metaphases file
931186690Sobrien0	string	\xed\xad\xef\xac	Cytovision Karyotype file
932186690Sobrien0	string	\x0b\x00\x03\x00	Cytovision FISH Probe file
933186690Sobrien0	string	\xed\xfe\xda\xbe	Cytovision FLEX file
934186690Sobrien0	string	\xed\xab\xed\xfe	Cytovision FLEX file
935186690Sobrien0	string	\xad\xfd\xea\xad	Cytovision RATS file
936186690Sobrien
937186690Sobrien# Wavelet Scalar Quantization format used in gray-scale fingerprint images
938186690Sobrien# From Tano M Fotang <mfotang@quanteq.com>
939186690Sobrien0	string	\xff\xa0\xff\xa8\x00	Wavelet Scalar Quantization image data
940191736Sobrien
941267843Sdelphij# Type:		PCO B16 image files
942267843Sdelphij# URL:		http://www.pco.de/fileadmin/user_upload/db/download/MA_CWDCOPIE_0412b.pdf
943267843Sdelphij# From:		Florian Philipp <florian.philipp@binarywings.net>
944267843Sdelphij# Extension:	.b16
945267843Sdelphij# Description:	Pixel image format produced by PCO Camware, typically used
946267843Sdelphij#		together with PCO cameras.
947267843Sdelphij# Note:		Different versions exist for e.g. 8 bit and 16 bit images.
948267843Sdelphij#		Documentation is incomplete.
949267843Sdelphij0	string/b	PCO-	PCO B16 image data
950267843Sdelphij>12	lelong		x	\b, %dx
951267843Sdelphij>16	lelong		x	\b%d
952267843Sdelphij>20	lelong		0	\b, short header
953267843Sdelphij>20	lelong		-1	\b, extended header
954267843Sdelphij>>24	lelong		0	\b, grayscale
955267843Sdelphij>>>36	lelong		0	linear LUT
956267843Sdelphij>>>36	lelong		1	logarithmic LUT
957267843Sdelphij>>>28	lelong		x	[%d
958267843Sdelphij>>>32	lelong		x	\b,%d]
959267843Sdelphij>>24	lelong		1	\b, color
960267843Sdelphij>>>64	lelong		0	linear LUT
961267843Sdelphij>>>64	lelong		1	logarithmic LUT
962267843Sdelphij>>>40	lelong		x	r[%d
963267843Sdelphij>>>44	lelong		x	\b,%d]
964267843Sdelphij>>>48	lelong		x	g[%d
965267843Sdelphij>>>52	lelong		x	\b,%d]
966267843Sdelphij>>>56	lelong		x	b[%d
967267843Sdelphij>>>60	lelong		x	\b,%d]
968226048Sobrien
969267843Sdelphij# Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
970267843Sdelphij# From: Markus Heidelberg <markus.heidelberg at web.de>
971267843Sdelphij0	string/t	[BitmapInfo2]	Polar Monitor Bitmap text
972267843Sdelphij!:mime	image/x-polar-monitor-bitmap
973267843Sdelphij
974267843Sdelphij# From: Rick Richardson <rickrich@gmail.com>
975226048Sobrien0	string	GARMIN\ BITMAP\ 01	Garmin Bitmap file
976226048Sobrien
977226048Sobrien# Type:	Ulead Photo Explorer5 (.pe5)
978226048Sobrien# URL:	http://www.jisyo.com/cgibin/view.cgi?EXT=pe5 (Japanese)
979226048Sobrien# From:	Simon Horman <horms@debian.org>
980226048Sobrien0	string	IIO2H			Ulead Photo Explorer5
981226048Sobrien
982226048Sobrien# Type:	X11 cursor
983226048Sobrien# URL:	http://webcvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?view=markup
984226048Sobrien# From:	Mathias Brodala <info@noctus.net>
985226048Sobrien0	string	Xcur			X11 cursor
986226048Sobrien
987226048Sobrien# Type:	Olympus ORF raw images.
988226048Sobrien# URL:	http://libopenraw.freedesktop.org/wiki/Olympus_ORF
989226048Sobrien# From:	Adam Buchbinder <adam.buchbinder@gmail.com>
990226048Sobrien0	string		MMOR		Olympus ORF raw image data, big-endian
991226048Sobrien!:mime	image/x-olympus-orf
992226048Sobrien0	string		IIRO		Olympus ORF raw image data, little-endian
993226048Sobrien!:mime	image/x-olympus-orf
994226048Sobrien0	string		IIRS		Olympus ORF raw image data, little-endian
995226048Sobrien!:mime	image/x-olympus-orf
996226048Sobrien
997226048Sobrien# Type: files used in modern AVCHD camcoders to store clip information
998226048Sobrien# Extension: .cpi
999226048Sobrien# From: Alexander Danilov <alexander.a.danilov@gmail.com>
1000226048Sobrien0	string	HDMV0100	AVCHD Clip Information
1001226048Sobrien
1002226048Sobrien# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1003226048Sobrien# URL: http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
1004226048Sobrien# Radiance HDR; usually has .pic or .hdr extension.
1005226048Sobrien0	string	#?RADIANCE\n	Radiance HDR image data
1006226048Sobrien#!mime	image/vnd.radiance
1007226048Sobrien
1008226048Sobrien# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1009226048Sobrien# URL: http://www.mpi-inf.mpg.de/resources/pfstools/pfs_format_spec.pdf
1010226048Sobrien# Used by the pfstools packages. The regex matches for the image size could
1011226048Sobrien# probably use some work. The MIME type is made up; if there's one in
1012226048Sobrien# actual common use, it should replace the one below.
1013226048Sobrien0	string	PFS1\x0a	PFS HDR image data
1014226048Sobrien#!mime	image/x-pfs
1015226048Sobrien>1	regex	[0-9]*\ 		\b, %s
1016226048Sobrien>>1	regex	\ [0-9]{4}		\bx%s
1017226048Sobrien
1018226048Sobrien# Type: Foveon X3F
1019226048Sobrien# URL:  http://www.photofo.com/downloads/x3f-raw-format.pdf
1020226048Sobrien# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1021226048Sobrien# Note that the MIME type isn't defined anywhere that I can find; if
1022226048Sobrien# there's a canonical type for this format, it should replace this one.
1023226048Sobrien0	string	FOVb	Foveon X3F raw image data
1024226048Sobrien!:mime	image/x-x3f
1025226048Sobrien>6	leshort	x	\b, version %d.
1026226048Sobrien>4	leshort	x	\b%d
1027226048Sobrien>28	lelong	x	\b, %dx
1028226048Sobrien>32	lelong	x	\b%d
1029226048Sobrien
1030226048Sobrien# Paint.NET file
1031226048Sobrien# From Adam Buchbinder <adam.buchbinder@gmail.com>
1032226048Sobrien0	string	PDN3	Paint.NET image data
1033226048Sobrien!:mime	image/x-paintnet
1034226048Sobrien
1035226048Sobrien# Not really an image.
1036226048Sobrien# From: "Tano M. Fotang" <mfotang@quanteq.com>
1037226048Sobrien0	string	\x46\x4d\x52\x00	ISO/IEC 19794-2 Format Minutiae Record (FMR)
1038267843Sdelphij
1039267843Sdelphij# WEBP https://developers.google.com/speed/webp/docs/riff_container
1040284193Sdelphij#0	string	RIFF
1041284193Sdelphij#>8	string	WEBP	Web/P image data
1042284193Sdelphij#>>4	lelong	x	\b, %d bytes
1043284193Sdelphij
1044284193Sdelphij# doc: http://www.shikino.co.jp/eng/products/images/FLOWER.jpg.zip
1045284193Sdelphij# example: http://www.shikino.co.jp/eng/products/images/FLOWER.wdp.zip
1046284193Sdelphij90	bequad		0x574D50484F544F00	JPEG-XR Image
1047284193Sdelphij>98	byte&0x08	=0x08			\b, hard tiling
1048284193Sdelphij>99	byte&0x80	=0x80			\b, tiling present
1049284193Sdelphij>99	byte&0x40	=0x40			\b, codestream present
1050284193Sdelphij>99	byte&0x38	x			\b, spatial xform=
1051284193Sdelphij>99	byte&0x38	0x00			\bTL
1052284193Sdelphij>99	byte&0x38	0x08			\bBL
1053284193Sdelphij>99	byte&0x38	0x10			\bTR
1054284193Sdelphij>99	byte&0x38	0x18			\bBR
1055284193Sdelphij>99	byte&0x38	0x20			\bBT
1056284193Sdelphij>99	byte&0x38	0x28			\bRB
1057284193Sdelphij>99	byte&0x38	0x30			\bLT
1058284193Sdelphij>99	byte&0x38	0x38			\bLB
1059284193Sdelphij>100	byte&0x80	=0x80			\b, short header
1060284193Sdelphij>>102	beshort+1	x			\b, %d
1061284193Sdelphij>>104	beshort+1	x			\bx%d
1062284193Sdelphij>100	byte&0x80	=0x00			\b, long header
1063284193Sdelphij>>102	belong+1	x			\b, %x
1064284193Sdelphij>>106	belong+1	x			\bx%x
1065284193Sdelphij>101	beshort&0xf	x			\b, bitdepth=
1066284193Sdelphij>>101	beshort&0xf	0x0			\b1-WHITE=1
1067284193Sdelphij>>101	beshort&0xf	0x1			\b8
1068284193Sdelphij>>101	beshort&0xf	0x2			\b16
1069284193Sdelphij>>101	beshort&0xf	0x3			\b16-SIGNED
1070284193Sdelphij>>101	beshort&0xf	0x4			\b16-FLOAT
1071284193Sdelphij>>101	beshort&0xf	0x5			\b(reserved 5)
1072284193Sdelphij>>101	beshort&0xf	0x6			\b32-SIGNED
1073284193Sdelphij>>101	beshort&0xf	0x7			\b32-FLOAT
1074284193Sdelphij>>101	beshort&0xf	0x8			\b5
1075284193Sdelphij>>101	beshort&0xf	0x9			\b10
1076284193Sdelphij>>101	beshort&0xf	0xa			\b5-6-5
1077284193Sdelphij>>101	beshort&0xf	0xb			\b(reserved %d)
1078284193Sdelphij>>101	beshort&0xf	0xc			\b(reserved %d)
1079284193Sdelphij>>101	beshort&0xf	0xd			\b(reserved %d)
1080284193Sdelphij>>101	beshort&0xf	0xe			\b(reserved %d)
1081284193Sdelphij>>101	beshort&0xf	0xf			\b1-BLACK=1
1082284193Sdelphij>101	beshort&0xf0	x			\b, colorfmt=
1083284193Sdelphij>>101	beshort&0xf0	0x00			\bYONLY
1084284193Sdelphij>>101	beshort&0xf0	0x10			\bYUV240
1085284193Sdelphij>>101	beshort&0xf0	0x20			\bYWV422
1086284193Sdelphij>>101	beshort&0xf0	0x30			\bYWV444
1087284193Sdelphij>>101	beshort&0xf0	0x40			\bCMYK
1088284193Sdelphij>>101	beshort&0xf0	0x50			\bCMYKDIRECT
1089284193Sdelphij>>101	beshort&0xf0	0x60			\bNCOMPONENT
1090284193Sdelphij>>101	beshort&0xf0	0x70			\bRGB
1091284193Sdelphij>>101	beshort&0xf0	0x80			\bRGBE
1092284193Sdelphij>>101	beshort&0xf0	>0x80			\b(reserved 0x%x)
1093284193Sdelphij
1094284193Sdelphij# From: Johan van der Knijff <johan.vanderknijff@kb.nl>
1095284193Sdelphij#
1096284193Sdelphij# BPG (Better Portable Graphics) format
1097284193Sdelphij# http://bellard.org/bpg/
1098284193Sdelphij# http://fileformats.archiveteam.org/wiki/BPG
1099284193Sdelphij#
1100284193Sdelphij0	string	\x42\x50\x47\xFB	BPG (Better Portable Graphics)
1101284193Sdelphij!:mime  image/bpg
1102