]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/file/magic/Magdir/images
Update llvm to trunk r290819 and resolve conflicts.
[FreeBSD/FreeBSD.git] / contrib / file / magic / Magdir / images
1
2 #------------------------------------------------------------------------------
3 # $File: images,v 1.117 2016/07/05 19:12:21 christos Exp $
4 # images:  file(1) magic for image formats (see also "iff", and "c-lang" for
5 # XPM bitmaps)
6 #
7 # originally from jef@helios.ee.lbl.gov (Jef Poskanzer),
8 # additions by janl@ifi.uio.no as well as others. Jan also suggested
9 # merging several one- and two-line files into here.
10 #
11 # little magic: PCX (first byte is 0x0a)
12
13 # Targa - matches `povray', `ppmtotga' and `xv' outputs
14 # by Philippe De Muyter <phdm@macqel.be>
15 # URL: http://justsolve.archiveteam.org/wiki/TGA
16 # Reference: http://www.dca.fee.unicamp.br/~martino/disciplinas/ea978/tgaffs.pdf
17 # Update: Joerg Jenderek
18 # at 2, byte ImgType must be 1, 2, 3, 9, 10 or 11
19 #       ,32 or 33 (both not observed)
20 # at 1, byte CoMapType must be 1 if ImgType is 1 or 9, 0 otherwise
21 #       or theoretically 2-128 reserved for use by Truevision or 128-255 may be used for developer applications
22 # at 3, leshort Index is 0 for povray, ppmtotga and xv outputs
23 # `xv' recognizes only a subset of the following (RGB with pixelsize = 24)
24 # `tgatoppm' recognizes a superset (Index may be anything)
25 #
26 # test of Color Map Type 0~no 1~color map
27 # and Image Type 1 2 3 9 10 11 32 33
28 # and Color Map Entry Size 0 15 16 24 32
29 0       ubequad&0x00FeC400000000C0      0       
30 # skip more garbage by looking for positive image type
31 >2      ubyte                   >0              
32 # skip some compiled terminfo by looking for image type less equal 33
33 >>2     ubyte                   <34             
34 # skip arches.3200 , Finder.Root , Slp.1 by looking for low pixel sizes 15 16 24 32
35 >>>16   ubyte                   <33             
36 # skip more by looking for pixel size 0Fh 10h 18h 20h
37 >>>>16  ubyte&0xC0              0x00    
38 # skip 260-16.ico by looking for no color map
39 >>>>>1  ubyte                   0       
40 # implies no first map entry
41 >>>>>>3 uleshort                0       
42 >>>>>>>0        use             tga-image
43 # Color Map
44 >>>>>1  ubyte                   >0      
45 >>>>>>0         use             tga-image
46 #       display tga bitmap image information
47 0       name                            tga-image
48 >2      ubyte           <34             Targa image data
49 !:mime  image/x-tga
50 !:apple ????TPIC
51 # normal extension .tga but some Truevision products used others:
52 # tpic (Apple),icb (Image Capture Board),vda (Video Display Adapter),vst (NuVista),win (UNSURE about that)
53 !:ext   tga/tpic/icb/vda/vst
54 # image type 1 2 3 9 10 11 32 33
55 >2      ubyte&0xF7      1               - Map
56 >2      ubyte&0xF7      2               - RGB
57 # alpha channel
58 >>17    ubyte&0x0F      >0              \bA
59 >2      ubyte&0xF7      3               - Mono
60 # type not found, but by http://www.fileformat.info/format/tga/corion.htm
61 # Compressed color-mapped data, using Huffman, Delta, and runlength encoding
62 >2      ubyte           32              - Color
63 # Compressed color-mapped data, using Huffman, Delta, and RLE. 4-pass quadtree- type process
64 >2      ubyte           33              - Color
65 # Color Map Type 0~no 1~color map
66 >1      ubyte           1               (
67 # first color map entry, 0 normal
68 >>3     uleshort        >0              \b%d-
69 # color map length 0 2 1dh 3bh d9h 100h
70 >>5     uleshort        x               \b%d)
71 # 8~run length encoding bit
72 >2      ubyte&0x08      8               - RLE
73 # gimp can create big pictures!
74 >12     uleshort        >0              %d x
75 >12     uleshort        =0              65536 x
76 # image height. 0 interpreted as 65536
77 >14     uleshort        >0              %d
78 >14     uleshort        =0              65536
79 # Image Pixel Size 15 16 24 32
80 >16     ubyte           x               x %d
81 # X origin of image. 0 normal 
82 >8      uleshort        >0              +%d
83 # Y origin of image. 0 normal; positive for top
84 >10     uleshort        >0              +%d
85 # Image descriptor: bits 3-0 give the alpha channel depth, bits 5-4 give direction
86 >17     ubyte&0x0F      >0              - %d-bit alpha
87 # bits 5-4 give direction. normal bottom left
88 >17     ubyte           &0x20           - top
89 #>17    ubyte           ^0x20           - bottom
90 >17     ubyte           &0x10           - right
91 #>17    ubyte           ^0x10           - left
92 # some info say other bits 6-7 should be zero
93 # but data storage interleave by http://www.fileformat.info/format/tga/corion.htm 
94 # 00 - no interleave;01 - even/odd interleave; 10 - four way interleave; 11 - reserved
95 #>17    ubyte&0xC0      0x00            - no interleave
96 >17     ubyte&0xC0      0x40            - interleave
97 >17     ubyte&0xC0      0x80            - four way interleave
98 >17     ubyte&0xC0      0xC0            - reserved
99 # positive length implies identification field 
100 >0      ubyte           >0              
101 >>18    string          x               "%s"
102 # last 18 bytes of newer tga file footer signature
103 >18     search/4261301/s        TRUEVISION-XFILE.\0     
104 # extension area offset if not 0
105 >>&-8           ulelong                 >0                      
106 # length of the extension area. normal 495 for version 2.0
107 >>>(&-4.l)      uleshort                0x01EF          
108 # AuthorName[41]
109 >>>>&0          string                  >\0             - author "%-.40s"
110 # Comment[324]=4 * 80 null terminated
111 >>>>&41         string                  >\0             - comment "%-.80s"
112 # date
113 >>>>&365        ubequad&0xffffFFFFffff0000      !0              
114 # Day
115 >>>>>&-6                uleshort                x               %d
116 # Month
117 >>>>>&-8                uleshort                x               \b-%d
118 # Year
119 >>>>>&-4                uleshort                x               \b-%d
120 # time
121 >>>>&371        ubequad&0xffffFFFFffff0000      !0              
122 # hour
123 >>>>>&-8                uleshort                x               %d
124 # minutes
125 >>>>>&-6                uleshort                x               \b:%.2d
126 # second
127 >>>>>&-4                uleshort                x               \b:%.2d
128 # JobName[41]
129 >>>>&377                string                  >\0             - job "%-.40s"
130 # JobHour Jobminute Jobsecond
131 >>>>&418        ubequad&0xffffFFFFffff0000      !0              
132 >>>>>&-8                uleshort                x               %d
133 >>>>>&-6                uleshort                x               \b:%.2d
134 >>>>>&-4                uleshort                x               \b:%.2d
135 # SoftwareId[41]
136 >>>>&424                string                  >\0             - %-.40s
137 # SoftwareVersionNumber
138 >>>>&424        ubyte                           >0              
139 >>>>>&40                uleshort/100            x               %d
140 >>>>>&40                uleshort%100            x               \b.%d
141 # VersionLetter
142 >>>>>&42                ubyte                   >0x20           \b%c
143 # KeyColor
144 >>>>&468                ulelong                 >0              - keycolor 0x%8.8x
145 # Denominator of Pixel ratio. 0~no pixel aspect
146 >>>>&474        uleshort                        >0                      
147 # Numerator
148 >>>>>&-4                uleshort                >0              - aspect %d
149 >>>>>&-2                uleshort                x               \b/%d
150 # Denominator of Gamma ratio. 0~no Gamma value
151 >>>>&478        uleshort                        >0              
152 # Numerator
153 >>>>>&-4                uleshort                >0              - gamma %d
154 >>>>>&-2                uleshort                x               \b/%d
155 # ColorOffset 
156 #>>>>&480       ulelong                 x               - col offset 0x%8.8x
157 # StampOffset
158 #>>>>&484       ulelong                 x               - stamp offset 0x%8.8x
159 # ScanOffset
160 #>>>>&488       ulelong                 x               - scan offset 0x%8.8x
161 # AttributesType
162 #>>>>&492       ubyte                   x               - Attributes 0x%x
163 ## EndOfTGA
164
165 # PBMPLUS images
166 # The next byte following the magic is always whitespace.
167 # strength is changed to try these patterns before "x86 boot sector"
168 0       name            netpbm
169 >3      regex/s         =[0-9]{1,50}\ [0-9]{1,50}       Netpbm image data
170 >>&0    regex           =[0-9]{1,50}                    \b, size = %s x
171 >>>&0   regex           =[0-9]{1,50}                    \b %s
172
173 0       search/1        P1              
174 >0      regex/4         P1\\s
175 >>0     use             netpbm
176 >>>0    string          x       \b, bitmap
177 !:strength + 45
178 !:mime  image/x-portable-bitmap
179
180 0       search/1        P2              
181 >0      regex/4         P2\\s
182 >>0     use             netpbm
183 >>>0    string          x       \b, greymap
184 !:strength + 45
185 !:mime  image/x-portable-greymap
186
187 0       search/1        P3
188 >0      regex/4         P3\\s
189 >>0     use             netpbm
190 >>>0    string          x       \b, pixmap
191 !:strength + 45
192 !:mime  image/x-portable-pixmap
193
194 0       string          P4              
195 >0      regex/4         P4\\s
196 >>0     use             netpbm
197 >>>0    string          x       \b, rawbits, bitmap
198 !:strength + 45
199 !:mime  image/x-portable-bitmap
200
201 0       string          P5              
202 >0      regex/4         P5\\s
203 >>0     use             netpbm
204 >>>0    string          x       \b, rawbits, greymap
205 !:strength + 45
206 !:mime  image/x-portable-greymap
207
208 0       string          P6              
209 >0      regex/4         P6\\s
210 >>0     use             netpbm
211 >>>0    string          x       \b, rawbits, pixmap
212 !:strength + 45
213 !:mime  image/x-portable-pixmap
214
215 0       string          P7              Netpbm PAM image file
216 !:mime  image/x-portable-pixmap
217
218 # From: bryanh@giraffe-data.com (Bryan Henderson)
219 0       string          \117\072        Solitaire Image Recorder format
220 >4      string          \013            MGI Type 11
221 >4      string          \021            MGI Type 17
222 0       string          .MDA            MicroDesign data
223 >21     byte            48              version 2
224 >21     byte            51              version 3
225 0       string          .MDP            MicroDesign page data
226 >21     byte            48              version 2
227 >21     byte            51              version 3
228
229 # NIFF (Navy Interchange File Format, a modification of TIFF) images
230 # [GRR:  this *must* go before TIFF]
231 0       string          IIN1            NIFF image data
232 !:mime  image/x-niff
233
234 # Canon RAW version 1 (CRW) files are a type of Canon Image File Format
235 # (CIFF) file. These are apparently all little-endian.
236 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
237 # URL: http://www.sno.phy.queensu.ca/~phil/exiftool/canon_raw.html
238 0       string          II\x1a\0\0\0HEAPCCDR    Canon CIFF raw image data
239 !:mime  image/x-canon-crw
240 >16     leshort         x       \b, version %d.
241 >14     leshort         x       \b%d
242
243 # Canon RAW version 2 (CR2) files are a kind of TIFF with an extra magic
244 # number. Put this above the TIFF test to make sure we detect them.
245 # These are apparently all little-endian.
246 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
247 # URL: http://libopenraw.freedesktop.org/wiki/Canon_CR2
248 0       string          II\x2a\0\x10\0\0\0CR    Canon CR2 raw image data
249 !:mime  image/x-canon-cr2
250 >10     byte            x       \b, version %d.
251 >11     byte            x       \b%d
252
253 # Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
254 # The second word of TIFF files is the TIFF version number, 42, which has
255 # never changed.  The TIFF specification recommends testing for it.
256 0       string          MM\x00\x2a      TIFF image data, big-endian
257 !:mime  image/tiff
258 >(4.L)  use             \^tiff_ifd
259 0       string          II\x2a\x00      TIFF image data, little-endian
260 !:mime  image/tiff
261 >(4.l)  use             tiff_ifd
262
263 0       name            tiff_ifd
264 >0      leshort         x               \b, direntries=%d
265 >2      use             tiff_entry
266
267 0       name            tiff_entry
268 # NewSubFileType
269 >0      leshort         0xfe
270 >>12    use             tiff_entry
271 >0      leshort         0x100
272 >>4     lelong          1
273 >>>12   use             tiff_entry
274 >>>8    leshort         x               \b, width=%d
275 >0      leshort         0x101
276 >>4     lelong          1
277 >>>8    leshort         x               \b, height=%d
278 >>>12   use             tiff_entry
279 >0      leshort         0x102
280 >>8     leshort         x               \b, bps=%d
281 >>12    use             tiff_entry
282 >0      leshort         0x103
283 >>4     lelong          1               \b, compression=
284 >>>8    leshort         1               \bnone
285 >>>8    leshort         2               \bhuffman
286 >>>8    leshort         3               \bbi-level group 3
287 >>>8    leshort         4               \bbi-level group 4
288 >>>8    leshort         5               \bLZW
289 >>>8    leshort         6               \bJPEG (old)
290 >>>8    leshort         7               \bJPEG
291 >>>8    leshort         8               \bdeflate
292 >>>8    leshort         9               \bJBIG, ITU-T T.85
293 >>>8    leshort         0xa             \bJBIG, ITU-T T.43
294 >>>8    leshort         0x7ffe          \bNeXT RLE 2-bit
295 >>>8    leshort         0x8005          \bPackBits (Macintosh RLE)
296 >>>8    leshort         0x8029          \bThunderscan RLE
297 >>>8    leshort         0x807f          \bRasterPadding (CT or MP)
298 >>>8    leshort         0x8080          \bRLE (Line Work)
299 >>>8    leshort         0x8081          \bRLE (High-Res Cont-Tone)
300 >>>8    leshort         0x8082          \bRLE (Binary Line Work)
301 >>>8    leshort         0x80b2          \bDeflate (PKZIP)
302 >>>8    leshort         0x80b3          \bKodak DCS
303 >>>8    leshort         0x8765          \bJBIG
304 >>>8    leshort         0x8798          \bJPEG2000
305 >>>8    leshort         0x8799          \bNikon NEF Compressed
306 >>>8    default         x       
307 >>>>8   leshort         x               \b(unknown 0x%x)
308 >>>12   use             tiff_entry
309 >0      leshort         0x106           \b, PhotometricIntepretation=
310 >>8     clear           x
311 >>8     leshort         0               \bWhiteIsZero
312 >>8     leshort         1               \bBlackIsZero
313 >>8     leshort         2               \bRGB
314 >>8     leshort         3               \bRGB Palette
315 >>8     leshort         4               \bTransparency Mask
316 >>8     leshort         5               \bCMYK
317 >>8     leshort         6               \bYCbCr
318 >>8     leshort         8               \bCIELab
319 >>8     default         x
320 >>>8    leshort         x               \b(unknown=0x%x)
321 >>12    use             tiff_entry
322 # FillOrder
323 >0      leshort         0x10a
324 >>4     lelong          1
325 >>>12   use             tiff_entry
326 # DocumentName
327 >0      leshort         0x10d
328 >>(8.l) string          x               \b, name=%s
329 >>>12   use             tiff_entry
330 # ImageDescription
331 >0      leshort         0x10e
332 >>(8.l) string          x               \b, description=%s
333 >>>12   use             tiff_entry
334 # Make
335 >0      leshort         0x10f
336 >>(8.l) string          x               \b, manufacturer=%s
337 >>>12   use             tiff_entry
338 # Model
339 >0      leshort         0x110
340 >>(8.l) string          x               \b, model=%s
341 >>>12   use             tiff_entry
342 # StripOffsets
343 >0      leshort         0x111
344 >>12    use             tiff_entry
345 # Orientation
346 >0      leshort         0x112           \b, orientation=
347 >>8     leshort         1               \bupper-left
348 >>8     leshort         3               \blower-right
349 >>8     leshort         6               \bupper-right
350 >>8     leshort         8               \blower-left
351 >>8     leshort         9               \bundefined
352 >>8     default         x
353 >>>8    leshort         x               \b[*%d*]
354 >>12    use             tiff_entry
355 # XResolution
356 >0      leshort         0x11a
357 >>8     lelong          x               \b, xresolution=%d
358 >>12    use             tiff_entry
359 # YResolution
360 >0      leshort         0x11b
361 >>8     lelong          x               \b, yresolution=%d
362 >>12    use             tiff_entry
363 # ResolutionUnit
364 >0      leshort         0x128
365 >>8     leshort         x               \b, resolutionunit=%d
366 >>12    use             tiff_entry
367 # Software
368 >0      leshort         0x131
369 >>(8.l) string          x               \b, software=%s
370 >>12    use             tiff_entry
371 # Datetime
372 >0      leshort         0x132
373 >>(8.l) string          x               \b, datetime=%s
374 >>12    use             tiff_entry
375 # HostComputer
376 >0      leshort         0x13c
377 >>(8.l) string          x               \b, hostcomputer=%s
378 >>12    use             tiff_entry
379 # WhitePoint
380 >0      leshort         0x13e
381 >>12    use             tiff_entry
382 # PrimaryChromaticities
383 >0      leshort         0x13f
384 >>12    use             tiff_entry
385 # YCbCrCoefficients
386 >0      leshort         0x211
387 >>12    use             tiff_entry
388 # YCbCrPositioning
389 >0      leshort         0x213
390 >>12    use             tiff_entry
391 # ReferenceBlackWhite
392 >0      leshort         0x214
393 >>12    use             tiff_entry
394 # Copyright
395 >0      leshort         0x8298
396 >>(8.l) string          x               \b, copyright=%s
397 >>12    use             tiff_entry
398 # ExifOffset
399 >0      leshort         0x8769
400 >>12    use             tiff_entry
401 # GPS IFD
402 >0      leshort         0x8825          \b, GPS-Data
403 >>12    use             tiff_entry
404
405 #>0     leshort         x               \b, unknown=0x%x
406 #>>12   use             tiff_entry
407
408 0       string          MM\x00\x2b      Big TIFF image data, big-endian
409 !:mime  image/tiff
410 0       string          II\x2b\x00      Big TIFF image data, little-endian
411 !:mime  image/tiff
412
413 # PNG [Portable Network Graphics, or "PNG's Not GIF"] images
414 # (Greg Roelofs, newt@uchicago.edu)
415 # (Albert Cahalan, acahalan@cs.uml.edu)
416 #
417 # 137 P N G \r \n ^Z \n [4-byte length] H E A D [HEAD data] [HEAD crc] ...
418 #
419 0       string          \x89PNG\x0d\x0a\x1a\x0a         PNG image data
420 !:mime  image/png
421 >16     belong          x               \b, %d x
422 >20     belong          x               %d,
423 >24     byte            x               %d-bit
424 >25     byte            0               grayscale,
425 >25     byte            2               \b/color RGB,
426 >25     byte            3               colormap,
427 >25     byte            4               gray+alpha,
428 >25     byte            6               \b/color RGBA,
429 #>26    byte            0               deflate/32K,
430 >28     byte            0               non-interlaced
431 >28     byte            1               interlaced
432
433 # possible GIF replacements; none yet released!
434 # (Greg Roelofs, newt@uchicago.edu)
435 #
436 # GRR 950115:  this was mine ("Zip GIF"):
437 0       string          GIF94z          ZIF image (GIF+deflate alpha)
438 !:mime  image/x-unknown
439 #
440 # GRR 950115:  this is Jeremy Wohl's Free Graphics Format (better):
441 #                                       
442 0       string          FGF95a          FGF image (GIF+deflate beta)
443 !:mime  image/x-unknown
444 #
445 # GRR 950115:  this is Thomas Boutell's Portable Bitmap Format proposal
446 # (best; not yet implemented):
447 #                                       
448 0       string          PBF             PBF image (deflate compression)
449 !:mime  image/x-unknown
450
451 # GIF
452 0       string          GIF8            GIF image data
453 !:mime  image/gif
454 !:apple 8BIMGIFf
455 >4      string          7a              \b, version 8%s,
456 >4      string          9a              \b, version 8%s,
457 >6      leshort         >0              %d x
458 >8      leshort         >0              %d
459 #>10    byte            &0x80           color mapped,
460 #>10    byte&0x07       =0x00           2 colors
461 #>10    byte&0x07       =0x01           4 colors
462 #>10    byte&0x07       =0x02           8 colors
463 #>10    byte&0x07       =0x03           16 colors
464 #>10    byte&0x07       =0x04           32 colors
465 #>10    byte&0x07       =0x05           64 colors
466 #>10    byte&0x07       =0x06           128 colors
467 #>10    byte&0x07       =0x07           256 colors
468
469 # ITC (CMU WM) raster files.  It is essentially a byte-reversed Sun raster,
470 # 1 plane, no encoding.
471 0       string          \361\0\100\273  CMU window manager raster image data
472 >4      lelong          >0              %d x
473 >8      lelong          >0              %d,
474 >12     lelong          >0              %d-bit
475
476 # Magick Image File Format
477 0       string          id=ImageMagick  MIFF image data
478
479 # Artisan
480 0       long            1123028772      Artisan image data
481 >4      long            1               \b, rectangular 24-bit
482 >4      long            2               \b, rectangular 8-bit with colormap
483 >4      long            3               \b, rectangular 32-bit (24-bit with matte)
484
485 # FIG (Facility for Interactive Generation of figures), an object-based format
486 0       search/1        #FIG            FIG image text
487 >5      string          x               \b, version %.3s
488
489 # PHIGS
490 0       string          ARF_BEGARF              PHIGS clear text archive
491 0       string          @(#)SunPHIGS            SunPHIGS
492 # version number follows, in the form m.n
493 >40     string          SunBin                  binary
494 >32     string          archive                 archive
495
496 # GKS (Graphics Kernel System)
497 0       string          GKSM            GKS Metafile
498 >24     string          SunGKS          \b, SunGKS
499
500 # CGM image files
501 0       string          BEGMF           clear text Computer Graphics Metafile
502
503 # MGR bitmaps  (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
504 0       string  yz      MGR bitmap, modern format, 8-bit aligned
505 0       string  zz      MGR bitmap, old format, 1-bit deep, 16-bit aligned
506 0       string  xz      MGR bitmap, old format, 1-bit deep, 32-bit aligned
507 0       string  yx      MGR bitmap, modern format, squeezed
508
509 # Fuzzy Bitmap (FBM) images
510 0       string          %bitmap\0       FBM image data
511 >30     long            0x31            \b, mono
512 >30     long            0x33            \b, color
513
514 # facsimile data
515 1       string          PC\ Research,\ Inc      group 3 fax data
516 >29     byte            0               \b, normal resolution (204x98 DPI)
517 >29     byte            1               \b, fine resolution (204x196 DPI)
518 # From: Herbert Rosmanith <herp@wildsau.idv.uni.linz.at>
519 0       string          Sfff            structured fax file
520
521 # From: Joerg Jenderek <joerg.jen.der.ek@gmx.net>
522 # most files with the extension .EPA and some with .BMP
523 0       string          \x11\x06        Award BIOS Logo, 136 x 84
524 !:mime  image/x-award-bioslogo
525 0       string          \x11\x09        Award BIOS Logo, 136 x 126
526 !:mime  image/x-award-bioslogo
527 #0      string          \x07\x1f        BIOS Logo corrupted?
528 # http://www.blackfiveservices.co.uk/awbmtools.shtml
529 # http://biosgfx.narod.ru/v3/
530 # http://biosgfx.narod.ru/abr-2/
531 0       string          AWBM            
532 >4      leshort         <1981           Award BIOS bitmap
533 !:mime  image/x-award-bmp
534 # image width is a multiple of 4
535 >>4     leshort&0x0003  0               
536 >>>4            leshort x               \b, %d
537 >>>6            leshort x               x %d
538 >>4     leshort&0x0003  >0              \b,
539 >>>4    leshort&0x0003  =1              
540 >>>>4           leshort x               %d+3
541 >>>4    leshort&0x0003  =2              
542 >>>>4           leshort x               %d+2
543 >>>4    leshort&0x0003  =3              
544 >>>>4           leshort x               %d+1
545 >>>6            leshort x               x %d
546 # at offset 8 starts imagedata followed by "RGB " marker
547
548 # PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
549 # http://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.\
550 # 28bitmap_information_header.29
551 0       string          BM
552 >14     leshort         12              PC bitmap, OS/2 1.x format
553 !:mime  image/x-ms-bmp
554 >>18    leshort         x               \b, %d x
555 >>20    leshort         x               %d
556 >14     leshort         64              PC bitmap, OS/2 2.x format
557 !:mime  image/x-ms-bmp
558 >>18    leshort         x               \b, %d x
559 >>20    leshort         x               %d
560 >14     leshort         40              PC bitmap, Windows 3.x format
561 !:mime  image/x-ms-bmp
562 >>18    lelong          x               \b, %d x
563 >>22    lelong          x               %d x
564 >>28    leshort         x               %d
565 >14     leshort         124             PC bitmap, Windows 98/2000 and newer format
566 !:mime  image/x-ms-bmp
567 >>18    lelong          x               \b, %d x
568 >>22    lelong          x               %d x
569 >>28    leshort         x               %d
570 >14     leshort         108             PC bitmap, Windows 95/NT4 and newer format
571 !:mime  image/x-ms-bmp
572 >>18    lelong          x               \b, %d x
573 >>22    lelong          x               %d x
574 >>28    leshort         x               %d
575 >14     leshort         128             PC bitmap, Windows NT/2000 format
576 !:mime  image/x-ms-bmp
577 >>18    lelong          x               \b, %d x
578 >>22    lelong          x               %d x
579 >>28    leshort         x               %d
580 # Too simple - MPi
581 #0      string          IC              PC icon data
582 #0      string          PI              PC pointer image data
583 #0      string          CI              PC color icon data
584 #0      string          CP              PC color pointer image data
585 # Conflicts with other entries [BABYL]
586 #0      string          BA              PC bitmap array data
587
588 # XPM icons (Greg Roelofs, newt@uchicago.edu)
589 0       search/1        /*\ XPM\ */     X pixmap image text
590 !:mime  image/x-xpmi
591
592 # Utah Raster Toolkit RLE images (janl@ifi.uio.no)
593 0       leshort         0xcc52          RLE image data,
594 >6      leshort         x               %d x
595 >8      leshort         x               %d
596 >2      leshort         >0              \b, lower left corner: %d
597 >4      leshort         >0              \b, lower right corner: %d
598 >10     byte&0x1        =0x1            \b, clear first
599 >10     byte&0x2        =0x2            \b, no background
600 >10     byte&0x4        =0x4            \b, alpha channel
601 >10     byte&0x8        =0x8            \b, comment
602 >11     byte            >0              \b, %d color channels
603 >12     byte            >0              \b, %d bits per pixel
604 >13     byte            >0              \b, %d color map channels
605
606 # image file format (Robert Potter, potter@cs.rochester.edu)
607 0       string          Imagefile\ version-     iff image data
608 # this adds the whole header (inc. version number), informative but longish
609 >10     string          >\0             %s
610
611 # Sun raster images, from Daniel Quinlan (quinlan@yggdrasil.com)
612 0       belong          0x59a66a95      Sun raster image data
613 >4      belong          >0              \b, %d x
614 >8      belong          >0              %d,
615 >12     belong          >0              %d-bit,
616 #>16    belong          >0              %d bytes long,
617 >20     belong          0               old format,
618 #>20    belong          1               standard,
619 >20     belong          2               compressed,
620 >20     belong          3               RGB,
621 >20     belong          4               TIFF,
622 >20     belong          5               IFF,
623 >20     belong          0xffff          reserved for testing,
624 >24     belong          0               no colormap
625 >24     belong          1               RGB colormap
626 >24     belong          2               raw colormap
627 #>28    belong          >0              colormap is %d bytes long
628
629 # SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
630 #
631 # See
632 #       http://reality.sgi.com/grafica/sgiimage.html
633 #
634 0       beshort         474             SGI image data
635 #>2     byte            0               \b, verbatim
636 >2      byte            1               \b, RLE
637 #>3     byte            1               \b, normal precision
638 >3      byte            2               \b, high precision
639 >4      beshort         x               \b, %d-D
640 >6      beshort         x               \b, %d x
641 >8      beshort         x               %d
642 >10     beshort         x               \b, %d channel
643 >10     beshort         !1              \bs
644 >80     string          >0              \b, "%s"
645
646 0       string          IT01            FIT image data
647 >4      belong          x               \b, %d x
648 >8      belong          x               %d x
649 >12     belong          x               %d
650 #
651 0       string          IT02            FIT image data
652 >4      belong          x               \b, %d x
653 >8      belong          x               %d x
654 >12     belong          x               %d
655 #
656 2048    string          PCD_IPI         Kodak Photo CD image pack file
657 >0xe02  byte&0x03       0x00            , landscape mode
658 >0xe02  byte&0x03       0x01            , portrait mode
659 >0xe02  byte&0x03       0x02            , landscape mode
660 >0xe02  byte&0x03       0x03            , portrait mode
661 0       string          PCD_OPA         Kodak Photo CD overview pack file
662
663 # FITS format.  Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
664 # FITS is the Flexible Image Transport System, the de facto standard for
665 # data and image transfer, storage, etc., for the astronomical community.
666 # (FITS floating point formats are big-endian.)
667 0       string  SIMPLE\ \ =     FITS image data
668 >109    string  8               \b, 8-bit, character or unsigned binary integer
669 >108    string  16              \b, 16-bit, two's complement binary integer
670 >107    string  \ 32            \b, 32-bit, two's complement binary integer
671 >107    string  -32             \b, 32-bit, floating point, single precision
672 >107    string  -64             \b, 64-bit, floating point, double precision
673
674 # other images
675 0       string  This\ is\ a\ BitMap\ file       Lisp Machine bit-array-file
676
677 # From SunOS 5.5.1 "/etc/magic" - appeared right before Sun raster image
678 # stuff.
679 #
680 0       beshort         0x1010          PEX Binary Archive
681
682 # DICOM medical imaging data
683 # URL:          https://en.wikipedia.org/wiki/DICOM#Data_format
684 # Note:         "dcm" is the official file name extension
685 #               XnView mention also "dc3" and "acr" as file name extension
686 128     string  DICM                    DICOM medical imaging data
687 !:mime  application/dicom
688 !:ext dcm/dicom/dic
689
690 # XWD - X Window Dump file.
691 #   As described in /usr/X11R6/include/X11/XWDFile.h
692 #   used by the xwd program.
693 #   Bradford Castalia, idaeim, 1/01
694 #   updated by Adam Buchbinder, 2/09
695 # The following assumes version 7 of the format; the first long is the length
696 # of the header, which is at least 25 4-byte longs, and the one at offset 8
697 # is a constant which is always either 1 or 2. Offset 12 is the pixmap depth,
698 # which is a maximum of 32.
699 0       belong  >100
700 >8      belong  <3
701 >>12    belong  <33
702 >>>4    belong  7                       XWD X Window Dump image data
703 !:mime  image/x-xwindowdump
704 >>>>100 string  >\0                     \b, "%s"
705 >>>>16  belong  x                       \b, %dx
706 >>>>20  belong  x                       \b%dx
707 >>>>12  belong  x                       \b%d
708
709 # PDS - Planetary Data System
710 #   These files use Parameter Value Language in the header section.
711 #   Unfortunately, there is no certain magic, but the following
712 #   strings have been found to be most likely.
713 0       string  NJPL1I00                PDS (JPL) image data
714 2       string  NJPL1I                  PDS (JPL) image data
715 0       string  CCSD3ZF                 PDS (CCSD) image data
716 2       string  CCSD3Z                  PDS (CCSD) image data
717 0       string  PDS_                    PDS image data
718 0       string  LBLSIZE=                PDS (VICAR) image data
719
720 # pM8x: ATARI STAD compressed bitmap format
721 #
722 # from Oskar Schirmer <schirmer@scara.com> Feb 2, 2001
723 # p M 8 5/6 xx yy zz data...
724 # Atari ST STAD bitmap is always 640x400, bytewise runlength compressed.
725 # bytes either run horizontally (pM85) or vertically (pM86). yy is the
726 # most frequent byte, xx and zz are runlength escape codes, where xx is
727 # used for runs of yy.
728 #
729 0       string  pM85            Atari ST STAD bitmap image data (hor)
730 >5      byte    0x00            (white background)
731 >5      byte    0xFF            (black background)
732 0       string  pM86            Atari ST STAD bitmap image data (vert)
733 >5      byte    0x00            (white background)
734 >5      byte    0xFF            (black background)
735
736 # Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
737 # http://www.atarimax.com/jindroush.atari.org/afmtatr.html
738 0       leshort 0x0296          Atari ATR image
739
740 # XXX:
741 # This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
742 # magic.
743 # SGI RICE image file <mpruett@sgi.com>
744 #0      beshort 0x5249          RICE image
745 #>2     beshort x               v%d
746 #>4     beshort x               (%d x
747 #>6     beshort x               %d)
748 #>8     beshort 0               8 bit
749 #>8     beshort 1               10 bit
750 #>8     beshort 2               12 bit
751 #>8     beshort 3               13 bit
752 #>10    beshort 0               4:2:2
753 #>10    beshort 1               4:2:2:4
754 #>10    beshort 2               4:4:4
755 #>10    beshort 3               4:4:4:4
756 #>12    beshort 1               RGB
757 #>12    beshort 2               CCIR601
758 #>12    beshort 3               RP175
759 #>12    beshort 4               YUV
760
761 # PCX image files
762 # From: Dan Fandrich <dan@coneharvesters.com>
763 # updated by Joerg Jenderek at Feb 2013 by http://de.wikipedia.org/wiki/PCX
764 # http://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
765 # GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
766 # 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
767 0       ubelong&0xffF8fe00      0x0a000000      
768 # for PCX bit depth > 0 
769 >3      ubyte           >0      
770 # test for valid versions
771 >>1     ubyte           <6      
772 >>>1    ubyte           !1      PCX
773 !:mime  image/x-pcx
774 #!:mime image/pcx
775 >>>>1   ubyte           0       ver. 2.5 image data
776 >>>>1   ubyte           2       ver. 2.8 image data, with palette
777 >>>>1   ubyte           3       ver. 2.8 image data, without palette
778 >>>>1   ubyte           4       for Windows image data
779 >>>>1   ubyte           5       ver. 3.0 image data
780 >>>>4   uleshort        x       bounding box [%d,
781 >>>>6   uleshort        x       %d] -
782 >>>>8   uleshort        x       [%d,
783 >>>>10  uleshort        x       %d],
784 >>>>65  ubyte           >1      %d planes each of
785 >>>>3   ubyte           x       %d-bit
786 >>>>68  byte            1       colour,
787 >>>>68  byte            2       grayscale,
788 # this should not happen
789 >>>>68  default         x       image,
790 >>>>12  leshort         >0      %d x
791 >>>>>14 uleshort        x       %d dpi,
792 >>>>2   byte            0       uncompressed
793 >>>>2   byte            1       RLE compressed
794
795 # Adobe Photoshop
796 # From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
797 0       string          8BPS Adobe Photoshop Image
798 !:mime  image/vnd.adobe.photoshop
799 >4   beshort 2 (PSB)
800 >18  belong  x \b, %d x
801 >14  belong  x %d,
802 >24  beshort 0 bitmap
803 >24  beshort 1 grayscale
804 >>12 beshort 2 with alpha
805 >24  beshort 2 indexed
806 >24  beshort 3 RGB
807 >>12 beshort 4 \bA
808 >24  beshort 4 CMYK
809 >>12 beshort 5 \bA
810 >24  beshort 7 multichannel
811 >24  beshort 8 duotone
812 >24  beshort 9 lab
813 >12  beshort > 1
814 >>12  beshort x \b, %dx
815 >12  beshort 1 \b,
816 >22  beshort x %d-bit channel
817 >12  beshort > 1 \bs
818
819 # XV thumbnail indicator (ThMO)
820 0       string          P7\ 332         XV thumbnail image data
821
822 # NITF is defined by United States MIL-STD-2500A
823 0       string  NITF    National Imagery Transmission Format
824 >25     string  >\0     dated %.14s
825
826 # GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
827 # Format variations from: Bernd Nuernberger <bernd.nuernberger@web.de>
828 # Update: Joerg Jenderek
829 # See http://fileformats.archiveteam.org/wiki/GEM_Raster
830 # For variations, also see:
831 #    http://www.seasip.info/Gem/ff_img.html (Ventura) 
832 #    http://www.atari-wiki.com/?title=IMG_file (XIMG, STTT)
833 #    http://www.fileformat.info/format/gemraster/spec/index.htm (XIMG, STTT)
834 #    http://sylvana.net/1stguide/1STGUIDE.ENG (TIMG)
835 0       beshort     0x0001
836 # header_size
837 >2      beshort     0x0008      
838 >>0     use gem_info
839 >2      beshort     0x0009      
840 >>0     use gem_info
841 # no example for NOSIG
842 >2      beshort     24      
843 >>0     use gem_info
844 # no example for HYPERPAINT
845 >2      beshort     25      
846 >>0     use gem_info
847 16      string      XIMG\0      
848 >0      use gem_info
849 # no example
850 16      string      STTT\0\x10  
851 >0      use gem_info
852 # no example or description
853 16      string      TIMG\0      
854 >0      use gem_info
855
856 0   name        gem_info
857 # version is 2 for some XIMG and 1 for all others
858 >0      beshort         <0x0003         GEM
859 # http://www.snowstone.org.uk/riscos/mimeman/mimemap.txt
860 !:mime  image/x-gem
861 # header_size 24 25 27 59 779 words for colored bitmaps
862 >>2     beshort         >9              
863 >>>16   string          STTT\0\x10      STTT
864 >>>16   string          TIMG\0          TIMG
865 # HYPERPAINT or NOSIG variant
866 >>>16   string          \0\x80          
867 >>>>2   beshort         =24             NOSIG
868 >>>>2   beshort         !24             HYPERPAINT
869 # NOSIG or XIMG variant
870 >>>16   default         x               
871 >>>>16  string          !XIMG\0         NOSIG
872 >>16    string          =XIMG\0         XIMG Image data
873 !:ext   img/ximg
874 # to avoid Warning: Current entry does not yet have a description for adding a EXTENSION type
875 >>16    string          !XIMG\0         Image data
876 !:ext   img
877 # header_size is 9 for Ventura files and 8 for other GEM Paint files
878 >>2     beshort         9               (Ventura)
879 #>>2    beshort         8               (Paint)
880 >>12    beshort         x               %d x
881 >>14    beshort         x               %d,
882 # 1 4 8
883 >>4     beshort         x               %d planes,
884 # in tenths of a millimetre
885 >>8     beshort         x               %d x
886 >>10    beshort         x               %d pixelsize
887 # pattern_size 1-8. 2 for GEM Paint
888 >>6     beshort         !2              \b, pattern size %d
889
890 # GEM Metafile (Wolfram Kleff)
891 0       lelong          0x0018FFFF      GEM Metafile data
892 >4      leshort         x               version %d
893
894 #
895 # SMJPEG. A custom Motion JPEG format used by Loki Entertainment
896 # Software Torbjorn Andersson <d91tan@Update.UU.SE>.
897 #
898 0       string  \0\nSMJPEG      SMJPEG
899 >8      belong  x               %d.x data
900 # According to the specification you could find any number of _TXT
901 # headers here, but I can't think of any way of handling that. None of
902 # the SMJPEG files I tried it on used this feature. Even if such a
903 # file is encountered the output should still be reasonable.
904 >16     string  _SND            \b,
905 >>24    beshort >0              %d Hz
906 >>26    byte    8               8-bit
907 >>26    byte    16              16-bit
908 >>28    string  NONE            uncompressed
909 # >>28  string  APCM            ADPCM compressed
910 >>27    byte    1               mono
911 >>28    byte    2               stereo
912 # Help! Isn't there any way to avoid writing this part twice?
913 >>32    string  _VID            \b,
914 # >>>48 string  JFIF            JPEG
915 >>>40   belong  >0              %d frames
916 >>>44   beshort >0              (%d x
917 >>>46   beshort >0              %d)
918 >16     string  _VID            \b,
919 # >>32  string  JFIF            JPEG
920 >>24    belong  >0              %d frames
921 >>28    beshort >0              (%d x
922 >>30    beshort >0              %d)
923
924 0       string  Paint\ Shop\ Pro\ Image\ File   Paint Shop Pro Image File
925
926 # "thumbnail file" (icon)
927 # descended from "xv", but in use by other applications as well (Wolfram Kleff)
928 0       string          P7\ 332         XV "thumbnail file" (icon) data
929
930 # taken from fkiss: (<yav@mte.biglobe.ne.jp> ?)
931 0       string          KiSS            KISS/GS
932 >4      byte            16              color
933 >>5     byte            x               %d bit
934 >>8     leshort         x               %d colors
935 >>10    leshort         x               %d groups
936 >4      byte            32              cell
937 >>5     byte            x               %d bit
938 >>8     leshort         x               %d x
939 >>10    leshort         x               %d
940 >>12    leshort         x               +%d
941 >>14    leshort         x               +%d
942
943 # Webshots (www.webshots.com), by John Harrison
944 0       string          C\253\221g\230\0\0\0 Webshots Desktop .wbz file
945
946 # Hercules DASD image files
947 # From Jan Jaeger <jj@septa.nl>
948 0       string  CKD_P370        Hercules CKD DASD image file
949 >8      long    x               \b, %d heads per cylinder
950 >12     long    x               \b, track size %d bytes
951 >16     byte    x               \b, device type 33%2.2X
952
953 0       string  CKD_C370        Hercules compressed CKD DASD image file
954 >8      long    x               \b, %d heads per cylinder
955 >12     long    x               \b, track size %d bytes
956 >16     byte    x               \b, device type 33%2.2X
957
958 0       string  CKD_S370        Hercules CKD DASD shadow file
959 >8      long    x               \b, %d heads per cylinder
960 >12     long    x               \b, track size %d bytes
961 >16     byte    x               \b, device type 33%2.2X
962
963 # Squeak images and programs - etoffi@softhome.net
964 0       string          \146\031\0\0    Squeak image data
965 0       search/1        'From\040Squeak Squeak program text
966
967 # partimage: file(1) magic for PartImage files (experimental, incomplete)
968 # Author: Hans-Joachim Baader <hjb@pro-linux.de>
969 0               string  PaRtImAgE-VoLuMe        PartImage
970 >0x0020         string  0.6.1           file version %s
971 >>0x0060        lelong  >-1             volume %d
972 #>>0x0064 8 byte identifier
973 #>>0x007c reserved
974 >>0x0200        string  >\0             type %s
975 >>0x1400        string  >\0             device %s,
976 >>0x1600        string  >\0             original filename %s,
977 # Some fields omitted
978 >>0x2744        lelong  0               not compressed
979 >>0x2744        lelong  1               gzip compressed
980 >>0x2744        lelong  2               bzip2 compressed
981 >>0x2744        lelong  >2              compressed with unknown algorithm
982 >0x0020         string  >0.6.1          file version %s
983 >0x0020         string  <0.6.1          file version %s
984
985 # DCX is multi-page PCX, using a simple header of up to 1024
986 # offsets for the respective PCX components.
987 # From: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
988 0       lelong  987654321       DCX multi-page PCX image data
989
990 # Simon Walton <simonw@matteworld.com>
991 # Kodak Cineon format for scanned negatives
992 # http://www.kodak.com/US/en/motion/support/dlad/
993 0       lelong  0xd75f2a80      Cineon image data
994 >200    belong  >0              \b, %d x
995 >204    belong  >0              %d
996
997
998 # Bio-Rad .PIC is an image format used by microscope control systems
999 # and related image processing software used by biologists.
1000 # From: Vebjorn Ljosa <vebjorn@ljosa.com>
1001 # BOOL values are two-byte integers; use them to rule out false positives.
1002 # http://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
1003 # Samples: http://www.loci.wisc.edu/software/sample-data
1004 14      leshort <2
1005 >62     leshort <2
1006 >>54    leshort 12345           Bio-Rad .PIC Image File
1007 >>>0    leshort >0              %d x
1008 >>>2    leshort >0              %d,
1009 >>>4    leshort =1              1 image in file
1010 >>>4    leshort >1              %d images in file
1011
1012 # From Jan "Yenya" Kasprzak <kas@fi.muni.cz>
1013 # The description of *.mrw format can be found at
1014 # http://www.dalibor.cz/minolta/raw_file_format.htm
1015 0       string  \000MRM                 Minolta Dimage camera raw image data
1016
1017 # Summary: DjVu image / document
1018 # Extension: .djvu
1019 # Reference: http://djvu.org/docs/DjVu3Spec.djvu
1020 # Submitted by: Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
1021 # Modified by (1): Abel Cheung <abelcheung@gmail.com>
1022 0       string  AT&TFORM
1023 >12     string  DJVM            DjVu multiple page document
1024 !:mime  image/vnd.djvu
1025 >12     string  DJVU            DjVu image or single page document
1026 !:mime  image/vnd.djvu
1027 >12     string  DJVI            DjVu shared document
1028 !:mime  image/vnd.djvu
1029 >12     string  THUM            DjVu page thumbnails
1030 !:mime  image/vnd.djvu
1031
1032 # Originally by Marc Espie
1033 # Modified by Robert Minsk <robertminsk at yahoo.com>
1034 # http://www.openexr.com/openexrfilelayout.pdf
1035 0       lelong          20000630        OpenEXR image data,
1036 !:mime image/x-exr
1037 >4      lelong&0x000000ff x             version %d,
1038 >4      lelong          ^0x00000200     storage: scanline
1039 >4      lelong          &0x00000200     storage: tiled
1040 >8      search/0x1000   compression\0   \b, compression:
1041 >>&16   byte            0               none
1042 >>&16   byte            1               rle
1043 >>&16   byte            2               zips
1044 >>&16   byte            3               zip
1045 >>&16   byte            4               piz
1046 >>&16   byte            5               pxr24
1047 >>&16   byte            6               b44
1048 >>&16   byte            7               b44a
1049 >>&16   byte            >7              unknown
1050 >8       search/0x1000  dataWindow\0    \b, dataWindow:
1051 >>&10   lelong          x               (%d
1052 >>&14   lelong          x               %d)-
1053 >>&18   lelong          x               \b(%d
1054 >>&22   lelong          x               %d)
1055 >8      search/0x1000   displayWindow\0 \b, displayWindow:
1056 >>&10   lelong          x               (%d
1057 >>&14   lelong          x               %d)-
1058 >>&18   lelong          x               \b(%d
1059 >>&22   lelong          x               %d)
1060 >8      search/0x1000   lineOrder\0      \b, lineOrder:
1061 >>&14   byte            0               increasing y
1062 >>&14   byte            1               decreasing y
1063 >>&14   byte            2               random y
1064 >>&14   byte            >2              unknown
1065
1066 # SMPTE Digital Picture Exchange Format, SMPTE DPX
1067 #
1068 # ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
1069 # Moving-Picture Exchange (DPX), v1.0, 18 February 1994
1070 # Robert Minsk <robertminsk at yahoo.com>
1071 0       string          SDPX    DPX image data, big-endian,
1072 !:mime image/x-dpx
1073 >768    beshort         <4
1074 >>772   belong          x       %dx
1075 >>776   belong          x       \b%d,
1076 >768    beshort         >3
1077 >>776   belong          x       %dx
1078 >>772   belong          x       \b%d,
1079 >768    beshort         0       left to right/top to bottom
1080 >768    beshort         1       right to left/top to bottom
1081 >768    beshort         2       left to right/bottom to top
1082 >768    beshort         3       right to left/bottom to top
1083 >768    beshort         4       top to bottom/left to right
1084 >768    beshort         5       top to bottom/right to left
1085 >768    leshort         6       bottom to top/left to right
1086 >768    leshort         7       bottom to top/right to left
1087
1088 # From: Tom Hilinski <tom.hilinski@comcast.net>
1089 # http://www.unidata.ucar.edu/packages/netcdf/
1090 0       string  CDF\001                 NetCDF Data Format data
1091
1092 #-----------------------------------------------------------------------
1093 # Hierarchical Data Format, used to facilitate scientific data exchange
1094 # specifications at http://hdf.ncsa.uiuc.edu/
1095 0       belong  0x0e031301      Hierarchical Data Format (version 4) data
1096 !:mime  application/x-hdf
1097 0       string  \211HDF\r\n\032\n       Hierarchical Data Format (version 5) data
1098 !:mime  application/x-hdf
1099 512     string  \211HDF\r\n\032\n       Hierarchical Data Format (version 5) with 512 bytes user block
1100 !:mime  application/x-hdf
1101 1024    string  \211HDF\r\n\032\n       Hierarchical Data Format (version 5) with 1k user block
1102 !:mime  application/x-hdf
1103 2048    string  \211HDF\r\n\032\n       Hierarchical Data Format (version 5) with 2k user block
1104 !:mime  application/x-hdf
1105 4096    string  \211HDF\r\n\032\n       Hierarchical Data Format (version 5) with 4k user block
1106 !:mime  application/x-hdf
1107
1108
1109 # From: Tobias Burnus <burnus@net-b.de>
1110 # Xara (for a while: Corel Xara) is a graphic package, see
1111 # http://www.xara.com/ for Windows and as GPL application for Linux
1112 0       string  XARA\243\243    Xara graphics file
1113
1114 # http://www.cartesianinc.com/Tech/
1115 0       string  CPC\262         Cartesian Perceptual Compression image
1116 !:mime  image/x-cpi
1117
1118 # From Albert Cahalan <acahalan@gmail.com>
1119 # puredigital used it for the CVS disposable camcorder
1120 #8       lelong  4       ZBM bitmap image data
1121 #>4      leshort x       %u x
1122 #>6      leshort x       %u
1123
1124 # From Albert Cahalan <acahalan@gmail.com>
1125 # uncompressed 5:6:5 HighColor image for OLPC XO firmware icons
1126 0       string C565     OLPC firmware icon image data
1127 >4      leshort x       %u x
1128 >6      leshort x       %u
1129
1130 # Applied Images - Image files from Cytovision
1131 # Gustavo Junior Alves <gjalves@gjalves.com.br>
1132 0       string  \xce\xda\xde\xfa        Cytovision Metaphases file
1133 0       string  \xed\xad\xef\xac        Cytovision Karyotype file
1134 0       string  \x0b\x00\x03\x00        Cytovision FISH Probe file
1135 0       string  \xed\xfe\xda\xbe        Cytovision FLEX file
1136 0       string  \xed\xab\xed\xfe        Cytovision FLEX file
1137 0       string  \xad\xfd\xea\xad        Cytovision RATS file
1138
1139 # Wavelet Scalar Quantization format used in gray-scale fingerprint images
1140 # From Tano M Fotang <mfotang@quanteq.com>
1141 0       string  \xff\xa0\xff\xa8\x00    Wavelet Scalar Quantization image data
1142
1143 # Type:         PCO B16 image files
1144 # URL:          http://www.pco.de/fileadmin/user_upload/db/download/MA_CWDCOPIE_0412b.pdf
1145 # From:         Florian Philipp <florian.philipp@binarywings.net>
1146 # Extension:    .b16
1147 # Description:  Pixel image format produced by PCO Camware, typically used
1148 #               together with PCO cameras.
1149 # Note:         Different versions exist for e.g. 8 bit and 16 bit images.
1150 #               Documentation is incomplete.
1151 0       string/b        PCO-    PCO B16 image data
1152 >12     lelong          x       \b, %dx
1153 >16     lelong          x       \b%d
1154 >20     lelong          0       \b, short header
1155 >20     lelong          -1      \b, extended header
1156 >>24    lelong          0       \b, grayscale
1157 >>>36   lelong          0       linear LUT
1158 >>>36   lelong          1       logarithmic LUT
1159 >>>28   lelong          x       [%d
1160 >>>32   lelong          x       \b,%d]
1161 >>24    lelong          1       \b, color
1162 >>>64   lelong          0       linear LUT
1163 >>>64   lelong          1       logarithmic LUT
1164 >>>40   lelong          x       r[%d
1165 >>>44   lelong          x       \b,%d]
1166 >>>48   lelong          x       g[%d
1167 >>>52   lelong          x       \b,%d]
1168 >>>56   lelong          x       b[%d
1169 >>>60   lelong          x       \b,%d]
1170
1171 # Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
1172 # From: Markus Heidelberg <markus.heidelberg at web.de>
1173 0       string/t        [BitmapInfo2]   Polar Monitor Bitmap text
1174 !:mime  image/x-polar-monitor-bitmap
1175
1176 # From: Rick Richardson <rickrich@gmail.com>
1177 # updated by: Joerg Jenderek
1178 # URL: http://techmods.net/nuvi/
1179 0       string  GARMIN\ BITMAP\ 01      Garmin Bitmap file
1180 # extension is also used for 
1181 # Sony SRF raw image (image/x-sony-srf)
1182 # SRF map
1183 # Terragen Surface Map (http://www.planetside.co.uk/terragen)
1184 # FileLocator Pro search criteria file (http://www.mythicsoft.com/filelocatorpro)
1185 !:ext srf
1186 #!:mime image/x-garmin-srf
1187 # version 1.00,2.00,2.10,2.40,2.50
1188 >0x2f   string          >0              \b, version %4.4s
1189 # width (2880,2881,3240)
1190 >0x55   uleshort        >0              \b, %dx
1191 # height (80,90)
1192 >>0x53  uleshort        x               \b%d
1193
1194 # Type: Ulead Photo Explorer5 (.pe5)
1195 # URL:  http://www.jisyo.com/cgibin/view.cgi?EXT=pe5 (Japanese)
1196 # From: Simon Horman <horms@debian.org>
1197 0       string  IIO2H                   Ulead Photo Explorer5
1198
1199 # Type: X11 cursor
1200 # URL:  http://webcvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?view=markup
1201 # From: Mathias Brodala <info@noctus.net>
1202 0       string  Xcur                    X11 cursor
1203
1204 # Type: Olympus ORF raw images.
1205 # URL:  http://libopenraw.freedesktop.org/wiki/Olympus_ORF
1206 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
1207 0       string          MMOR            Olympus ORF raw image data, big-endian
1208 !:mime  image/x-olympus-orf
1209 0       string          IIRO            Olympus ORF raw image data, little-endian
1210 !:mime  image/x-olympus-orf
1211 0       string          IIRS            Olympus ORF raw image data, little-endian
1212 !:mime  image/x-olympus-orf
1213
1214 # Type: files used in modern AVCHD camcoders to store clip information
1215 # Extension: .cpi
1216 # From: Alexander Danilov <alexander.a.danilov@gmail.com>
1217 0       string  HDMV0100        AVCHD Clip Information
1218
1219 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
1220 # URL: http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
1221 # Radiance HDR; usually has .pic or .hdr extension.
1222 0       string  #?RADIANCE\n    Radiance HDR image data
1223 #!mime  image/vnd.radiance
1224
1225 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
1226 # URL: http://www.mpi-inf.mpg.de/resources/pfstools/pfs_format_spec.pdf
1227 # Used by the pfstools packages. The regex matches for the image size could
1228 # probably use some work. The MIME type is made up; if there's one in
1229 # actual common use, it should replace the one below.
1230 0       string  PFS1\x0a        PFS HDR image data
1231 #!mime  image/x-pfs
1232 >1      regex   [0-9]*\                 \b, %s
1233 >>1     regex   \ [0-9]{4}              \bx%s
1234
1235 # Type: Foveon X3F
1236 # URL:  http://www.photofo.com/downloads/x3f-raw-format.pdf
1237 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
1238 # Note that the MIME type isn't defined anywhere that I can find; if
1239 # there's a canonical type for this format, it should replace this one.
1240 0       string  FOVb    Foveon X3F raw image data
1241 !:mime  image/x-x3f
1242 >6      leshort x       \b, version %d.
1243 >4      leshort x       \b%d
1244 >28     lelong  x       \b, %dx
1245 >32     lelong  x       \b%d
1246
1247 # Paint.NET file
1248 # From Adam Buchbinder <adam.buchbinder@gmail.com>
1249 0       string  PDN3    Paint.NET image data
1250 !:mime  image/x-paintnet
1251
1252 # Not really an image.
1253 # From: "Tano M. Fotang" <mfotang@quanteq.com>
1254 0       string  \x46\x4d\x52\x00        ISO/IEC 19794-2 Format Minutiae Record (FMR)
1255
1256 # doc: http://www.shikino.co.jp/eng/products/images/FLOWER.jpg.zip
1257 # example: http://www.shikino.co.jp/eng/products/images/FLOWER.wdp.zip
1258 90      bequad          0x574D50484F544F00      JPEG-XR Image
1259 >98     byte&0x08       =0x08                   \b, hard tiling
1260 >99     byte&0x80       =0x80                   \b, tiling present
1261 >99     byte&0x40       =0x40                   \b, codestream present
1262 >99     byte&0x38       x                       \b, spatial xform=
1263 >99     byte&0x38       0x00                    \bTL
1264 >99     byte&0x38       0x08                    \bBL
1265 >99     byte&0x38       0x10                    \bTR
1266 >99     byte&0x38       0x18                    \bBR
1267 >99     byte&0x38       0x20                    \bBT
1268 >99     byte&0x38       0x28                    \bRB
1269 >99     byte&0x38       0x30                    \bLT
1270 >99     byte&0x38       0x38                    \bLB
1271 >100    byte&0x80       =0x80                   \b, short header
1272 >>102   beshort+1       x                       \b, %d
1273 >>104   beshort+1       x                       \bx%d
1274 >100    byte&0x80       =0x00                   \b, long header
1275 >>102   belong+1        x                       \b, %x
1276 >>106   belong+1        x                       \bx%x
1277 >101    beshort&0xf     x                       \b, bitdepth=
1278 >>101   beshort&0xf     0x0                     \b1-WHITE=1
1279 >>101   beshort&0xf     0x1                     \b8
1280 >>101   beshort&0xf     0x2                     \b16
1281 >>101   beshort&0xf     0x3                     \b16-SIGNED
1282 >>101   beshort&0xf     0x4                     \b16-FLOAT
1283 >>101   beshort&0xf     0x5                     \b(reserved 5)
1284 >>101   beshort&0xf     0x6                     \b32-SIGNED
1285 >>101   beshort&0xf     0x7                     \b32-FLOAT
1286 >>101   beshort&0xf     0x8                     \b5
1287 >>101   beshort&0xf     0x9                     \b10
1288 >>101   beshort&0xf     0xa                     \b5-6-5
1289 >>101   beshort&0xf     0xb                     \b(reserved %d)
1290 >>101   beshort&0xf     0xc                     \b(reserved %d)
1291 >>101   beshort&0xf     0xd                     \b(reserved %d)
1292 >>101   beshort&0xf     0xe                     \b(reserved %d)
1293 >>101   beshort&0xf     0xf                     \b1-BLACK=1
1294 >101    beshort&0xf0    x                       \b, colorfmt=
1295 >>101   beshort&0xf0    0x00                    \bYONLY
1296 >>101   beshort&0xf0    0x10                    \bYUV240
1297 >>101   beshort&0xf0    0x20                    \bYWV422
1298 >>101   beshort&0xf0    0x30                    \bYWV444
1299 >>101   beshort&0xf0    0x40                    \bCMYK
1300 >>101   beshort&0xf0    0x50                    \bCMYKDIRECT
1301 >>101   beshort&0xf0    0x60                    \bNCOMPONENT
1302 >>101   beshort&0xf0    0x70                    \bRGB
1303 >>101   beshort&0xf0    0x80                    \bRGBE
1304 >>101   beshort&0xf0    >0x80                   \b(reserved 0x%x)
1305
1306 # From: Johan van der Knijff <johan.vanderknijff@kb.nl>
1307 #
1308 # BPG (Better Portable Graphics) format
1309 # http://bellard.org/bpg/
1310 # http://fileformats.archiveteam.org/wiki/BPG
1311 #
1312 0       string  \x42\x50\x47\xFB        BPG (Better Portable Graphics)
1313 !:mime  image/bpg
1314
1315 # From: Joerg Jenderek
1316 # URL: https://en.wikipedia.org/wiki/Apple_Icon_Image_format
1317 0       string          icns            Mac OS X icon
1318 !:mime  image/x-icns
1319 !:apple ????icns
1320 !:ext icns
1321 >4      ubelong         >0              
1322 # file size
1323 >>4     ubelong         x               \b, %d bytes
1324 # icon type
1325 >>8     string          x               \b, "%4.4s" type
1326
1327 # TIM images
1328 0               lelong          0x00000010      TIM image,
1329 >4              lelong          0x8             4-Bit,
1330 >4              lelong          0x9             8-Bit,
1331 >4              lelong          0x2             15-Bit,
1332 >4              lelong          0x3             24-Bit,
1333 >4              lelong          &8
1334 >>(8.l+12)      leshort         x               Pixel at (%d,
1335 >>(8.l+14)      leshort         x               \b%d)
1336 >>(8.l+16)      leshort         x               Size=%dx
1337 >>(8.l+18)      leshort         x               \b%d,
1338 >>4             lelong          0x8             16 CLUT Entries at
1339 >>4             lelong          0x9             256 CLUT Entries at
1340 >>12            leshort         x               (%d,
1341 >>14            leshort         x               \b%d)
1342 >4              lelong          ^8
1343 >>12            leshort         x               Pixel at (%d,
1344 >>14            leshort         x               \b%d)
1345 >>16            leshort         x               Size=%dx
1346 >>18            leshort         x               \b%d
1347
1348 # MDEC streams
1349 0               lelong          0x80010160      MDEC video stream,
1350 >16             leshort         x               %dx
1351 >18             leshort         x               \b%d
1352 #>8             lelong          x               %d frames
1353 #>4             leshort         x               secCount=%d;
1354 #>6             leshort         x               nSectors=%d;
1355 #>12            lelong          x               frameSize=%d;
1356
1357 # BS encoded bitstreams
1358 2               leshort         0x3800          BS image,
1359 >6              leshort         x               Version %d,
1360 >4              leshort         x               Quantization %d,
1361 >0              leshort         x               (Decompresses to %d words)
1362
1363 # Type: farbfeld image.
1364 # Url: http://tools.suckless.org/farbfeld/
1365 # From: Ian D. Scott <ian@iandouglasscott.com>
1366 #
1367 0               string          farbfeld        farbfeld image data,
1368 >8              ubelong         x               %dx
1369 >12             ubelong         x               \b%d
1370
1371 # Type: Sega PVR image.
1372 # From: David Korth <gerbilsoft@gerbilsoft.com>
1373 # References:
1374 # - http://fabiensanglard.net/Mykaruga/tools/segaPVRFormat.txt
1375 # - https://github.com/yazgoo/pvrx2png
1376 # - https://github.com/nickworonekin/puyotools
1377
1378 # Sega PVR header.
1379 0       name    sega-pvr-image-header
1380 >0x0C   leshort x       %d x
1381 >0x0E   leshort x       %d
1382 # Image format.
1383 >0x08   byte    0       \b, ARGB1555
1384 >0x08   byte    1       \b, RGB565
1385 >0x08   byte    2       \b, ARGB4444
1386 >0x08   byte    3       \b, YUV442
1387 >0x08   byte    4       \b, Bump
1388 >0x08   byte    5       \b, 4bpp
1389 >0x08   byte    6       \b, 8bpp
1390 # Image data type.
1391 >0x09   byte    0x01    \b, square twiddled
1392 >0x09   byte    0x02    \b, square twiddled & mipmap
1393 >0x09   byte    0x03    \b, VQ
1394 >0x09   byte    0x04    \b, VQ & mipmap
1395 >0x09   byte    0x05    \b, 8-bit CLUT twiddled
1396 >0x09   byte    0x06    \b, 4-bit CLUT twiddled
1397 >0x09   byte    0x07    \b, 8-bit direct twiddled
1398 >0x09   byte    0x08    \b, 4-bit direct twiddled
1399 >0x09   byte    0x09    \b, rectangle
1400 >0x09   byte    0x0B    \b, rectangular stride
1401 >0x09   byte    0x0D    \b, rectangular twiddled
1402 >0x09   byte    0x10    \b, small VQ
1403 >0x09   byte    0x11    \b, small VQ & mipmap
1404 >0x09   byte    0x12    \b, square twiddled & mipmap
1405
1406 # Sega PVR (Xbox) image header.
1407 # Contains an embedded DirectDraw surface instead of PVR data.
1408 0       name    sega-pvr-xbox-dds-header
1409 >16     lelong  x       %d x
1410 >12     lelong  x       %d,
1411 >84     string  x       %.4s
1412
1413 # Sega PVR image.
1414 0       string  PVRT
1415 >0x10   string  DDS\040\174\000\000\000 Sega PVR (Xbox) image:
1416 >>0x20  use     sega-pvr-xbox-dds-header
1417 >0x10   belong  !0x44445320             Sega PVR image:
1418 >>0     use     sega-pvr-image-header
1419
1420 # Sega PVR image with GBIX.
1421 0       string  GBIX
1422 >0x10   string  PVRT
1423 >>0x10  string  DDS\040\174\000\000\000 Sega PVR (Xbox) image:
1424 >>>0x20 use     sega-pvr-xbox-dds-header
1425 >>0x10  belong  !0x44445320             Sega PVR image:
1426 >>>0x10 use     sega-pvr-image-header
1427 >>0x08  lelong  x       \b, global index = %u
1428
1429 # Sega GVR header.
1430 0       name    sega-gvr-image-header
1431 >0x0C   beshort x       %d x
1432 >0x0E   beshort x       %d
1433 # Image data format.
1434 >0x0B   byte    0       \b, I4
1435 >0x0B   byte    1       \b, I8
1436 >0x0B   byte    2       \b, IA4
1437 >0x0B   byte    3       \b, IA8
1438 >0x0B   byte    4       \b, RGB565
1439 >0x0B   byte    5       \b, RGB5A3
1440 >0x0B   byte    6       \b, ARGB8888
1441 >0x0B   byte    8       \b, CI4
1442 >0x0B   byte    9       \b, CI8
1443 >0x0B   byte    14      \b, DXT1
1444
1445 # Sega GVR image.
1446 0       string  GVRT    Sega GVR image:
1447 >0x10   use     sega-gvr-image-header
1448
1449 # Sega GVR image with GBIX.
1450 0       string  GBIX
1451 >0x10   string  GVRT    Sega GVR image:
1452 >>0x10  use     sega-gvr-image-header
1453 >>0x08  belong  x       \b, global index = %u