]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/file/magic/Magdir/images
MFV r362254: file 5.39.
[FreeBSD/FreeBSD.git] / contrib / file / magic / Magdir / images
1
2 #------------------------------------------------------------------------------
3 # $File: images,v 1.181 2020/05/30 23:49:03 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 # Conflict with MPEG sequences.
31 !:strength -40
32 # Prevent conflicts with CRI ADX.
33 >(2.S-2) belong !0x28632943
34 # skip more garbage like *.iso by looking for positive image type
35 >>2     ubyte                   >0
36 # skip some compiled terminfo like xterm+tmux by looking for image type less equal 33
37 >>>2    ubyte                   <34
38 # skip arches.3200 , Finder.Root , Slp.1 by looking for low pixel depth 1 8 15 16 24 32
39 >>>>16  ubyte                   1
40 >>>>>0          use             tga-image
41 >>>>16  ubyte                   8
42 >>>>>0          use             tga-image
43 >>>>16  ubyte                   15
44 >>>>>0          use             tga-image
45 >>>>16  ubyte                   16
46 >>>>>0          use             tga-image
47 >>>>16  ubyte                   24
48 >>>>>0          use             tga-image
49 >>>>16  ubyte                   32
50 >>>>>0          use             tga-image
51 #       display tga bitmap image information
52 0       name                            tga-image
53 >2      ubyte           <34             Targa image data
54 !:mime  image/x-tga
55 !:apple ????TPIC
56 # normal extension .tga but some Truevision products used others:
57 # tpic (Apple),icb (Image Capture Board),vda (Video Display Adapter),vst (NuVista),win (UNSURE about that)
58 !:ext   tga/tpic/icb/vda/vst
59 # image type 1 2 3 9 10 11 32 33
60 >2      ubyte&0xF7      1               - Map
61 >2      ubyte&0xF7      2               - RGB
62 # alpha channel
63 >>17    ubyte&0x0F      >0              \bA
64 >2      ubyte&0xF7      3               - Mono
65 # type not found, but by http://www.fileformat.info/format/tga/corion.htm
66 # Compressed color-mapped data, using Huffman, Delta, and runlength encoding
67 >2      ubyte           32              - Color
68 # Compressed color-mapped data, using Huffman, Delta, and RLE. 4-pass quadtree- type process
69 >2      ubyte           33              - Color
70 # Color Map Type 0~no 1~color map
71 >1      ubyte           1               (
72 # first color map entry, 0 normal
73 >>3     uleshort        >0              \b%d-
74 # color map length 0 2 1dh 3bh d9h 100h
75 >>5     uleshort        x               \b%d)
76 # 8~run length encoding bit
77 >2      ubyte&0x08      8               - RLE
78 # gimp can create big pictures!
79 >12     uleshort        >0              %d x
80 >12     uleshort        =0              65536 x
81 # image height. 0 interpreted as 65536
82 >14     uleshort        >0              %d
83 >14     uleshort        =0              65536
84 # Image Pixel depth 1 8 15 16 24 32
85 >16     ubyte           x               x %d
86 # X origin of image. 0 normal
87 >8      uleshort        >0              +%d
88 # Y origin of image. 0 normal; positive for top
89 >10     uleshort        >0              +%d
90 # Image descriptor: bits 3-0 give the alpha channel depth, bits 5-4 give direction
91 >17     ubyte&0x0F      >0              - %d-bit alpha
92 # bits 5-4 give direction. normal bottom left
93 >17     ubyte           &0x20           - top
94 #>17    ubyte           ^0x20           - bottom
95 >17     ubyte           &0x10           - right
96 #>17    ubyte           ^0x10           - left
97 # some info say other bits 6-7 should be zero
98 # but data storage interleave by http://www.fileformat.info/format/tga/corion.htm
99 # 00 - no interleave;01 - even/odd interleave; 10 - four way interleave; 11 - reserved
100 #>17    ubyte&0xC0      0x00            - no interleave
101 >17     ubyte&0xC0      0x40            - interleave
102 >17     ubyte&0xC0      0x80            - four way interleave
103 >17     ubyte&0xC0      0xC0            - reserved
104 # positive length implies identification field
105 >0      ubyte           >0
106 >>18    string          x               "%s"
107 # last 18 bytes of newer tga file footer signature
108 >18     search/4261301/s        TRUEVISION-XFILE.\0
109 # extension area offset if not 0
110 >>&-8           ulelong                 >0
111 # length of the extension area. normal 495 for version 2.0
112 >>>(&-4.l)      uleshort                0x01EF
113 # AuthorName[41]
114 >>>>&0          string                  >\0             - author "%-.40s"
115 # Comment[324]=4 * 80 null terminated
116 >>>>&41         string                  >\0             - comment "%-.80s"
117 # date
118 >>>>&365        ubequad&0xffffFFFFffff0000      !0
119 # Day
120 >>>>>&-6                uleshort                x               %d
121 # Month
122 >>>>>&-8                uleshort                x               \b-%d
123 # Year
124 >>>>>&-4                uleshort                x               \b-%d
125 # time
126 >>>>&371        ubequad&0xffffFFFFffff0000      !0
127 # hour
128 >>>>>&-8                uleshort                x               %d
129 # minutes
130 >>>>>&-6                uleshort                x               \b:%.2d
131 # second
132 >>>>>&-4                uleshort                x               \b:%.2d
133 # JobName[41]
134 >>>>&377                string                  >\0             - job "%-.40s"
135 # JobHour Jobminute Jobsecond
136 >>>>&418        ubequad&0xffffFFFFffff0000      !0
137 >>>>>&-8                uleshort                x               %d
138 >>>>>&-6                uleshort                x               \b:%.2d
139 >>>>>&-4                uleshort                x               \b:%.2d
140 # SoftwareId[41]
141 >>>>&424                string                  >\0             - %-.40s
142 # SoftwareVersionNumber
143 >>>>&424        ubyte                           >0
144 >>>>>&40                uleshort/100            x               %d
145 >>>>>&40                uleshort%100            x               \b.%d
146 # VersionLetter
147 >>>>>&42                ubyte                   >0x20           \b%c
148 # KeyColor
149 >>>>&468                ulelong                 >0              - keycolor 0x%8.8x
150 # Denominator of Pixel ratio. 0~no pixel aspect
151 >>>>&474        uleshort                        >0
152 # Numerator
153 >>>>>&-4                uleshort                >0              - aspect %d
154 >>>>>&-2                uleshort                x               \b/%d
155 # Denominator of Gamma ratio. 0~no Gamma value
156 >>>>&478        uleshort                        >0
157 # Numerator
158 >>>>>&-4                uleshort                >0              - gamma %d
159 >>>>>&-2                uleshort                x               \b/%d
160 # ColorOffset
161 #>>>>&480       ulelong                 x               - col offset 0x%8.8x
162 # StampOffset
163 #>>>>&484       ulelong                 x               - stamp offset 0x%8.8x
164 # ScanOffset
165 #>>>>&488       ulelong                 x               - scan offset 0x%8.8x
166 # AttributesType
167 #>>>>&492       ubyte                   x               - Attributes 0x%x
168 ## EndOfTGA
169
170 # PBMPLUS images
171 # The next byte following the magic is always whitespace.
172 # strength is changed to try these patterns before "x86 boot sector"
173 0       name            netpbm
174 >3      regex/s         =[0-9]{1,50}\ [0-9]{1,50}       Netpbm image data
175 >>&0    regex           =[0-9]{1,50}                    \b, size = %s x
176 >>>&0   regex           =[0-9]{1,50}                    \b %s
177
178 0       search/1        P1
179 >0      regex/4         P1[\040\t\f\r\n]
180 >>0     use             netpbm
181 >>0     string          x       \b, bitmap
182 !:strength + 65
183 !:mime  image/x-portable-bitmap
184
185 0       search/1        P2
186 >0      regex/4         P2[\040\t\f\r\n]
187 >>0     use             netpbm
188 >>0     string          x       \b, greymap
189 !:strength + 65
190 !:mime  image/x-portable-greymap
191
192 0       search/1        P3
193 >0      regex/4         P3[\040\t\f\r\n]
194 >>0     use             netpbm
195 >>0     string          x       \b, pixmap
196 !:strength + 65
197 !:mime  image/x-portable-pixmap
198
199 0       string          P4
200 >0      regex/4         P4[\040\t\f\r\n]
201 >>0     use             netpbm
202 >>0     string          x       \b, rawbits, bitmap
203 !:strength + 65
204 !:mime  image/x-portable-bitmap
205
206 0       string          P5
207 >0      regex/4         P5[\040\t\f\r\n]
208 >>0     use             netpbm
209 >>0     string          x       \b, rawbits, greymap
210 !:strength + 65
211 !:mime  image/x-portable-greymap
212
213 0       string          P6
214 >0      regex/4         P6[\040\t\f\r\n]
215 >>0     use             netpbm
216 >>0     string          x       \b, rawbits, pixmap
217 !:strength + 65
218 !:mime  image/x-portable-pixmap
219
220 0       string          P7              Netpbm PAM image file
221 !:mime  image/x-portable-pixmap
222
223 # From: bryanh@giraffe-data.com (Bryan Henderson)
224 0       string          \117\072        Solitaire Image Recorder format
225 >4      string          \013            MGI Type 11
226 >4      string          \021            MGI Type 17
227 0       string          .MDA            MicroDesign data
228 >21     byte            48              version 2
229 >21     byte            51              version 3
230 0       string          .MDP            MicroDesign page data
231 >21     byte            48              version 2
232 >21     byte            51              version 3
233
234 # NIFF (Navy Interchange File Format, a modification of TIFF) images
235 # [GRR:  this *must* go before TIFF]
236 0       string          IIN1            NIFF image data
237 !:mime  image/x-niff
238
239 # Canon RAW version 1 (CRW) files are a type of Canon Image File Format
240 # (CIFF) file. These are apparently all little-endian.
241 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
242 # URL: https://www.sno.phy.queensu.ca/~phil/exiftool/canon_raw.html
243 0       string          II\x1a\0\0\0HEAPCCDR    Canon CIFF raw image data
244 !:mime  image/x-canon-crw
245 >16     leshort         x       \b, version %d.
246 >14     leshort         x       \b%d
247
248 # Canon RAW version 2 (CR2) files are a kind of TIFF with an extra magic
249 # number. Put this above the TIFF test to make sure we detect them.
250 # These are apparently all little-endian.
251 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
252 # URL: https://libopenraw.freedesktop.org/wiki/Canon_CR2
253 0       string          II\x2a\0\x10\0\0\0CR    Canon CR2 raw image data
254 !:mime  image/x-canon-cr2
255 !:strength +80
256 >10     byte            x       \b, version %d.
257 >11     byte            x       \b%d
258
259 # Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
260 # The second word of TIFF files is the TIFF version number, 42, which has
261 # never changed.  The TIFF specification recommends testing for it.
262 0       string          MM\x00\x2a      TIFF image data, big-endian
263 !:strength +70
264 !:mime  image/tiff
265 >(4.L)  use             \^tiff_ifd
266 0       string          II\x2a\x00      TIFF image data, little-endian
267 !:mime  image/tiff
268 !:strength +70
269 >(4.l)  use             tiff_ifd
270
271 0       name            tiff_ifd
272 >0      leshort         x               \b, direntries=%d
273 >2      use             tiff_entry
274
275 0       name            tiff_entry
276 # NewSubFileType
277 >0      leshort         0xfe
278 >>12    use             tiff_entry
279 >0      leshort         0x100
280 >>4     lelong          1
281 >>>12   use             tiff_entry
282 >>>8    leshort         x               \b, width=%d
283 >0      leshort         0x101
284 >>4     lelong          1
285 >>>8    leshort         x               \b, height=%d
286 >>>12   use             tiff_entry
287 >0      leshort         0x102
288 >>8     leshort         x               \b, bps=%d
289 >>12    use             tiff_entry
290 >0      leshort         0x103
291 >>4     lelong          1               \b, compression=
292 >>>8    leshort         1               \bnone
293 >>>8    leshort         2               \bhuffman
294 >>>8    leshort         3               \bbi-level group 3
295 >>>8    leshort         4               \bbi-level group 4
296 >>>8    leshort         5               \bLZW
297 >>>8    leshort         6               \bJPEG (old)
298 >>>8    leshort         7               \bJPEG
299 >>>8    leshort         8               \bdeflate
300 >>>8    leshort         9               \bJBIG, ITU-T T.85
301 >>>8    leshort         0xa             \bJBIG, ITU-T T.43
302 >>>8    leshort         0x7ffe          \bNeXT RLE 2-bit
303 >>>8    leshort         0x8005          \bPackBits (Macintosh RLE)
304 >>>8    leshort         0x8029          \bThunderscan RLE
305 >>>8    leshort         0x807f          \bRasterPadding (CT or MP)
306 >>>8    leshort         0x8080          \bRLE (Line Work)
307 >>>8    leshort         0x8081          \bRLE (High-Res Cont-Tone)
308 >>>8    leshort         0x8082          \bRLE (Binary Line Work)
309 >>>8    leshort         0x80b2          \bDeflate (PKZIP)
310 >>>8    leshort         0x80b3          \bKodak DCS
311 >>>8    leshort         0x8765          \bJBIG
312 >>>8    leshort         0x8798          \bJPEG2000
313 >>>8    leshort         0x8799          \bNikon NEF Compressed
314 >>>8    default         x
315 >>>>8   leshort         x               \b(unknown 0x%x)
316 >>>12   use             tiff_entry
317 >0      leshort         0x106           \b, PhotometricIntepretation=
318 >>8     clear           x
319 >>8     leshort         0               \bWhiteIsZero
320 >>8     leshort         1               \bBlackIsZero
321 >>8     leshort         2               \bRGB
322 >>8     leshort         3               \bRGB Palette
323 >>8     leshort         4               \bTransparency Mask
324 >>8     leshort         5               \bCMYK
325 >>8     leshort         6               \bYCbCr
326 >>8     leshort         8               \bCIELab
327 >>8     default         x
328 >>>8    leshort         x               \b(unknown=0x%x)
329 >>12    use             tiff_entry
330 # FillOrder
331 >0      leshort         0x10a
332 >>4     lelong          1
333 >>>12   use             tiff_entry
334 # DocumentName
335 >0      leshort         0x10d
336 >>(8.l) string          x               \b, name=%s
337 >>>12   use             tiff_entry
338 # ImageDescription
339 >0      leshort         0x10e
340 >>(8.l) string          x               \b, description=%s
341 >>>12   use             tiff_entry
342 # Make
343 >0      leshort         0x10f
344 >>(8.l) string          x               \b, manufacturer=%s
345 >>>12   use             tiff_entry
346 # Model
347 >0      leshort         0x110
348 >>(8.l) string          x               \b, model=%s
349 >>>12   use             tiff_entry
350 # StripOffsets
351 >0      leshort         0x111
352 >>12    use             tiff_entry
353 # Orientation
354 >0      leshort         0x112           \b, orientation=
355 >>8     leshort         1               \bupper-left
356 >>8     leshort         3               \blower-right
357 >>8     leshort         6               \bupper-right
358 >>8     leshort         8               \blower-left
359 >>8     leshort         9               \bundefined
360 >>8     default         x
361 >>>8    leshort         x               \b[*%d*]
362 >>12    use             tiff_entry
363 # XResolution
364 >0      leshort         0x11a
365 >>8     lelong          x               \b, xresolution=%d
366 >>12    use             tiff_entry
367 # YResolution
368 >0      leshort         0x11b
369 >>8     lelong          x               \b, yresolution=%d
370 >>12    use             tiff_entry
371 # ResolutionUnit
372 >0      leshort         0x128
373 >>8     leshort         x               \b, resolutionunit=%d
374 >>12    use             tiff_entry
375 # Software
376 >0      leshort         0x131
377 >>(8.l) string          x               \b, software=%s
378 >>12    use             tiff_entry
379 # Datetime
380 >0      leshort         0x132
381 >>(8.l) string          x               \b, datetime=%s
382 >>12    use             tiff_entry
383 # HostComputer
384 >0      leshort         0x13c
385 >>(8.l) string          x               \b, hostcomputer=%s
386 >>12    use             tiff_entry
387 # WhitePoint
388 >0      leshort         0x13e
389 >>12    use             tiff_entry
390 # PrimaryChromaticities
391 >0      leshort         0x13f
392 >>12    use             tiff_entry
393 # YCbCrCoefficients
394 >0      leshort         0x211
395 >>12    use             tiff_entry
396 # YCbCrPositioning
397 >0      leshort         0x213
398 >>12    use             tiff_entry
399 # ReferenceBlackWhite
400 >0      leshort         0x214
401 >>12    use             tiff_entry
402 # Copyright
403 >0      leshort         0x8298
404 >>(8.l) string          x               \b, copyright=%s
405 >>12    use             tiff_entry
406 # ExifOffset
407 >0      leshort         0x8769
408 >>12    use             tiff_entry
409 # GPS IFD
410 >0      leshort         0x8825          \b, GPS-Data
411 >>12    use             tiff_entry
412
413 #>0     leshort         x               \b, unknown=0x%x
414 #>>12   use             tiff_entry
415
416 0       string          MM\x00\x2b      Big TIFF image data, big-endian
417 !:mime  image/tiff
418 0       string          II\x2b\x00      Big TIFF image data, little-endian
419 !:mime  image/tiff
420
421 # PNG [Portable Network Graphics, or "PNG's Not GIF"] images
422 # (Greg Roelofs, newt@uchicago.edu)
423 # (Albert Cahalan, acahalan@cs.uml.edu)
424 #
425 # 137 P N G \r \n ^Z \n [4-byte length] I H D R [HEAD data] [HEAD crc] ...
426 #
427
428 # IHDR parser
429 0       name            png-ihdr
430 >0      belong          x               \b, %d x
431 >4      belong          x               %d,
432 >8      byte            x               %d-bit
433 >9      byte            0               grayscale,
434 >9      byte            2               \b/color RGB,
435 >9      byte            3               colormap,
436 >9      byte            4               gray+alpha,
437 >9      byte            6               \b/color RGBA,
438 #>10    byte            0               deflate/32K,
439 >12     byte            0               non-interlaced
440 >12     byte            1               interlaced
441
442 # Standard PNG image.
443 0       string          \x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0DIHDR     PNG image data
444 !:mime  image/png
445 !:ext   png
446 !:strength +10
447 >16     use             png-ihdr
448
449 # Apple CgBI PNG image.
450 0       string          \x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x04CgBI
451 >24     string          \x00\x00\x00\x0DIHDR    PNG image data (CgBI)
452 !:mime  image/png
453 !:ext   png
454 !:strength +10
455 >>32    use             png-ihdr
456
457 # possible GIF replacements; none yet released!
458 # (Greg Roelofs, newt@uchicago.edu)
459 #
460 # GRR 950115:  this was mine ("Zip GIF"):
461 0       string          GIF94z          ZIF image (GIF+deflate alpha)
462 !:mime  image/x-unknown
463 #
464 # GRR 950115:  this is Jeremy Wohl's Free Graphics Format (better):
465 #
466 0       string          FGF95a          FGF image (GIF+deflate beta)
467 !:mime  image/x-unknown
468 #
469 # GRR 950115:  this is Thomas Boutell's Portable Bitmap Format proposal
470 # (best; not yet implemented):
471 #
472 0       string          PBF             PBF image (deflate compression)
473 !:mime  image/x-unknown
474
475 # GIF
476 # Strength set up to beat 0x55AA DOS/MBR signature word lookups (+65)
477 0       string          GIF8            GIF image data
478 !:strength +80
479 !:mime  image/gif
480 !:apple 8BIMGIFf
481 >4      string          7a              \b, version 8%s,
482 >4      string          9a              \b, version 8%s,
483 >6      leshort         >0              %d x
484 >8      leshort         >0              %d
485 #>10    byte            &0x80           color mapped,
486 #>10    byte&0x07       =0x00           2 colors
487 #>10    byte&0x07       =0x01           4 colors
488 #>10    byte&0x07       =0x02           8 colors
489 #>10    byte&0x07       =0x03           16 colors
490 #>10    byte&0x07       =0x04           32 colors
491 #>10    byte&0x07       =0x05           64 colors
492 #>10    byte&0x07       =0x06           128 colors
493 #>10    byte&0x07       =0x07           256 colors
494
495 # ITC (CMU WM) raster files.  It is essentially a byte-reversed Sun raster,
496 # 1 plane, no encoding.
497 0       string          \361\0\100\273  CMU window manager raster image data
498 >4      lelong          >0              %d x
499 >8      lelong          >0              %d,
500 >12     lelong          >0              %d-bit
501
502 # Magick Image File Format
503 # URL:          https://imagemagick.org/script/miff.php
504 # Reference:    http://fileformats.archiveteam.org/wiki/MIFF
505 # Update:       Joerg Jenderek
506 # http://www.nationalarchives.gov.uk/pronom/fmt/930
507 0       search/256/bc   id=imagemagick
508 # skip bad ASCII text by following new line~0x0A or space~0x20 character
509 #>&0    ubyte           x               \b, next character 0x%x
510 # called by TriD ImageMagick Machine independent File Format bitmap
511 >&0     ubyte&0xD5      0               MIFF image data
512 # https://reposcope.com/mimetype/image/miff
513 #!:mime image/miff
514 !:mime  image/x-miff
515 !:ext   miff/mif
516 # examples with standard file(1) magic
517 #>>0    string          =id=ImageMagick with standard magic
518 # examples with unusual file(1) magic like 
519 >>0     string          !id=ImageMagick starting with
520 # start with comment (brace) like http://samples.fileformat.info/.../AQUARIUM.MIF
521 >>>0    ubyte           =0x7b           comment
522 # skip second character which is often a newline and show comment
523 >>>>2   string          x               "%s"
524 # does not start with comment, probably letters with other case like Id=ImageMagick
525 # ImageMagick-7.0.9-2/Magick++/demo/smile_anim.miff
526 >>>0    ubyte           !0x7b
527 >>>>0   string          >\0             '%-.14s'
528 # URL:          https://imagemagick.org/
529 # Reference:    https://imagemagick.org/script/magick-vector-graphics.php
530 # From:         Joerg Jenderek
531 # Note:         all white-spaces between commands are ignored
532 0       string          push
533 # skip some white spaces
534 >5      search/3        graphic-context ImageMagick Vector Graphic
535 # TODO: look for dangerous commands like CVE-2016-3715
536 #!:mime text/plain
537 !:mime  image/x-mvg
538 !:ext   mvg
539
540 # Artisan
541 0       long            1123028772      Artisan image data
542 >4      long            1               \b, rectangular 24-bit
543 >4      long            2               \b, rectangular 8-bit with colormap
544 >4      long            3               \b, rectangular 32-bit (24-bit with matte)
545
546 # FIG (Facility for Interactive Generation of figures), an object-based format
547 0       search/1        #FIG            FIG image text
548 >5      string          x               \b, version %.3s
549
550 # PHIGS
551 0       string          ARF_BEGARF              PHIGS clear text archive
552 0       string          @(#)SunPHIGS            SunPHIGS
553 # version number follows, in the form m.n
554 >40     string          SunBin                  binary
555 >32     string          archive                 archive
556
557 # GKS (Graphics Kernel System)
558 0       string          GKSM            GKS Metafile
559 >24     string          SunGKS          \b, SunGKS
560
561 # CGM image files
562 0       string          BEGMF           clear text Computer Graphics Metafile
563
564 # MGR bitmaps  (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
565 0       string  yz      MGR bitmap, modern format, 8-bit aligned
566 0       string  zz      MGR bitmap, old format, 1-bit deep, 16-bit aligned
567 0       string  xz      MGR bitmap, old format, 1-bit deep, 32-bit aligned
568 0       string  yx      MGR bitmap, modern format, squeezed
569
570 # Fuzzy Bitmap (FBM) images
571 0       string          %bitmap\0       FBM image data
572 >30     long            0x31            \b, mono
573 >30     long            0x33            \b, color
574
575 # facsimile data
576 1       string          PC\ Research,\ Inc      group 3 fax data
577 >29     byte            0               \b, normal resolution (204x98 DPI)
578 >29     byte            1               \b, fine resolution (204x196 DPI)
579 # From: Herbert Rosmanith <herp@wildsau.idv.uni.linz.at>
580 0       string          Sfff            structured fax file
581
582 # From: Joerg Jenderek <joerg.jen.der.ek@gmx.net>
583 # most files with the extension .EPA and some with .BMP
584 0       string          \x11\x06        Award BIOS Logo, 136 x 84
585 !:mime  image/x-award-bioslogo
586 0       string          \x11\x09        Award BIOS Logo, 136 x 126
587 !:mime  image/x-award-bioslogo
588 #0      string          \x07\x1f        BIOS Logo corrupted?
589 # http://www.blackfiveservices.co.uk/awbmtools.shtml
590 # http://biosgfx.narod.ru/v3/
591 # http://biosgfx.narod.ru/abr-2/
592 0       string          AWBM
593 >4      leshort         <1981           Award BIOS bitmap
594 !:mime  image/x-award-bmp
595 # image width is a multiple of 4
596 >>4     leshort&0x0003  0
597 >>>4            leshort x               \b, %d
598 >>>6            leshort x               x %d
599 >>4     leshort&0x0003  >0              \b,
600 >>>4    leshort&0x0003  =1
601 >>>>4           leshort x               %d+3
602 >>>4    leshort&0x0003  =2
603 >>>>4           leshort x               %d+2
604 >>>4    leshort&0x0003  =3
605 >>>>4           leshort x               %d+1
606 >>>6            leshort x               x %d
607 # at offset 8 starts imagedata followed by "RGB " marker
608
609 # PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
610 # https://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.\
611 # 28bitmap_information_header.29
612 # Note: variant starting direct with DIB header see
613 #       http://fileformats.archiveteam.org/wiki/BMP
614 #       verified by ImageMagick version 6.8.9-8 command `identify *.dib`
615 0       leshort         40
616 # skip bad samples like GAME by looking for valid number of color planes
617 >12     uleshort        1               Device independent bitmap graphic
618 !:mime  image/bmp
619 !:apple ????BMPp
620 !:ext   dib
621 >>4     lelong          x               \b, %d x
622 >>8     lelong          x               %d x
623 >>14    leshort         x               %d
624 # number of color planes (must be 1) 
625 #>>12   uleshort        >1              \b, %u color planes
626 # compression method: 0~no 1~RLE 8-bit/pixel 3~Huffman 1D
627 #>>16   ulelong         3               \b, Huffman 1D compression
628 >>16    ulelong         >0              \b, %u compression
629 # image size is the size of raw bitmap; a dummy 0 can be given for BI_RGB bitmaps
630 >>20    ulelong         x               \b, image size %u
631 # horizontal and vertical resolution of the image (pixel per metre, signed integer) 
632 >>24    lelong          >0              \b, resolution %d x
633 >>>28   lelong          x               %d px/m
634 # number of colors in palette, or 0 to default to 2**n
635 #>>32   ulelong         >0              \b, %u colors
636 # number of important colors used, or 0 when every color is important
637 >>36    ulelong         >0              \b, %u important colors
638 0       string          BM
639 >14     leshort         12              PC bitmap, OS/2 1.x format
640 !:mime  image/x-ms-bmp
641 >>18    leshort         x               \b, %d x
642 >>20    leshort         x               %d
643 >14     leshort         64              PC bitmap, OS/2 2.x format
644 !:mime  image/bmp
645 !:apple ????BMPp
646 !:ext   bmp
647 # image width and height fields are unsigned integers for OS/2
648 >>18    ulelong         x               \b, %u x
649 >>22    ulelong         x               %u
650 # number of bits per pixel (color depth); found 1 4 8
651 >>28    uleshort        >1              x %u
652 # x, y coordinates of the hotspot
653 >>6     uleshort        >0              \b, hotspot %ux
654 >>>8    uleshort        x               \b%u
655 >>26    uleshort        >1              \b, %u color planes
656 # cbSize; size of file or headers
657 >>2     ulelong         x               \b, cbSize %u
658 #>>2    ulelong         x               \b, cbSize 0x%x
659 # offBits; offset to bitmap data like 56h 5Eh 8Eh 43Eh
660 >>10    ulelong                 x       \b, bits offset %u
661 #>>10   ulelong                 x       \b, bits offset 0x%x
662 #>>(10.l) ubequad               !0      \b, bits 0x%16.16llx
663 # BITMAPV2INFOHEADER    adds RGB bit masks
664 >14     leshort         52              PC bitmap, Adobe Photoshop
665 !:mime  image/bmp
666 !:apple ????BMPp
667 !:ext   bmp
668 >>18    lelong          x               \b, %d x
669 >>22    lelong          x               %d x
670 >>28    leshort         x               %d
671 # BITMAPV3INFOHEADER    adds alpha channel bit mask
672 >14     leshort         56              PC bitmap, Adobe Photoshop with alpha channel mask
673 !:mime  image/bmp
674 !:apple ????BMPp
675 !:ext   bmp
676 >>18    lelong          x               \b, %d x
677 >>22    lelong          x               %d x
678 >>28    leshort         x               %d
679 >14     leshort         40
680 # jump 4 bytes before end of file/header to skip fmt-116-signature-id-118.dib
681 >>(2.l-4)       ulong   x               PC bitmap, Windows 3.x format
682 !:mime  image/bmp
683 !:apple ????BMPp
684 >>>18   lelong          x               \b, %d x
685 >>>22   lelong          x               %d
686 # 320 x 400             https://en.wikipedia.org/wiki/LOGO.SYS
687 >>>18   ulequad         =0x0000019000000140     x
688 !:ext   bmp/sys
689 >>>18   ulequad         !0x0000019000000140
690 # compression method 2~RLE 4-bit/pixel implies also extension rle
691 >>>>30  ulelong         2               x
692 !:ext   bmp/rle
693 >>>>30  default         x               x
694 !:ext   bmp
695 # number of bits per pixel (color depth); found 1 2 4 8 16 24 32
696 >>>28   leshort         x               %d
697 # x, y coordinates of the hotspot; there is no hotspot in bitmaps, so values 0
698 #>>>6   uleshort        >0              \b, hotspot %ux
699 #>>>>8  uleshort        x               \b%u
700 # number of color planes (must be 1), except badplanes.bmp for testing
701 #>>>26  uleshort        >1              \b, %u color planes
702 # compression method: 0~no 1~RLE 8-bit/pixel 2~RLE 4-bit/pixel 3~Huffman 1D 6~RGBA bit field masks
703 #>>>30  ulelong         3               \b, Huffman 1D compression
704 >>>30   ulelong         >0              \b, %u compression
705 # image size is the size of raw bitmap; a dummy 0 can be given for BI_RGB bitmaps
706 >>>34   ulelong         >0              \b, image size %u
707 # horizontal and vertical resolution of the image (pixel per metre, signed integer) 
708 >>>38   lelong          >0              \b, resolution %d x
709 >>>>42  lelong          x               %d px/m
710 # number of colors in palette 16 256, or 0 to default to 2**n
711 #>>>46  ulelong         >0              \b, %u colors
712 # number of important colors used, or 0 when every color is important
713 >>>50   ulelong         >0              \b, %u important colors
714 # cbSize; often size of file
715 >>>2    ulelong         x               \b, cbSize %u
716 #>>>2   ulelong         x               \b, cbSize 0x%x
717 # offBits; offset to bitmap data like 36h 76h BEh 236h 406h 436h 4E6h
718 >>>10   ulelong                 x       \b, bits offset %u
719 #>>>10  ulelong                 x       \b, bits offset 0x%x
720 #>>>(10.l) ubequad              !0      \b, bits 0x%16.16llxd
721 >14     leshort         124             PC bitmap, Windows 98/2000 and newer format
722 !:mime  image/x-ms-bmp
723 >>18    lelong          x               \b, %d x
724 >>22    lelong          x               %d x
725 >>28    leshort         x               %d
726 >14     leshort         108             PC bitmap, Windows 95/NT4 and newer format
727 !:mime  image/x-ms-bmp
728 >>18    lelong          x               \b, %d x
729 >>22    lelong          x               %d x
730 >>28    leshort         x               %d
731 >14     leshort         128             PC bitmap, Windows NT/2000 format
732 !:mime  image/x-ms-bmp
733 >>18    lelong          x               \b, %d x
734 >>22    lelong          x               %d x
735 >>28    leshort         x               %d
736 # Update:       Joerg Jenderek
737 # URL:          http://fileformats.archiveteam.org/wiki/OS/2_Icon
738 # Reference:    http://www.fileformat.info
739 #               /format/os2bmp/spec/902d5c253f2a43ada39c2b81034f27fd/view.htm
740 # Note: verified by command like `deark -l -d3 OS2MEMU.ICO`
741 0       string                  IC
742 # skip Lotus smart icon *.smi by looking for valid hotspot coordinates
743 >6      ulelong&0xFF00FF00      =0      OS/2 icon
744 # jump 4 bytes before end of header/file and test for accessibility
745 #>>(2.l-4) ubelong              x       End of header is OK!
746 !:mime  image/x-os2-ico
747 !:ext   ico
748 # cbSize; size of header or file in bytes like 1ah 120h 420h
749 >>2     ulelong                 x       \b, cbSize %u
750 # xHotspot, yHotspot; coordinates of the hotspot for icons like 16 32
751 >>6     uleshort                x       \b, hotspot %ux
752 >>8     uleshort                x       \b%u
753 # offBits; offset in bytes to the beginning of the bit-map pel data like 20h
754 >>10    ulelong                 x       \b, bits offset %u
755 #>>(10.l) ubequad               x       \b, bits 0x%16.16llx
756 #0      string          PI              PC pointer image data
757 #0      string          CI              PC color icon data
758 0       string          CI
759 # test also for valid dib header sizes 12 or 64
760 >14     ulelong         <65             OS/2
761 # test also for valid hotspot coordinates
762 #>>6    ulelong&0xFE00FE00      =0      OS/2
763 !:mime  image/x-os2-ico
764 !:ext   ico
765 >>14    ulelong         12              1.x color icon
766 # image width and height fields are unsigned integers for OS/2
767 >>>18   uleshort        x               %u x
768 # stored height = 2 * real height
769 >>>20   uleshort/2      x               %u
770 # number of bits per pixel (color depth). Typical 32 24 16 8 4 but only 1 found
771 >>>24   uleshort        >1              x %u
772 # color planes; must be 1
773 #>>>22  uleshort        >1              \b, %u color planes
774 >>14    ulelong         64              2.x color icon
775 # image width and height
776 >>>18   ulelong         x               %u x
777 # stored height = 2 * real height
778 >>>22   ulelong/2       x               %u
779 # number of bits per pixel (color depth). only 1 found
780 >>>28   uleshort        >1              x %u
781 #>>>26  uleshort        >1              \b, %u color planes
782 # compression method: 0~no 3~Huffman 1D
783 >>>30   ulelong         3               \b, Huffman 1D compression
784 #>>>30  ulelong         >0              \b, %u compression
785 # xHotspot, yHotspot; coordinates of the hotspot like 0 1 16 20 32 33 63 64
786 >>6     uleshort                x       \b, hotspot %ux
787 >>8     uleshort                x       \b%u
788 # cbSize; size of header or maybe file in bytes like 1Ah 4Eh 84Eh
789 >>2     ulelong                 x       \b, cbSize %u
790 #>>2    ulelong                 x       \b, cbSize %x
791 # offBits; offset to bitmap data (pixel array) like E4h 3Ah 66h 6Ah 33Ah 4A4h
792 >>10    ulelong                 x       \b, bits offset %u
793 #>>10   ulelong                 x       \b, bits offset 0x%x
794 #>>(10.l) ubequad               !0      \b, bits 0x%16.16llx
795 # dib header size: 12~Ch~OS/2 1.x 64~40h~OS/2 2.x
796 #>>14   ulelong         x               \b, dib header size %u
797 #0      string          CP              PC color pointer image data
798 # URL:          http://fileformats.archiveteam.org/wiki/OS/2_Pointer
799 # Reference:    http://www.fileformat.info/format/os2bmp/egff.htm
800 0       string          CP
801 # skip CPU-Z Report by checking for valid dib header sizes 12 or 64
802 >14     ulelong         <65             OS/2
803 # http://extension.nirsoft.net/PTR
804 !:mime  image/x-ibm-pointer
805 !:ext   ptr
806 >>14    ulelong         12              1.x color pointer
807 # image width and height fields are unsigned integers for OS/2
808 >>>18   uleshort        x               %u x
809 # stored height = 2 * real height
810 >>>20   uleshort/2      x               %u
811 # number of bits per pixel (color depth). Typical 32 24 16 8 4 but only 1 found
812 >>>24   uleshort        >1              x %u
813 # color planes; must be 1
814 #>>>22  uleshort        >1              \b, %u color planes
815 >>14    ulelong         64              2.x color pointer
816 # image width and height
817 >>>18   ulelong         x               %u x
818 # stored height = 2 * real height
819 >>>22   ulelong/2       x               %u
820 # number of bits per pixel (color depth). only 1 found
821 >>>28   uleshort        >1              x %u
822 #>>>26  uleshort        >1              \b, %u color planes
823 # compression method: 0~no 3~Huffman 1D
824 >>>30   ulelong         3               \b, Huffman 1D compression
825 #>>>30  ulelong         >0              \b, %u compression
826 # xHotspot, yHotspot; coordinates of the hotspot like 0 3 4 8 15 16 23 27 31
827 >>6     uleshort                x       \b, hotspot %ux
828 >>8     uleshort                x       \b%u
829 # cbSize; size of header or maybe file in bytes like 1Ah 4Eh
830 >>2     ulelong                 x       \b, cbSize %u
831 #>>2    ulelong                 x       \b, cbSize %x
832 # offBits; offset to bitmap data (pixel array) like 6Ah A4h E4h 4A4h
833 >>10    ulelong                 x       \b, bits offset %u
834 #>>10   ulelong                 x       \b, bits offset 0x%x
835 #>>(10.l) ubequad               !0      \b, bits 0x%16.16llx
836 # dib header size: 12~Ch~OS/2 1.x 64~40h~OS/2 2.x
837 #>>14   ulelong         x               \b, dib header size %u
838 # Conflicts with other entries [BABYL]
839 # URL:  http://fileformats.archiveteam.org/wiki/BMP#OS.2F2_Bitmap_Array
840 # Note: container for OS/2 icon "IC", color icon "CI", color pointer "CP" or bitmap "BM"
841 #0      string          BA              PC bitmap array data
842 0       string          BA
843 # skip old Emacs RMAIL BABYL ./mail.news by checking for low header size
844 >2      ulelong         <0x004c5942     OS/2 graphic array
845 !:mime  image/x-os2-graphics
846 #!:apple        ????BMPf
847 # cbSize; size of header like 28h 5Ch
848 >>2     ulelong                 x       \b, cbSize %u
849 #>>2    ulelong                 x       \b, cbSize 0x%x
850 # offNext; offset to data like 0 48h F2h 4Eh 64h C6h D2h D6h DAh E6h EAh 348h
851 >>6     ulelong                 >0      \b, data offset %u
852 #>>6    ulelong                 >0      \b, data offset 0x%x
853 #>>(6.l) ubequad                !0      \b, data 0x%16.16llx
854 # dimensions of the intended device like 640 x 480 for VGA or 1024 x 768
855 >>10    uleshort        >0              \b, display %u
856 >>>12   uleshort        >0              x %u
857 # usType of first array element
858 #>>14   string          x               \b, usType %2.2s
859 # 1 space char after "1st"
860 # no *.bga examples found https://www.openwith.org/file-extensions/bga/1342
861 >>14    string          BM      \b; 1st 
862 !:ext   bmp/bga
863 >>14    string          CI      \b; 1st 
864 !:ext   ico
865 >>14    string          CP      \b; 1st 
866 !:ext   ico
867 >>14    string          IC      \b; 1st 
868 !:ext   ico
869 # no white-black pointer found
870 #>>14   string          PT      \b; 1st 
871 #!:ext  
872 >>14    indirect        x       
873
874 # XPM icons (Greg Roelofs, newt@uchicago.edu)
875 0       search/1        /*\ XPM\ */     X pixmap image text
876 !:mime  image/x-xpmi
877
878 # Utah Raster Toolkit RLE images (janl@ifi.uio.no)
879 0       leshort         0xcc52          RLE image data,
880 >6      leshort         x               %d x
881 >8      leshort         x               %d
882 >2      leshort         >0              \b, lower left corner: %d
883 >4      leshort         >0              \b, lower right corner: %d
884 >10     byte&0x1        =0x1            \b, clear first
885 >10     byte&0x2        =0x2            \b, no background
886 >10     byte&0x4        =0x4            \b, alpha channel
887 >10     byte&0x8        =0x8            \b, comment
888 >11     byte            >0              \b, %d color channels
889 >12     byte            >0              \b, %d bits per pixel
890 >13     byte            >0              \b, %d color map channels
891
892 # image file format (Robert Potter, potter@cs.rochester.edu)
893 0       string          Imagefile\ version-     iff image data
894 # this adds the whole header (inc. version number), informative but longish
895 >10     string          >\0             %s
896
897 # Sun raster images, from Daniel Quinlan (quinlan@yggdrasil.com)
898 0       belong          0x59a66a95      Sun raster image data
899 >4      belong          >0              \b, %d x
900 >8      belong          >0              %d,
901 >12     belong          >0              %d-bit,
902 #>16    belong          >0              %d bytes long,
903 >20     belong          0               old format,
904 #>20    belong          1               standard,
905 >20     belong          2               compressed,
906 >20     belong          3               RGB,
907 >20     belong          4               TIFF,
908 >20     belong          5               IFF,
909 >20     belong          0xffff          reserved for testing,
910 >24     belong          0               no colormap
911 >24     belong          1               RGB colormap
912 >24     belong          2               raw colormap
913 #>28    belong          >0              colormap is %d bytes long
914
915 # SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
916 #
917 # See
918 #       http://reality.sgi.com/grafica/sgiimage.html
919 #
920 0       beshort         474             SGI image data
921 #>2     byte            0               \b, verbatim
922 >2      byte            1               \b, RLE
923 #>3     byte            1               \b, normal precision
924 >3      byte            2               \b, high precision
925 >4      beshort         x               \b, %d-D
926 >6      beshort         x               \b, %d x
927 >8      beshort         x               %d
928 >10     beshort         x               \b, %d channel
929 >10     beshort         !1              \bs
930 >80     string          >0              \b, "%s"
931
932 0       string          IT01            FIT image data
933 >4      belong          x               \b, %d x
934 >8      belong          x               %d x
935 >12     belong          x               %d
936 #
937 0       string          IT02            FIT image data
938 >4      belong          x               \b, %d x
939 >8      belong          x               %d x
940 >12     belong          x               %d
941 #
942 2048    string          PCD_IPI         Kodak Photo CD image pack file
943 >0xe02  byte&0x03       0x00            , landscape mode
944 >0xe02  byte&0x03       0x01            , portrait mode
945 >0xe02  byte&0x03       0x02            , landscape mode
946 >0xe02  byte&0x03       0x03            , portrait mode
947 0       string          PCD_OPA         Kodak Photo CD overview pack file
948
949 # FITS format.  Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
950 # FITS is the Flexible Image Transport System, the de facto standard for
951 # data and image transfer, storage, etc., for the astronomical community.
952 # (FITS floating point formats are big-endian.)
953 0       string  SIMPLE\ \ =     FITS image data
954 !:mime  image/fits
955 !:ext   fits/fts
956 >109    string  8               \b, 8-bit, character or unsigned binary integer
957 >108    string  16              \b, 16-bit, two's complement binary integer
958 >107    string  \ 32            \b, 32-bit, two's complement binary integer
959 >107    string  -32             \b, 32-bit, floating point, single precision
960 >107    string  -64             \b, 64-bit, floating point, double precision
961
962 # other images
963 0       string  This\ is\ a\ BitMap\ file       Lisp Machine bit-array-file
964
965 # From SunOS 5.5.1 "/etc/magic" - appeared right before Sun raster image
966 # stuff.
967 #
968 0       beshort         0x1010          PEX Binary Archive
969
970 # DICOM medical imaging data
971 # URL:          https://en.wikipedia.org/wiki/DICOM#Data_format
972 # Note:         "dcm" is the official file name extension
973 #               XnView mention also "dc3" and "acr" as file name extension
974 128     string  DICM                    DICOM medical imaging data
975 !:mime  application/dicom
976 !:ext dcm/dicom/dic
977
978 # XWD - X Window Dump file.
979 #   As described in /usr/X11R6/include/X11/XWDFile.h
980 #   used by the xwd program.
981 #   Bradford Castalia, idaeim, 1/01
982 #   updated by Adam Buchbinder, 2/09
983 # The following assumes version 7 of the format; the first long is the length
984 # of the header, which is at least 25 4-byte longs, and the one at offset 8
985 # is a constant which is always either 1 or 2. Offset 12 is the pixmap depth,
986 # which is a maximum of 32.
987 0       belong  >100
988 >8      belong  <3
989 >>12    belong  <33
990 >>>4    belong  7                       XWD X Window Dump image data
991 !:mime  image/x-xwindowdump
992 >>>>100 string  >\0                     \b, "%s"
993 >>>>16  belong  x                       \b, %dx
994 >>>>20  belong  x                       \b%dx
995 >>>>12  belong  x                       \b%d
996
997 # PDS - Planetary Data System
998 #   These files use Parameter Value Language in the header section.
999 #   Unfortunately, there is no certain magic, but the following
1000 #   strings have been found to be most likely.
1001 0       string  NJPL1I00                PDS (JPL) image data
1002 2       string  NJPL1I                  PDS (JPL) image data
1003 0       string  CCSD3ZF                 PDS (CCSD) image data
1004 2       string  CCSD3Z                  PDS (CCSD) image data
1005 0       string  PDS_                    PDS image data
1006 0       string  LBLSIZE=                PDS (VICAR) image data
1007
1008 # pM8x: ATARI STAD compressed bitmap format
1009 #
1010 # from Oskar Schirmer <schirmer@scara.com> Feb 2, 2001
1011 # p M 8 5/6 xx yy zz data...
1012 # Atari ST STAD bitmap is always 640x400, bytewise runlength compressed.
1013 # bytes either run horizontally (pM85) or vertically (pM86). yy is the
1014 # most frequent byte, xx and zz are runlength escape codes, where xx is
1015 # used for runs of yy.
1016 #
1017 0       string  pM85            Atari ST STAD bitmap image data (hor)
1018 >5      byte    0x00            (white background)
1019 >5      byte    0xFF            (black background)
1020 0       string  pM86            Atari ST STAD bitmap image data (vert)
1021 >5      byte    0x00            (white background)
1022 >5      byte    0xFF            (black background)
1023
1024 # From: Alex Myczko <alex@aiei.ch>
1025 # https://www.atarimax.com/jindroush.atari.org/afmtatr.html
1026 0       leshort 0x0296          Atari ATR image
1027
1028 # XXX:
1029 # This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
1030 # magic.
1031 # SGI RICE image file <mpruett@sgi.com>
1032 #0      beshort 0x5249          RICE image
1033 #>2     beshort x               v%d
1034 #>4     beshort x               (%d x
1035 #>6     beshort x               %d)
1036 #>8     beshort 0               8 bit
1037 #>8     beshort 1               10 bit
1038 #>8     beshort 2               12 bit
1039 #>8     beshort 3               13 bit
1040 #>10    beshort 0               4:2:2
1041 #>10    beshort 1               4:2:2:4
1042 #>10    beshort 2               4:4:4
1043 #>10    beshort 3               4:4:4:4
1044 #>12    beshort 1               RGB
1045 #>12    beshort 2               CCIR601
1046 #>12    beshort 3               RP175
1047 #>12    beshort 4               YUV
1048
1049 # PCX image files
1050 # From: Dan Fandrich <dan@coneharvesters.com>
1051 # updated by Joerg Jenderek at Feb 2013 by https://de.wikipedia.org/wiki/PCX
1052 # https://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
1053 # GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
1054 # 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
1055 0       ubelong&0xffF8fe00      0x0a000000
1056 # for PCX bit depth > 0
1057 >3      ubyte           >0
1058 # test for valid versions
1059 >>1     ubyte           <6
1060 >>>1    ubyte           !1      PCX
1061 !:mime  image/x-pcx
1062 #!:mime image/pcx
1063 >>>>1   ubyte           0       ver. 2.5 image data
1064 >>>>1   ubyte           2       ver. 2.8 image data, with palette
1065 >>>>1   ubyte           3       ver. 2.8 image data, without palette
1066 >>>>1   ubyte           4       for Windows image data
1067 >>>>1   ubyte           5       ver. 3.0 image data
1068 >>>>4   uleshort        x       bounding box [%d,
1069 >>>>6   uleshort        x       %d] -
1070 >>>>8   uleshort        x       [%d,
1071 >>>>10  uleshort        x       %d],
1072 >>>>65  ubyte           >1      %d planes each of
1073 >>>>3   ubyte           x       %d-bit
1074 >>>>68  byte            1       colour,
1075 >>>>68  byte            2       grayscale,
1076 # this should not happen
1077 >>>>68  default         x       image,
1078 >>>>12  leshort         >0      %d x
1079 >>>>>14 uleshort        x       %d dpi,
1080 >>>>2   byte            0       uncompressed
1081 >>>>2   byte            1       RLE compressed
1082
1083 # Adobe Photoshop
1084 # From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
1085 0       string          8BPS Adobe Photoshop Image
1086 !:mime  image/vnd.adobe.photoshop
1087 >4   beshort 2 (PSB)
1088 >18  belong  x \b, %d x
1089 >14  belong  x %d,
1090 >24  beshort 0 bitmap
1091 >24  beshort 1 grayscale
1092 >>12 beshort 2 with alpha
1093 >24  beshort 2 indexed
1094 >24  beshort 3 RGB
1095 >>12 beshort 4 \bA
1096 >24  beshort 4 CMYK
1097 >>12 beshort 5 \bA
1098 >24  beshort 7 multichannel
1099 >24  beshort 8 duotone
1100 >24  beshort 9 lab
1101 >12  beshort > 1
1102 >>12  beshort x \b, %dx
1103 >12  beshort 1 \b,
1104 >22  beshort x %d-bit channel
1105 >12  beshort > 1 \bs
1106
1107 # XV thumbnail indicator (ThMO)
1108 0       string          P7\ 332         XV thumbnail image data
1109
1110 # NITF is defined by United States MIL-STD-2500A
1111 0       string  NITF    National Imagery Transmission Format
1112 >25     string  >\0     dated %.14s
1113
1114 # GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
1115 # Format variations from: Bernd Nuernberger <bernd.nuernberger@web.de>
1116 # Update: Joerg Jenderek
1117 # See http://fileformats.archiveteam.org/wiki/GEM_Raster
1118 # For variations, also see:
1119 #    https://www.seasip.info/Gem/ff_img.html (Ventura)
1120 #    http://www.atari-wiki.com/?title=IMG_file (XIMG, STTT)
1121 #    http://www.fileformat.info/format/gemraster/spec/index.htm (XIMG, STTT)
1122 #    http://sylvana.net/1stguide/1STGUIDE.ENG (TIMG)
1123 0       beshort     0x0001
1124 # header_size
1125 >2      beshort     0x0008
1126 >>0     use gem_info
1127 >2      beshort     0x0009
1128 >>0     use gem_info
1129 # no example for NOSIG
1130 >2      beshort     24
1131 >>0     use gem_info
1132 # no example for HYPERPAINT
1133 >2      beshort     25
1134 >>0     use gem_info
1135 16      string      XIMG\0
1136 >0      use gem_info
1137 # no example
1138 16      string      STTT\0\x10
1139 >0      use gem_info
1140 # no example or description
1141 16      string      TIMG\0
1142 >0      use gem_info
1143
1144 0   name        gem_info
1145 # version is 2 for some XIMG and 1 for all others
1146 >0      beshort         <0x0003         GEM
1147 # https://www.snowstone.org.uk/riscos/mimeman/mimemap.txt
1148 !:mime  image/x-gem
1149 # header_size 24 25 27 59 779 words for colored bitmaps
1150 >>2     beshort         >9
1151 >>>16   string          STTT\0\x10      STTT
1152 >>>16   string          TIMG\0          TIMG
1153 # HYPERPAINT or NOSIG variant
1154 >>>16   string          \0\x80
1155 >>>>2   beshort         =24             NOSIG
1156 >>>>2   beshort         !24             HYPERPAINT
1157 # NOSIG or XIMG variant
1158 >>>16   default         x
1159 >>>>16  string          !XIMG\0         NOSIG
1160 >>16    string          =XIMG\0         XIMG Image data
1161 !:ext   img/ximg
1162 # to avoid Warning: Current entry does not yet have a description for adding a EXTENSION type
1163 >>16    string          !XIMG\0         Image data
1164 !:ext   img
1165 # header_size is 9 for Ventura files and 8 for other GEM Paint files
1166 >>2     beshort         9               (Ventura)
1167 #>>2    beshort         8               (Paint)
1168 >>12    beshort         x               %d x
1169 >>14    beshort         x               %d,
1170 # 1 4 8
1171 >>4     beshort         x               %d planes,
1172 # in tenths of a millimetre
1173 >>8     beshort         x               %d x
1174 >>10    beshort         x               %d pixelsize
1175 # pattern_size 1-8. 2 for GEM Paint
1176 >>6     beshort         !2              \b, pattern size %d
1177
1178 # GEM Metafile (Wolfram Kleff)
1179 0       lelong          0x0018FFFF      GEM Metafile data
1180 >4      leshort         x               version %d
1181
1182 #
1183 # SMJPEG. A custom Motion JPEG format used by Loki Entertainment
1184 # Software Torbjorn Andersson <d91tan@Update.UU.SE>.
1185 #
1186 0       string  \0\nSMJPEG      SMJPEG
1187 >8      belong  x               %d.x data
1188 # According to the specification you could find any number of _TXT
1189 # headers here, but I can't think of any way of handling that. None of
1190 # the SMJPEG files I tried it on used this feature. Even if such a
1191 # file is encountered the output should still be reasonable.
1192 >16     string  _SND            \b,
1193 >>24    beshort >0              %d Hz
1194 >>26    byte    8               8-bit
1195 >>26    byte    16              16-bit
1196 >>28    string  NONE            uncompressed
1197 # >>28  string  APCM            ADPCM compressed
1198 >>27    byte    1               mono
1199 >>28    byte    2               stereo
1200 # Help! Isn't there any way to avoid writing this part twice?
1201 >>32    string  _VID            \b,
1202 # >>>48 string  JFIF            JPEG
1203 >>>40   belong  >0              %d frames
1204 >>>44   beshort >0              (%d x
1205 >>>46   beshort >0              %d)
1206 >16     string  _VID            \b,
1207 # >>32  string  JFIF            JPEG
1208 >>24    belong  >0              %d frames
1209 >>28    beshort >0              (%d x
1210 >>30    beshort >0              %d)
1211
1212 0       string  Paint\ Shop\ Pro\ Image\ File   Paint Shop Pro Image File
1213
1214 # "thumbnail file" (icon)
1215 # descended from "xv", but in use by other applications as well (Wolfram Kleff)
1216 0       string          P7\ 332         XV "thumbnail file" (icon) data
1217
1218 # taken from fkiss: (<yav@mte.biglobe.ne.jp> ?)
1219 0       string          KiSS            KISS/GS
1220 >4      byte            16              color
1221 >>5     byte            x               %d bit
1222 >>8     leshort         x               %d colors
1223 >>10    leshort         x               %d groups
1224 >4      byte            32              cell
1225 >>5     byte            x               %d bit
1226 >>8     leshort         x               %d x
1227 >>10    leshort         x               %d
1228 >>12    leshort         x               +%d
1229 >>14    leshort         x               +%d
1230
1231 # Webshots (www.webshots.com), by John Harrison
1232 0       string          C\253\221g\230\0\0\0 Webshots Desktop .wbz file
1233
1234 # Hercules DASD image files
1235 # From Jan Jaeger <jj@septa.nl>
1236 0       string  CKD_P370        Hercules CKD DASD image file
1237 >8      long    x               \b, %d heads per cylinder
1238 >12     long    x               \b, track size %d bytes
1239 >16     byte    x               \b, device type 33%2.2X
1240
1241 0       string  CKD_C370        Hercules compressed CKD DASD image file
1242 >8      long    x               \b, %d heads per cylinder
1243 >12     long    x               \b, track size %d bytes
1244 >16     byte    x               \b, device type 33%2.2X
1245
1246 0       string  CKD_S370        Hercules CKD DASD shadow file
1247 >8      long    x               \b, %d heads per cylinder
1248 >12     long    x               \b, track size %d bytes
1249 >16     byte    x               \b, device type 33%2.2X
1250
1251 # Squeak images and programs - etoffi@softhome.net
1252 0       string          \146\031\0\0    Squeak image data
1253 0       search/1        'From\040Squeak Squeak program text
1254
1255 # partimage: file(1) magic for PartImage files (experimental, incomplete)
1256 # Author: Hans-Joachim Baader <hjb@pro-linux.de>
1257 0               string  PaRtImAgE-VoLuMe        PartImage
1258 >0x0020         string  0.6.1           file version %s
1259 >>0x0060        lelong  >-1             volume %d
1260 #>>0x0064 8 byte identifier
1261 #>>0x007c reserved
1262 >>0x0200        string  >\0             type %s
1263 >>0x1400        string  >\0             device %s,
1264 >>0x1600        string  >\0             original filename %s,
1265 # Some fields omitted
1266 >>0x2744        lelong  0               not compressed
1267 >>0x2744        lelong  1               gzip compressed
1268 >>0x2744        lelong  2               bzip2 compressed
1269 >>0x2744        lelong  >2              compressed with unknown algorithm
1270 >0x0020         string  >0.6.1          file version %s
1271 >0x0020         string  <0.6.1          file version %s
1272
1273 # DCX is multi-page PCX, using a simple header of up to 1024
1274 # offsets for the respective PCX components.
1275 # From: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
1276 0       lelong  987654321       DCX multi-page PCX image data
1277
1278 # Simon Walton <simonw@matteworld.com>
1279 # Kodak Cineon format for scanned negatives
1280 # http://www.kodak.com/US/en/motion/support/dlad/
1281 0       lelong  0xd75f2a80      Cineon image data
1282 >200    belong  >0              \b, %d x
1283 >204    belong  >0              %d
1284
1285
1286 # Bio-Rad .PIC is an image format used by microscope control systems
1287 # and related image processing software used by biologists.
1288 # From: Vebjorn Ljosa <vebjorn@ljosa.com>
1289 # BOOL values are two-byte integers; use them to rule out false positives.
1290 # https://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
1291 # Samples: https://www.loci.wisc.edu/software/sample-data
1292 14      leshort <2
1293 >62     leshort <2
1294 >>54    leshort 12345           Bio-Rad .PIC Image File
1295 >>>0    leshort >0              %d x
1296 >>>2    leshort >0              %d,
1297 >>>4    leshort =1              1 image in file
1298 >>>4    leshort >1              %d images in file
1299
1300 # From Jan "Yenya" Kasprzak <kas@fi.muni.cz>
1301 # The description of *.mrw format can be found at
1302 # http://www.dalibor.cz/minolta/raw_file_format.htm
1303 0       string  \000MRM                 Minolta Dimage camera raw image data
1304
1305 # Summary: DjVu image / document
1306 # Extension: .djvu
1307 # Reference: http://djvu.org/docs/DjVu3Spec.djvu
1308 # Submitted by: Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
1309 # Modified by (1): Abel Cheung <abelcheung@gmail.com>
1310 0       string  AT&TFORM
1311 >12     string  DJVM            DjVu multiple page document
1312 !:mime  image/vnd.djvu
1313 >12     string  DJVU            DjVu image or single page document
1314 !:mime  image/vnd.djvu
1315 >12     string  DJVI            DjVu shared document
1316 !:mime  image/vnd.djvu
1317 >12     string  THUM            DjVu page thumbnails
1318 !:mime  image/vnd.djvu
1319
1320 # Originally by Marc Espie
1321 # Modified by Robert Minsk <robertminsk at yahoo.com>
1322 # https://www.openexr.com/openexrfilelayout.pdf
1323 0       lelong          20000630        OpenEXR image data,
1324 !:mime image/x-exr
1325 >4      lelong&0x000000ff x             version %d,
1326 >4      lelong          ^0x00000200     storage: scanline
1327 >4      lelong          &0x00000200     storage: tiled
1328 >8      search/0x1000   compression\0   \b, compression:
1329 >>&16   byte            0               none
1330 >>&16   byte            1               rle
1331 >>&16   byte            2               zips
1332 >>&16   byte            3               zip
1333 >>&16   byte            4               piz
1334 >>&16   byte            5               pxr24
1335 >>&16   byte            6               b44
1336 >>&16   byte            7               b44a
1337 >>&16   byte            8               dwaa
1338 >>&16   byte            9               dwab
1339 >>&16   byte            >9              unknown
1340 >8       search/0x1000  dataWindow\0    \b, dataWindow:
1341 >>&10   lelong          x               (%d
1342 >>&14   lelong          x               %d)-
1343 >>&18   lelong          x               \b(%d
1344 >>&22   lelong          x               %d)
1345 >8      search/0x1000   displayWindow\0 \b, displayWindow:
1346 >>&10   lelong          x               (%d
1347 >>&14   lelong          x               %d)-
1348 >>&18   lelong          x               \b(%d
1349 >>&22   lelong          x               %d)
1350 >8      search/0x1000   lineOrder\0      \b, lineOrder:
1351 >>&14   byte            0               increasing y
1352 >>&14   byte            1               decreasing y
1353 >>&14   byte            2               random y
1354 >>&14   byte            >2              unknown
1355
1356 # SMPTE Digital Picture Exchange Format, SMPTE DPX
1357 #
1358 # ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
1359 # Moving-Picture Exchange (DPX), v1.0, 18 February 1994
1360 # Robert Minsk <robertminsk at yahoo.com>
1361 # Modified by Harry Mallon <hjmallon at gmail.com>
1362 0       string          SDPX    DPX image data, big-endian,
1363 !:mime image/x-dpx
1364 >0      use             dpx_info
1365 0       string          XPDS    DPX image data, little-endian,
1366 !:mime image/x-dpx
1367 >0      use             \^dpx_info
1368
1369 0       name            dpx_info
1370 >768    beshort         <4
1371 >>772   belong          x       %dx
1372 >>776   belong          x       \b%d,
1373 >768    beshort         >3
1374 >>776   belong          x       %dx
1375 >>772   belong          x       \b%d,
1376 >768    beshort         0       left to right/top to bottom
1377 >768    beshort         1       right to left/top to bottom
1378 >768    beshort         2       left to right/bottom to top
1379 >768    beshort         3       right to left/bottom to top
1380 >768    beshort         4       top to bottom/left to right
1381 >768    beshort         5       top to bottom/right to left
1382 >768    beshort         6       bottom to top/left to right
1383 >768    beshort         7       bottom to top/right to left
1384
1385 # From: Tom Hilinski <tom.hilinski@comcast.net>
1386 # https://www.unidata.ucar.edu/packages/netcdf/
1387 0       string  CDF\001                 NetCDF Data Format data
1388 # 64-bit offset netcdf Classic https://www.unidata.ucar.edu/software/netcdf/docs/file_format_specifications
1389 0       string  CDF\002                 NetCDF Data Format data (64-bit offset)
1390
1391 #-----------------------------------------------------------------------
1392 # Hierarchical Data Format, used to facilitate scientific data exchange
1393 # specifications at http://hdf.ncsa.uiuc.edu/
1394 0       belong  0x0e031301      Hierarchical Data Format (version 4) data
1395 !:mime  application/x-hdf
1396 0       string  \211HDF\r\n\032\n       Hierarchical Data Format (version 5) data
1397 !:mime  application/x-hdf
1398 512     string  \211HDF\r\n\032\n       Hierarchical Data Format (version 5) with 512 bytes user block
1399 !:mime  application/x-hdf
1400 1024    string  \211HDF\r\n\032\n       Hierarchical Data Format (version 5) with 1k user block
1401 !:mime  application/x-hdf
1402 2048    string  \211HDF\r\n\032\n       Hierarchical Data Format (version 5) with 2k user block
1403 !:mime  application/x-hdf
1404 4096    string  \211HDF\r\n\032\n       Hierarchical Data Format (version 5) with 4k user block
1405 !:mime  application/x-hdf
1406
1407
1408 # From: Tobias Burnus <burnus@net-b.de>
1409 # Xara (for a while: Corel Xara) is a graphic package, see
1410 # http://www.xara.com/ for Windows and as GPL application for Linux
1411 0       string  XARA\243\243    Xara graphics file
1412
1413 # https://www.cartesianinc.com/Tech/
1414 0       string  CPC\262         Cartesian Perceptual Compression image
1415 !:mime  image/x-cpi
1416
1417 # From Albert Cahalan <acahalan@gmail.com>
1418 # puredigital used it for the CVS disposable camcorder
1419 #8       lelong  4       ZBM bitmap image data
1420 #>4      leshort x       %u x
1421 #>6      leshort x       %u
1422
1423 # From Albert Cahalan <acahalan@gmail.com>
1424 # uncompressed 5:6:5 HighColor image for OLPC XO firmware icons
1425 0       string C565     OLPC firmware icon image data
1426 >4      leshort x       %u x
1427 >6      leshort x       %u
1428
1429 # Applied Images - Image files from Cytovision
1430 # Gustavo Junior Alves <gjalves@gjalves.com.br>
1431 0       string  \xce\xda\xde\xfa        Cytovision Metaphases file
1432 0       string  \xed\xad\xef\xac        Cytovision Karyotype file
1433 0       string  \x0b\x00\x03\x00        Cytovision FISH Probe file
1434 0       string  \xed\xfe\xda\xbe        Cytovision FLEX file
1435 0       string  \xed\xab\xed\xfe        Cytovision FLEX file
1436 0       string  \xad\xfd\xea\xad        Cytovision RATS file
1437
1438 # Wavelet Scalar Quantization format used in gray-scale fingerprint images
1439 # From Tano M Fotang <mfotang@quanteq.com>
1440 0       string  \xff\xa0\xff\xa8\x00    Wavelet Scalar Quantization image data
1441
1442 # Type:         PCO B16 image files
1443 # URL:          http://www.pco.de/fileadmin/user_upload/db/download/MA_CWDCOPIE_0412b.pdf
1444 # From:         Florian Philipp <florian.philipp@binarywings.net>
1445 # Extension:    .b16
1446 # Description:  Pixel image format produced by PCO Camware, typically used
1447 #               together with PCO cameras.
1448 # Note:         Different versions exist for e.g. 8 bit and 16 bit images.
1449 #               Documentation is incomplete.
1450 0       string/b        PCO-    PCO B16 image data
1451 >12     lelong          x       \b, %dx
1452 >16     lelong          x       \b%d
1453 >20     lelong          0       \b, short header
1454 >20     lelong          -1      \b, extended header
1455 >>24    lelong          0       \b, grayscale
1456 >>>36   lelong          0       linear LUT
1457 >>>36   lelong          1       logarithmic LUT
1458 >>>28   lelong          x       [%d
1459 >>>32   lelong          x       \b,%d]
1460 >>24    lelong          1       \b, color
1461 >>>64   lelong          0       linear LUT
1462 >>>64   lelong          1       logarithmic LUT
1463 >>>40   lelong          x       r[%d
1464 >>>44   lelong          x       \b,%d]
1465 >>>48   lelong          x       g[%d
1466 >>>52   lelong          x       \b,%d]
1467 >>>56   lelong          x       b[%d
1468 >>>60   lelong          x       \b,%d]
1469
1470 # Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
1471 # From: Markus Heidelberg <markus.heidelberg at web.de>
1472 0       string/t        [BitmapInfo2]   Polar Monitor Bitmap text
1473 !:mime  image/x-polar-monitor-bitmap
1474
1475 # From: Rick Richardson <rickrich@gmail.com>
1476 # updated by: Joerg Jenderek
1477 # URL: http://techmods.net/nuvi/
1478 0       string  GARMIN\ BITMAP\ 01      Garmin Bitmap file
1479 # extension is also used for
1480 # Sony SRF raw image (image/x-sony-srf)
1481 # SRF map
1482 # Terragen Surface Map (https://www.planetside.co.uk/terragen)
1483 # FileLocator Pro search criteria file (https://www.mythicsoft.com/filelocatorpro)
1484 !:ext srf
1485 #!:mime image/x-garmin-srf
1486 # version 1.00,2.00,2.10,2.40,2.50
1487 >0x2f   string          >0              \b, version %4.4s
1488 # width (2880,2881,3240)
1489 >0x55   uleshort        >0              \b, %dx
1490 # height (80,90)
1491 >>0x53  uleshort        x               \b%d
1492
1493 # Type: Ulead Photo Explorer5 (.pe5)
1494 # URL:  http://www.jisyo.com/cgibin/view.cgi?EXT=pe5 (Japanese)
1495 # From: Simon Horman <horms@debian.org>
1496 0       string  IIO2H                   Ulead Photo Explorer5
1497
1498 # Type: X11 cursor
1499 # URL:  http://webcvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?view=markup
1500 # From: Mathias Brodala <info@noctus.net>
1501 0       string  Xcur                    X11 cursor
1502
1503 # Type: Olympus ORF raw images.
1504 # URL:  https://libopenraw.freedesktop.org/wiki/Olympus_ORF
1505 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
1506 0       string          MMOR            Olympus ORF raw image data, big-endian
1507 !:mime  image/x-olympus-orf
1508 0       string          IIRO            Olympus ORF raw image data, little-endian
1509 !:mime  image/x-olympus-orf
1510 0       string          IIRS            Olympus ORF raw image data, little-endian
1511 !:mime  image/x-olympus-orf
1512
1513 # Type: files used in modern AVCHD camcoders to store clip information
1514 # Extension: .cpi
1515 # From: Alexander Danilov <alexander.a.danilov@gmail.com>
1516 0       string  HDMV0100        AVCHD Clip Information
1517
1518 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
1519 # URL: http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
1520 # Radiance HDR; usually has .pic or .hdr extension.
1521 0       string  #?RADIANCE\n    Radiance HDR image data
1522 #!mime  image/vnd.radiance
1523
1524 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
1525 # URL: https://www.mpi-inf.mpg.de/resources/pfstools/pfs_format_spec.pdf
1526 # Used by the pfstools packages. The regex matches for the image size could
1527 # probably use some work. The MIME type is made up; if there's one in
1528 # actual common use, it should replace the one below.
1529 0       string  PFS1\x0a        PFS HDR image data
1530 #!mime  image/x-pfs
1531 >1      regex   [0-9]*\                 \b, %s
1532 >>1     regex   \ [0-9]{4}              \bx%s
1533
1534 # Type: Foveon X3F
1535 # URL:  https://www.photofo.com/downloads/x3f-raw-format.pdf
1536 # From: Adam Buchbinder <adam.buchbinder@gmail.com>
1537 # Note that the MIME type isn't defined anywhere that I can find; if
1538 # there's a canonical type for this format, it should replace this one.
1539 0       string  FOVb    Foveon X3F raw image data
1540 !:mime  image/x-x3f
1541 >6      leshort x       \b, version %d.
1542 >4      leshort x       \b%d
1543 >28     lelong  x       \b, %dx
1544 >32     lelong  x       \b%d
1545
1546 # Paint.NET file
1547 # From Adam Buchbinder <adam.buchbinder@gmail.com>
1548 0       string  PDN3    Paint.NET image data
1549 !:mime  image/x-paintnet
1550
1551 # Not really an image.
1552 # From: "Tano M. Fotang" <mfotang@quanteq.com>
1553 0       string  \x46\x4d\x52\x00        ISO/IEC 19794-2 Format Minutiae Record (FMR)
1554
1555 # doc: https://www.shikino.co.jp/eng/products/images/FLOWER.jpg.zip
1556 # example: https://www.shikino.co.jp/eng/products/images/FLOWER.wdp.zip
1557 90      bequad          0x574D50484F544F00      JPEG-XR Image
1558 >98     byte&0x08       =0x08                   \b, hard tiling
1559 >99     byte&0x80       =0x80                   \b, tiling present
1560 >99     byte&0x40       =0x40                   \b, codestream present
1561 >99     byte&0x38       x                       \b, spatial xform=
1562 >99     byte&0x38       0x00                    \bTL
1563 >99     byte&0x38       0x08                    \bBL
1564 >99     byte&0x38       0x10                    \bTR
1565 >99     byte&0x38       0x18                    \bBR
1566 >99     byte&0x38       0x20                    \bBT
1567 >99     byte&0x38       0x28                    \bRB
1568 >99     byte&0x38       0x30                    \bLT
1569 >99     byte&0x38       0x38                    \bLB
1570 >100    byte&0x80       =0x80                   \b, short header
1571 >>102   beshort+1       x                       \b, %d
1572 >>104   beshort+1       x                       \bx%d
1573 >100    byte&0x80       =0x00                   \b, long header
1574 >>102   belong+1        x                       \b, %x
1575 >>106   belong+1        x                       \bx%x
1576 >101    beshort&0xf     x                       \b, bitdepth=
1577 >>101   beshort&0xf     0x0                     \b1-WHITE=1
1578 >>101   beshort&0xf     0x1                     \b8
1579 >>101   beshort&0xf     0x2                     \b16
1580 >>101   beshort&0xf     0x3                     \b16-SIGNED
1581 >>101   beshort&0xf     0x4                     \b16-FLOAT
1582 >>101   beshort&0xf     0x5                     \b(reserved 5)
1583 >>101   beshort&0xf     0x6                     \b32-SIGNED
1584 >>101   beshort&0xf     0x7                     \b32-FLOAT
1585 >>101   beshort&0xf     0x8                     \b5
1586 >>101   beshort&0xf     0x9                     \b10
1587 >>101   beshort&0xf     0xa                     \b5-6-5
1588 >>101   beshort&0xf     0xb                     \b(reserved %d)
1589 >>101   beshort&0xf     0xc                     \b(reserved %d)
1590 >>101   beshort&0xf     0xd                     \b(reserved %d)
1591 >>101   beshort&0xf     0xe                     \b(reserved %d)
1592 >>101   beshort&0xf     0xf                     \b1-BLACK=1
1593 >101    beshort&0xf0    x                       \b, colorfmt=
1594 >>101   beshort&0xf0    0x00                    \bYONLY
1595 >>101   beshort&0xf0    0x10                    \bYUV240
1596 >>101   beshort&0xf0    0x20                    \bYWV422
1597 >>101   beshort&0xf0    0x30                    \bYWV444
1598 >>101   beshort&0xf0    0x40                    \bCMYK
1599 >>101   beshort&0xf0    0x50                    \bCMYKDIRECT
1600 >>101   beshort&0xf0    0x60                    \bNCOMPONENT
1601 >>101   beshort&0xf0    0x70                    \bRGB
1602 >>101   beshort&0xf0    0x80                    \bRGBE
1603 >>101   beshort&0xf0    >0x80                   \b(reserved 0x%x)
1604
1605 # From: Johan van der Knijff <johan.vanderknijff@kb.nl>
1606 #
1607 # BPG (Better Portable Graphics) format
1608 # https://bellard.org/bpg/
1609 # http://fileformats.archiveteam.org/wiki/BPG
1610 #
1611 0       string  \x42\x50\x47\xFB        BPG (Better Portable Graphics)
1612 !:mime  image/bpg
1613
1614 # From: Joerg Jenderek
1615 # URL: https://en.wikipedia.org/wiki/Apple_Icon_Image_format
1616 0       string          icns            Mac OS X icon
1617 !:mime  image/x-icns
1618 !:apple ????icns
1619 !:ext icns
1620 >4      ubelong         >0
1621 # file size
1622 >>4     ubelong         x               \b, %d bytes
1623 # icon type
1624 >>8     string          x               \b, "%4.4s" type
1625
1626 # TIM images
1627 0               lelong          0x00000010      TIM image,
1628 >4              lelong          0x8             4-Bit,
1629 >4              lelong          0x9             8-Bit,
1630 >4              lelong          0x2             15-Bit,
1631 >4              lelong          0x3             24-Bit,
1632 >4              lelong          &8
1633 >>(8.l+12)      leshort         x               Pixel at (%d,
1634 >>(8.l+14)      leshort         x               \b%d)
1635 >>(8.l+16)      leshort         x               Size=%dx
1636 >>(8.l+18)      leshort         x               \b%d,
1637 >>4             lelong          0x8             16 CLUT Entries at
1638 >>4             lelong          0x9             256 CLUT Entries at
1639 >>12            leshort         x               (%d,
1640 >>14            leshort         x               \b%d)
1641 >4              lelong          ^8
1642 >>12            leshort         x               Pixel at (%d,
1643 >>14            leshort         x               \b%d)
1644 >>16            leshort         x               Size=%dx
1645 >>18            leshort         x               \b%d
1646
1647 # MDEC streams
1648 0               lelong          0x80010160      MDEC video stream,
1649 >16             leshort         x               %dx
1650 >18             leshort         x               \b%d
1651 #>8             lelong          x               %d frames
1652 #>4             leshort         x               secCount=%d;
1653 #>6             leshort         x               nSectors=%d;
1654 #>12            lelong          x               frameSize=%d;
1655
1656 # BS encoded bitstreams
1657 2               leshort         0x3800          BS image,
1658 >6              leshort         x               Version %d,
1659 >4              leshort         x               Quantization %d,
1660 >0              leshort         x               (Decompresses to %d words)
1661
1662 # Type: farbfeld image.
1663 # Url: http://tools.suckless.org/farbfeld/
1664 # From: Ian D. Scott <ian@iandouglasscott.com>
1665 #
1666 0               string          farbfeld        farbfeld image data,
1667 >8              ubelong         x               %dx
1668 >12             ubelong         x               \b%d
1669
1670 # Type: Microsoft DirectDraw Surface (common data)
1671 # URL:  https://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
1672 # From: Morten Hustveit <morten@debian.org>
1673 # Updated by: David Korth <gerbilsoft@gerbilsoft.com>
1674 0       name    ms-directdraw-surface
1675 >0x10   ulelong x                       %u x
1676 >0x0C   ulelong x                       %u
1677 # Color depth.
1678 >0x58   ulelong >0                      \b, %u-bit color
1679 # Determine the pixel format.
1680 >0x50   ulelong&0x4     4
1681 # FIXME: Handle DX10 and XBOX formats.
1682 >>0x54  string  x                       \b, compressed using %.4s
1683 >0x50   ulelong&0x2     0x2             \b, alpha only
1684 >0x50   ulelong&0x200   0x200           \b, YUV
1685 >0x50   ulelong&0x20000 0x20000         \b, luminance
1686 # RGB pixel format
1687 >0x50   ulelong&0x40    0x40
1688
1689 # Determine the RGB format using the color masks.
1690 # ulequad order: 0xGGGGGGGGRRRRRRRR, 0xAAAAAAAABBBBBBBB
1691
1692 >>0x58          ulelong 16
1693
1694 # NOTE: 15-bit color formats usually have 16-bit listed as the color depth.
1695 >>>0x5C         ulequad 0x000003E000007C00
1696 >>>>0x64        ulequad 0x000000000000001F      \b, RGB555
1697 >>>0x5C         ulequad 0x000003E000001F00
1698 >>>>0x64        ulequad 0x000000000000007C      \b, BGR555
1699
1700 >>>0x5C         ulequad 0x000007E00000F800
1701 >>>>0x64        ulequad 0x000000000000001F      \b, RGB565
1702 >>>0x5C         ulequad 0x000007E000001F00
1703 >>>>0x64        ulequad 0x00000000000000F8      \b, BGR565
1704
1705 >>>0x5C         ulequad 0x000000F000000F00
1706 >>>>0x64        ulequad 0x0000F0000000000F      \b, ARGB4444
1707 >>>0x5C         ulequad 0x000000F00000000F
1708 >>>>0x64        ulequad 0x0000F00000000F00      \b, ABGR4444
1709
1710 >>>0x5C         ulequad 0x00000F000000F000
1711 >>>>0x64        ulequad 0x0000000F000000F0      \b, RGBA4444
1712 >>>0x5C         ulequad 0x00000F00000000F0
1713 >>>>0x64        ulequad 0x0000000F0000F000      \b, BGRA4444
1714
1715 >>>0x5C         ulequad 0x000000F000000F00
1716 >>>>0x64        ulequad 0x000000000000000F      \b, xRGB4444
1717 >>>0x5C         ulequad 0x000000F00000000F
1718 >>>>0x64        ulequad 0x0000000000000F00      \b, xBGR4444
1719
1720 >>>0x5C         ulequad 0x00000F000000F000
1721 >>>>0x64        ulequad 0x00000000000000F0      \b, RGBx4444
1722 >>>0x5C         ulequad 0x00000F00000000F0
1723 >>>>0x64        ulequad 0x000000000000F000      \b, BGRx4444
1724
1725 >>>0x5C         ulequad 0x000003E000007C00
1726 >>>>0x64        ulequad 0x000080000000001F      \b, ARGB1555
1727 >>>0x5C         ulequad 0x000003E000001F00
1728 >>>>0x64        ulequad 0x000080000000007C      \b, ABGR1555
1729 >>>0x5C         ulequad 0x000007C00000F800
1730 >>>>0x64        ulequad 0x000000010000003E      \b, RGBA5551
1731 >>>0x5C         ulequad 0x000007C00000003E
1732 >>>>0x64        ulequad 0x000000010000F800      \b, BGRA5551
1733
1734 >>88            ulelong 24
1735 >>>0x5C         ulequad 0x0000FF0000FF0000
1736 >>>>0x64        ulequad 0x00000000000000FF      \b, RGB888
1737 >>>0x5C         ulequad 0x0000FF00000000FF
1738 >>>>0x64        ulequad 0x0000000000FF0000      \b, BGR888
1739
1740 >>88            ulelong 32
1741 >>>0x5C         ulequad 0x0000FF0000FF0000
1742 >>>>0x64        ulequad 0xFF000000000000FF      \b, ARGB8888
1743 >>>0x5C         ulequad 0x0000FF00000000FF
1744 >>>>0x64        ulequad 0xFF00000000FF0000      \b, ABGR8888
1745
1746 >>>0x5C         ulequad 0x00FF0000FF000000
1747 >>>>0x64        ulequad 0x000000FF0000FF00      \b, RGBA8888
1748 >>>0x5C         ulequad 0x00FF00000000FF00
1749 >>>>0x64        ulequad 0x000000FFFF000000      \b, BGBA8888
1750
1751 >>>0x5C         ulequad 0x0000FF0000FF0000
1752 >>>>0x64        ulequad 0x00000000000000FF      \b, xRGB8888
1753 >>>0x5C         ulequad 0x0000FF00000000FF
1754 >>>>0x64        ulequad 0x0000000000FF0000      \b, xBGR8888
1755
1756 >>>0x5C         ulequad 0x00FF0000FF000000
1757 >>>>0x64        ulequad 0x000000000000FF00      \b, RGBx8888
1758 >>>0x5C         ulequad 0x00FF00000000FF00
1759 >>>>0x64        ulequad 0x00000000FF000000      \b, BGBx8888
1760
1761 # Less common 32-bit color formats.
1762 >>>0x5C         ulequad 0xFFFF00000000FFFF
1763 >>>>0x64        ulequad 0x0000000000000000      \b, G16R16
1764 >>>0x5C         ulequad 0x0000FFFFFFFF0000
1765 >>>>0x64        ulequad 0x0000000000000000      \b, R16G16
1766
1767 >>>0x5C         ulequad 0x000FFC003FF00000
1768 >>>>0x64        ulequad 0xC0000000000003FF      \b, A2R10G10B10
1769 >>>0x5C         ulequad 0x000FFC00000003FF
1770 >>>>0x64        ulequad 0xC00000003FF00000      \b, A2B10G10R10
1771
1772 # Type: Microsoft DirectDraw Surface
1773 # URL:  https://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
1774 # From: Morten Hustveit <morten@debian.org>
1775 # Updated by: David Korth <gerbilsoft@gerbilsoft.com>
1776 0       string/b        DDS\040\174\000\000\000 Microsoft DirectDraw Surface (DDS):
1777 >0      use     ms-directdraw-surface
1778
1779 # Type: Sega PVR image.
1780 # From: David Korth <gerbilsoft@gerbilsoft.com>
1781 # References:
1782 # - https://fabiensanglard.net/Mykaruga/tools/segaPVRFormat.txt
1783 # - https://github.com/yazgoo/pvrx2png
1784 # - https://github.com/nickworonekin/puyotools
1785
1786 # Sega PVR header.
1787 0       name    sega-pvr-image-header
1788 >0x0C   leshort x       %u x
1789 >0x0E   leshort x       %u
1790 # Image format.
1791 >0x08   byte    0       \b, ARGB1555
1792 >0x08   byte    1       \b, RGB565
1793 >0x08   byte    2       \b, ARGB4444
1794 >0x08   byte    3       \b, YUV442
1795 >0x08   byte    4       \b, Bump
1796 >0x08   byte    5       \b, 4bpp
1797 >0x08   byte    6       \b, 8bpp
1798 # Image data type.
1799 >0x09   byte    0x01    \b, square twiddled
1800 >0x09   byte    0x02    \b, square twiddled & mipmap
1801 >0x09   byte    0x03    \b, VQ
1802 >0x09   byte    0x04    \b, VQ & mipmap
1803 >0x09   byte    0x05    \b, 8-bit CLUT twiddled
1804 >0x09   byte    0x06    \b, 4-bit CLUT twiddled
1805 >0x09   byte    0x07    \b, 8-bit direct twiddled
1806 >0x09   byte    0x08    \b, 4-bit direct twiddled
1807 >0x09   byte    0x09    \b, rectangle
1808 >0x09   byte    0x0B    \b, rectangular stride
1809 >0x09   byte    0x0D    \b, rectangular twiddled
1810 >0x09   byte    0x10    \b, small VQ
1811 >0x09   byte    0x11    \b, small VQ & mipmap
1812 >0x09   byte    0x12    \b, square twiddled & mipmap
1813
1814 # Sega PVR image.
1815 0       string  PVRT
1816 >0x10   string  DDS\040\174\000\000\000 Sega PVR (Xbox) image:
1817 >>0x20  use     ms-directdraw-surface
1818 >0x10   belong  !0x44445320             Sega PVR image:
1819 >>0     use     sega-pvr-image-header
1820
1821 # Sega PVR image with GBIX.
1822 0       string  GBIX
1823 >0x10   string  PVRT
1824 >>0x10  string  DDS\040\174\000\000\000 Sega PVR (Xbox) image:
1825 >>>0x20 use     ms-directdraw-surface
1826 >>0x10  belong  !0x44445320             Sega PVR image:
1827 >>>0x10 use     sega-pvr-image-header
1828 >>0x08  lelong  x       \b, global index = %u
1829
1830 # Sega GVR header.
1831 0       name    sega-gvr-image-header
1832 >0x0C   beshort x       %u x
1833 >0x0E   beshort x       %u
1834 # Image data format.
1835 >0x0B   byte    0       \b, I4
1836 >0x0B   byte    1       \b, I8
1837 >0x0B   byte    2       \b, IA4
1838 >0x0B   byte    3       \b, IA8
1839 >0x0B   byte    4       \b, RGB565
1840 >0x0B   byte    5       \b, RGB5A3
1841 >0x0B   byte    6       \b, ARGB8888
1842 >0x0B   byte    8       \b, CI4
1843 >0x0B   byte    9       \b, CI8
1844 >0x0B   byte    14      \b, DXT1
1845
1846 # Sega GVR image.
1847 0       string  GVRT    Sega GVR image:
1848 >0x10   use     sega-gvr-image-header
1849
1850 # Sega GVR image with GBIX.
1851 0       string  GBIX
1852 >0x10   string  GVRT    Sega GVR image:
1853 >>0x10  use     sega-gvr-image-header
1854 >>0x08  belong  x       \b, global index = %u
1855
1856 # Sega GVR image with GCIX. (Wii)
1857 0       string  GCIX
1858 >0x10   string  GVRT    Sega GVR image:
1859 >>0x10  use     sega-gvr-image-header
1860 >>0x08  belong  x       \b, global index = %u
1861
1862 # Light Field Picture
1863 # Documentation: http://optics.miloush.net/lytro/TheFileFormat.aspx
1864 # Typical file extensions: .lfp .lfr .lfx
1865
1866 0       belong  0x894C4650
1867 >4      belong  0x0D0A1A0A
1868 >12     belong  0x00000000      Lytro Light Field Picture
1869 >8      belong  x               \b, version %d
1870
1871 # Type: Vision Research Phantom CINE Format
1872 # URL: https://www.phantomhighspeed.com/
1873 # URL2: http://phantomhighspeed.force.com/vriknowledge/servlet/fileField?id=0BEU0000000Cfyk
1874 # From: Harry Mallon <hjmallon at gmail.com>
1875 #
1876 # This has a short "CI" code but the 44 is the size of the struct which is
1877 # stable
1878 0       string  CI
1879 >2      leshort 44              Vision Research CINE Video,
1880 >>4     leshort 0               Grayscale,
1881 >>4     leshort 1               JPEG Compressed,
1882 >>4     leshort 2               RAW,
1883 >>6     leshort x               version %d,
1884 >>20    lelong  x               %d frames,
1885 >>48    lelong  x               %dx
1886 >>52    lelong  x               \b%d
1887
1888 # Type: ARRI Raw Image
1889 # Info: SMPTE RDD30:2014
1890 # From: Harry Mallon <hjmallon at gmail.com>
1891 0       string ARRI             ARRI ARI image data,
1892 >4      lelong 0x78563412       little-endian,
1893 >4      lelong 0x12345678       big-endian,
1894 >12     lelong x                version %d,
1895 >20     lelong x                %dx
1896 >24     lelong x                \b%d
1897
1898 # Type: Khronos KTX texture.
1899 # From: David Korth <gerbilsoft@gerbilsoft.com>
1900 # Reference: https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
1901
1902 # glEnum decoding.
1903 # NOTE: Only the most common formats are listed here.
1904 0       name    khronos-ktx-glEnum
1905 >0      lelong  0x1907  \b, RGB
1906 >0      lelong  0x1908  \b, RGBA
1907 >0      lelong  0x1909  \b, LUMINANCE
1908 >0      lelong  0x190A  \b, LUMINANCE_ALPHA
1909 >0      lelong  0x80E1  \b, BGR
1910 >0      lelong  0x80E2  \b, BGRA
1911 >0      lelong  0x83A0  \b, RGB_S3TC
1912 >0      lelong  0x83A1  \b, RGB4_S3TC
1913 >0      lelong  0x83A2  \b, RGBA_S3TC
1914 >0      lelong  0x83A3  \b, RGBA4_S3TC
1915 >0      lelong  0x83A4  \b, RGBA_DXT5_S3TC
1916 >0      lelong  0x83A5  \b, RGBA4_DXT5_S3TC
1917 >0      lelong  0x83F0  \b, COMPRESSED_RGB_S3TC_DXT1_EXT
1918 >0      lelong  0x83F1  \b, COMPRESSED_RGBA_S3TC_DXT1_EXT
1919 >0      lelong  0x83F2  \b, COMPRESSED_RGBA_S3TC_DXT3_EXT
1920 >0      lelong  0x83F3  \b, COMPRESSED_RGBA_S3TC_DXT5_EXT
1921 >0      lelong  0x8D64  \b, ETC1_RGB8_OES
1922 >0      lelong  0x9270  \b, COMPRESSED_R11_EAC
1923 >0      lelong  0x9271  \b, COMPRESSED_SIGNED_R11_EAC
1924 >0      lelong  0x9272  \b, COMPRESSED_RG11_EAC
1925 >0      lelong  0x9273  \b, COMPRESSED_SIGNED_RG11_EAC
1926 >0      lelong  0x9274  \b, COMPRESSED_RGB8_ETC2
1927 >0      lelong  0x9275  \b, COMPRESSED_SRGB8_ETC2
1928 >0      lelong  0x9276  \b, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
1929 >0      lelong  0x9277  \b, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
1930 >0      lelong  0x9278  \b, COMPRESSED_RGBA2_ETC2_EAC
1931 >0      lelong  0x9279  \b, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
1932 >0      lelong  0x93B0  \b, COMPRESSED_RGBA_ASTC_4x4_KHR
1933 >0      lelong  0x93B1  \b, COMPRESSED_RGBA_ASTC_5x4_KHR
1934 >0      lelong  0x93B2  \b, COMPRESSED_RGBA_ASTC_5x5_KHR
1935 >0      lelong  0x93B3  \b, COMPRESSED_RGBA_ASTC_6x5_KHR
1936 >0      lelong  0x93B4  \b, COMPRESSED_RGBA_ASTC_6x6_KHR
1937 >0      lelong  0x93B5  \b, COMPRESSED_RGBA_ASTC_8x5_KHR
1938 >0      lelong  0x93B6  \b, COMPRESSED_RGBA_ASTC_8x6_KHR
1939 >0      lelong  0x93B7  \b, COMPRESSED_RGBA_ASTC_8x8_KHR
1940 >0      lelong  0x93B8  \b, COMPRESSED_RGBA_ASTC_10x5_KHR
1941 >0      lelong  0x93B9  \b, COMPRESSED_RGBA_ASTC_10x6_KHR
1942 >0      lelong  0x93BA  \b, COMPRESSED_RGBA_ASTC_10x8_KHR
1943 >0      lelong  0x93BB  \b, COMPRESSED_RGBA_ASTC_10x10_KHR
1944 >0      lelong  0x93BC  \b, COMPRESSED_RGBA_ASTC_12x10_KHR
1945 >0      lelong  0x93BD  \b, COMPRESSED_RGBA_ASTC_12x12_KHR
1946 >0      lelong  0x93D0  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
1947 >0      lelong  0x93D1  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
1948 >0      lelong  0x93D2  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
1949 >0      lelong  0x93D3  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
1950 >0      lelong  0x93D4  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
1951 >0      lelong  0x93D5  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
1952 >0      lelong  0x93D6  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
1953 >0      lelong  0x93D7  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
1954 >0      lelong  0x93D8  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
1955 >0      lelong  0x93D9  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
1956 >0      lelong  0x93DA  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
1957 >0      lelong  0x93DB  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
1958 >0      lelong  0x93DC  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
1959 >0      lelong  0x93DD  \b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
1960
1961 # Endian-specific KTX header.
1962 # TODO: glType (all textures I've seen so far are GL_UNSIGNED_BYTE)
1963 0       name    khronos-ktx-endian-header
1964 >20     lelong  x       \b, %u
1965 >24     lelong  >1      x %u
1966 >28     lelong  >1      x %u
1967 >8      lelong  >0
1968 >>8     use     khronos-ktx-glEnum
1969 >8      lelong  0
1970 >>12    use     khronos-ktx-glEnum
1971
1972 # Main KTX header.
1973 # Determine endianness, then check the rest of the header.
1974 0       string  \xABKTX\ 11\xBB\r\n\x1A\n       Khronos KTX texture
1975 >12     lelong  0x04030201                      (little-endian)
1976 >>16    use     khronos-ktx-endian-header
1977 >12     belong  0x04030201                      (big-endian)
1978 >>16    use     \^khronos-ktx-endian-header
1979
1980 # Type: Khronos KTX2 texture.
1981 # From: David Korth <gerbilsoft@gerbilsoft.com>
1982 # Based on draft19.
1983 # Reference: http://github.khronos.org/KTX-Specification/
1984
1985 # Supercompression enum.
1986 0       name    khronos-ktx2-supercompression
1987 >0      lelong  1       Basis Universal
1988 >0      lelong  2       Zstandard
1989
1990 # Vulkan format identifier.
1991 # NOTE: Formats prohibited from KTX2 are commented out.
1992 0       name    khronos-ktx2-vkFormat
1993 >0      lelong  0       UNDEFINED
1994 >0      lelong  1       R4G4_UNORM_PACK8
1995 >0      lelong  2       R4G4B4A4_UNORM_PACK16
1996 >0      lelong  3       B4G4R4A4_UNORM_PACK16
1997 >0      lelong  4       R5G6B5_UNORM_PACK16
1998 >0      lelong  5       B5G6R5_UNORM_PACK16
1999 >0      lelong  6       R5G5B5A1_UNORM_PACK16
2000 >0      lelong  7       B5G5R5A1_UNORM_PACK16
2001 >0      lelong  8       A1R5G5B5_UNORM_PACK16
2002 >0      lelong  9       R8_UNORM
2003 >0      lelong  10      R8_SNORM
2004 #>0     lelong  11      R8_USCALED
2005 #>0     lelong  12      R8_SSCALED
2006 >0      lelong  13      R8_UINT
2007 >0      lelong  14      R8_SINT
2008 >0      lelong  15      R8_SRGB
2009 >0      lelong  16      R8G8_UNORM
2010 >0      lelong  17      R8G8_SNORM
2011 #>0     lelong  18      R8G8_USCALED
2012 #>0     lelong  19      R8G8_SSCALED
2013 >0      lelong  20      R8G8_UINT
2014 >0      lelong  21      R8G8_SINT
2015 >0      lelong  22      R8G8_SRGB
2016 >0      lelong  23      R8G8B8_UNORM
2017 >0      lelong  24      R8G8B8_SNORM
2018 #>0     lelong  25      R8G8B8_USCALED
2019 #>0     lelong  26      R8G8B8_SSCALED
2020 >0      lelong  27      R8G8B8_UINT
2021 >0      lelong  28      R8G8B8_SINT
2022 >0      lelong  29      R8G8B8_SRGB
2023 >0      lelong  30      B8G8R8_UNORM
2024 >0      lelong  31      B8G8R8_SNORM
2025 #>0     lelong  32      B8G8R8_USCALED
2026 #>0     lelong  33      B8G8R8_SSCALED
2027 >0      lelong  34      B8G8R8_UINT
2028 >0      lelong  35      B8G8R8_SINT
2029 >0      lelong  36      B8G8R8_SRGB
2030 >0      lelong  37      R8G8B8A8_UNORM
2031 >0      lelong  38      R8G8B8A8_SNORM
2032 #>0     lelong  39      R8G8B8A8_USCALED
2033 #>0     lelong  40      R8G8B8A8_SSCALED
2034 >0      lelong  41      R8G8B8A8_UINT
2035 >0      lelong  42      R8G8B8A8_SINT
2036 >0      lelong  43      R8G8B8A8_SRGB
2037 >0      lelong  44      B8G8R8A8_UNORM
2038 >0      lelong  45      B8G8R8A8_SNORM
2039 #>0     lelong  46      B8G8R8A8_USCALED
2040 #>0     lelong  47      B8G8R8A8_SSCALED
2041 >0      lelong  48      B8G8R8A8_UINT
2042 >0      lelong  49      B8G8R8A8_SINT
2043 >0      lelong  50      B8G8R8A8_SRGB
2044 #>0     lelong  51      A8B8G8R8_UNORM_PACK32
2045 #>0     lelong  52      A8B8G8R8_SNORM_PACK32
2046 #>0     lelong  53      A8B8G8R8_USCALED_PACK32
2047 #>0     lelong  54      A8B8G8R8_SSCALED_PACK32
2048 #>0     lelong  55      A8B8G8R8_UINT_PACK32
2049 #>0     lelong  56      A8B8G8R8_SINT_PACK32
2050 #>0     lelong  57      A8B8G8R8_SRGB_PACK32
2051 >0      lelong  58      A2R10G10B10_UNORM_PACK32
2052 >0      lelong  59      A2R10G10B10_SNORM_PACK32
2053 #>0     lelong  60      A2R10G10B10_USCALED_PACK32
2054 #>0     lelong  61      A2R10G10B10_SSCALED_PACK32
2055 >0      lelong  62      A2R10G10B10_UINT_PACK32
2056 >0      lelong  63      A2R10G10B10_SINT_PACK32
2057 >0      lelong  64      A2B10G10R10_UNORM_PACK32
2058 >0      lelong  65      A2B10G10R10_SNORM_PACK32
2059 #>0     lelong  66      A2B10G10R10_USCALED_PACK32
2060 #>0     lelong  67      A2B10G10R10_SSCALED_PACK32
2061 >0      lelong  68      A2B10G10R10_UINT_PACK32
2062 >0      lelong  69      A2B10G10R10_SINT_PACK32
2063 >0      lelong  70      R16_UNORM
2064 >0      lelong  71      R16_SNORM
2065 #>0     lelong  72      R16_USCALED
2066 #>0     lelong  73      R16_SSCALED
2067 >0      lelong  74      R16_UINT
2068 >0      lelong  75      R16_SINT
2069 >0      lelong  76      R16_SFLOAT
2070 >0      lelong  77      R16G16_UNORM
2071 >0      lelong  78      R16G16_SNORM
2072 #>0     lelong  79      R16G16_USCALED
2073 #>0     lelong  80      R16G16_SSCALED
2074 >0      lelong  81      R16G16_UINT
2075 >0      lelong  82      R16G16_SINT
2076 >0      lelong  83      R16G16_SFLOAT
2077 >0      lelong  84      R16G16B16_UNORM
2078 >0      lelong  85      R16G16B16_SNORM
2079 #>0     lelong  86      R16G16B16_USCALED
2080 #>0     lelong  87      R16G16B16_SSCALED
2081 >0      lelong  88      R16G16B16_UINT
2082 >0      lelong  89      R16G16B16_SINT
2083 >0      lelong  90      R16G16B16_SFLOAT
2084 >0      lelong  91      R16G16B16A16_UNORM
2085 >0      lelong  92      R16G16B16A16_SNORM
2086 #>0     lelong  93      R16G16B16A16_USCALED
2087 #>0     lelong  94      R16G16B16A16_SSCALED
2088 >0      lelong  95      R16G16B16A16_UINT
2089 >0      lelong  96      R16G16B16A16_SINT
2090 >0      lelong  97      R16G16B16A16_SFLOAT
2091 >0      lelong  98      R32_UINT
2092 >0      lelong  99      R32_SINT
2093 >0      lelong  100     R32_SFLOAT
2094 >0      lelong  101     R32G32_UINT
2095 >0      lelong  102     R32G32_SINT
2096 >0      lelong  103     R32G32_SFLOAT
2097 >0      lelong  104     R32G32B32_UINT
2098 >0      lelong  105     R32G32B32_SINT
2099 >0      lelong  106     R32G32B32_SFLOAT
2100 >0      lelong  107     R32G32B32A32_UINT
2101 >0      lelong  108     R32G32B32A32_SINT
2102 >0      lelong  109     R32G32B32A32_SFLOAT
2103 >0      lelong  110     R64_UINT
2104 >0      lelong  111     R64_SINT
2105 >0      lelong  112     R64_SFLOAT
2106 >0      lelong  113     R64G64_UINT
2107 >0      lelong  114     R64G64_SINT
2108 >0      lelong  115     R64G64_SFLOAT
2109 >0      lelong  116     R64G64B64_UINT
2110 >0      lelong  117     R64G64B64_SINT
2111 >0      lelong  118     R64G64B64_SFLOAT
2112 >0      lelong  119     R64G64B64A64_UINT
2113 >0      lelong  120     R64G64B64A64_SINT
2114 >0      lelong  121     R64G64B64A64_SFLOAT
2115 >0      lelong  122     B10G11R11_UFLOAT_PACK32
2116 >0      lelong  123     E5B9G9R9_UFLOAT_PACK32
2117 >0      lelong  124     D16_UNORM
2118 >0      lelong  125     X8_D24_UNORM_PACK32
2119 >0      lelong  126     D32_SFLOAT
2120 >0      lelong  127     S8_UINT
2121 >0      lelong  128     D16_UNORM_S8_UINT
2122 >0      lelong  129     D24_UNORM_S8_UINT
2123 >0      lelong  130     D32_SFLOAT_S8_UINT
2124
2125 >0      lelong  131     BC1_RGB_UNORM_BLOCK
2126 >0      lelong  132     BC1_RGB_SRGB_BLOCK
2127 >0      lelong  133     BC1_RGBA_UNORM_BLOCK
2128 >0      lelong  134     BC1_RGBA_SRGB_BLOCK
2129 >0      lelong  135     BC2_UNORM_BLOCK
2130 >0      lelong  136     BC2_SRGB_BLOCK
2131 >0      lelong  137     BC3_UNORM_BLOCK
2132 >0      lelong  138     BC3_SRGB_BLOCK
2133 >0      lelong  139     BC4_UNORM_BLOCK
2134 >0      lelong  140     BC4_SNORM_BLOCK
2135 >0      lelong  141     BC5_UNORM_BLOCK
2136 >0      lelong  142     BC5_SNORM_BLOCK
2137 >0      lelong  143     BC6H_UFLOAT_BLOCK
2138 >0      lelong  144     BC6H_SFLOAT_BLOCK
2139 >0      lelong  145     BC7_UNORM_BLOCK
2140 >0      lelong  146     BC7_SRGB_BLOCK
2141
2142 >0      lelong  147     ETC2_R8G8B8_UNORM_BLOCK
2143 >0      lelong  148     ETC2_R8G8B8_SRGB_BLOCK
2144 >0      lelong  149     ETC2_R8G8B8A1_UNORM_BLOCK
2145 >0      lelong  150     ETC2_R8G8B8A1_SRGB_BLOCK
2146 >0      lelong  151     ETC2_R8G8B8A8_UNORM_BLOCK
2147 >0      lelong  152     ETC2_R8G8B8A8_SRGB_BLOCK
2148
2149 >0      lelong  153     EAC_R11_UNORM_BLOCK
2150 >0      lelong  154     EAC_R11_SNORM_BLOCK
2151 >0      lelong  155     EAC_R11G11_UNORM_BLOCK
2152 >0      lelong  156     EAC_R11G11_SNORM_BLOCK
2153
2154 >0      lelong  157     ASTC_4x4_UNORM_BLOCK
2155 >0      lelong  158     ASTC_4x4_SRGB_BLOCK
2156 >0      lelong  159     ASTC_5x4_UNORM_BLOCK
2157 >0      lelong  160     ASTC_5x4_SRGB_BLOCK
2158 >0      lelong  161     ASTC_5x5_UNORM_BLOCK
2159 >0      lelong  162     ASTC_5x5_SRGB_BLOCK
2160 >0      lelong  163     ASTC_6x5_UNORM_BLOCK
2161 >0      lelong  164     ASTC_6x5_SRGB_BLOCK
2162 >0      lelong  165     ASTC_6x6_UNORM_BLOCK
2163 >0      lelong  166     ASTC_6x6_SRGB_BLOCK
2164 >0      lelong  167     ASTC_8x5_UNORM_BLOCK
2165 >0      lelong  168     ASTC_8x5_SRGB_BLOCK
2166 >0      lelong  169     ASTC_8x6_UNORM_BLOCK
2167 >0      lelong  170     ASTC_8x6_SRGB_BLOCK
2168 >0      lelong  171     ASTC_8x8_UNORM_BLOCK
2169 >0      lelong  172     ASTC_8x8_SRGB_BLOCK
2170 >0      lelong  173     ASTC_10x5_UNORM_BLOCK
2171 >0      lelong  174     ASTC_10x5_SRGB_BLOCK
2172 >0      lelong  175     ASTC_10x6_UNORM_BLOCK
2173 >0      lelong  176     ASTC_10x6_SRGB_BLOCK
2174 >0      lelong  177     ASTC_10x8_UNORM_BLOCK
2175 >0      lelong  178     ASTC_10x8_SRGB_BLOCK
2176 >0      lelong  179     ASTC_10x10_UNORM_BLOCK
2177 >0      lelong  180     ASTC_10x10_SRGB_BLOCK
2178 >0      lelong  181     ASTC_12x10_UNORM_BLOCK
2179 >0      lelong  182     ASTC_12x10_SRGB_BLOCK
2180 >0      lelong  183     ASTC_12x12_UNORM_BLOCK
2181 >0      lelong  184     ASTC_12x12_SRGB_BLOCK
2182
2183 >0      lelong  1000156000      G8B8G8R8_422_UNORM
2184 >0      lelong  1000156001      B8G8R8G8_422_UNORM
2185 >0      lelong  1000156002      G8_B8_R8_3PLANE_420_UNORM
2186 >0      lelong  1000156003      G8_B8R8_2PLANE_420_UNORM
2187 >0      lelong  1000156004      G8_B8_R8_3PLANE_422_UNORM
2188 >0      lelong  1000156005      G8_B8R8_2PLANE_422_UNORM
2189 >0      lelong  1000156006      G8_B8_R8_3PLANE_444_UNORM
2190 >0      lelong  1000156007      R10X6_UNORM_PACK16
2191 >0      lelong  1000156008      R10X6G10X6_UNORM_2PACK16
2192 >0      lelong  1000156009      R10X6G10X6B10X6A10X6_UNORM_4PACK16
2193 >0      lelong  1000156010      G10X6B10X6G10X6R10X6_422_UNORM_4PACK16
2194 >0      lelong  1000156011      B10X6G10X6R10X6G10X6_422_UNORM_4PACK16
2195 >0      lelong  1000156012      G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16
2196 >0      lelong  1000156013      G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16
2197 >0      lelong  1000156014      G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16
2198 >0      lelong  1000156015      G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16
2199 >0      lelong  1000156016      G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16
2200 >0      lelong  1000156017      R12X4_UNORM_PACK16
2201 >0      lelong  1000156018      R12X4G12X4_UNORM_2PACK16
2202 >0      lelong  1000156019      R12X4G12X4B12X4A12X4_UNORM_4PACK16
2203 >0      lelong  1000156020      G12X4B12X4G12X4R12X4_422_UNORM_4PACK16
2204 >0      lelong  1000156021      B12X4G12X4R12X4G12X4_422_UNORM_4PACK16
2205 >0      lelong  1000156022      G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16
2206 >0      lelong  1000156023      G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16
2207 >0      lelong  1000156024      G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16
2208 >0      lelong  1000156025      G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16
2209 >0      lelong  1000156026      G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16
2210 >0      lelong  1000156027      G16B16G16R16_422_UNORM
2211 >0      lelong  1000156028      B16G16R16G16_422_UNORM
2212 >0      lelong  1000156029      G16_B16_R16_3PLANE_420_UNORM
2213 >0      lelong  1000156030      G16_B16R16_2PLANE_420_UNORM
2214 >0      lelong  1000156031      G16_B16_R16_3PLANE_422_UNORM
2215 >0      lelong  1000156032      G16_B16R16_2PLANE_422_UNORM
2216 >0      lelong  1000156033      G16_B16_R16_3PLANE_444_UNORM
2217
2218 >0      lelong  1000054000      PVRTC1_2BPP_UNORM_BLOCK_IMG
2219 >0      lelong  1000054001      PVRTC1_4BPP_UNORM_BLOCK_IMG
2220 >0      lelong  1000054002      PVRTC2_2BPP_UNORM_BLOCK_IMG
2221 >0      lelong  1000054003      PVRTC2_4BPP_UNORM_BLOCK_IMG
2222 >0      lelong  1000054004      PVRTC1_2BPP_SRGB_BLOCK_IMG
2223 >0      lelong  1000054005      PVRTC1_4BPP_SRGB_BLOCK_IMG
2224 >0      lelong  1000054006      PVRTC2_2BPP_SRGB_BLOCK_IMG
2225 >0      lelong  1000054007      PVRTC2_4BPP_SRGB_BLOCK_IMG
2226
2227 >0      lelong  1000066000      ASTC_4x4_SFLOAT_BLOCK_EXT
2228 >0      lelong  1000066001      ASTC_5x4_SFLOAT_BLOCK_EXT
2229 >0      lelong  1000066002      ASTC_5x5_SFLOAT_BLOCK_EXT
2230 >0      lelong  1000066003      ASTC_6x5_SFLOAT_BLOCK_EXT
2231 >0      lelong  1000066004      ASTC_6x6_SFLOAT_BLOCK_EXT
2232 >0      lelong  1000066005      ASTC_8x5_SFLOAT_BLOCK_EXT
2233 >0      lelong  1000066006      ASTC_8x6_SFLOAT_BLOCK_EXT
2234 >0      lelong  1000066007      ASTC_8x8_SFLOAT_BLOCK_EXT
2235 >0      lelong  1000066008      ASTC_10x5_SFLOAT_BLOCK_EXT
2236 >0      lelong  1000066009      ASTC_10x6_SFLOAT_BLOCK_EXT
2237 >0      lelong  1000066010      ASTC_10x8_SFLOAT_BLOCK_EXT
2238 >0      lelong  1000066011      ASTC_10x10_SFLOAT_BLOCK_EXT
2239 >0      lelong  1000066012      ASTC_12x10_SFLOAT_BLOCK_EXT
2240 >0      lelong  1000066013      ASTC_12x12_SFLOAT_BLOCK_EXT
2241
2242 # Main KTX2 header.
2243 0       string  \xABKTX\ 20\xBB\r\n\x1A\n       Khronos KTX2 texture
2244 >20     lelong  x       \b, %u
2245 >24     lelong  >1      x %u
2246 >28     lelong  >1      x %u
2247 >32     lelong  >1      \b, %u layers
2248 >36     lelong  >1      \b, %u faces
2249 >40     lelong  >1      \b, %u mipmaps
2250 >44     lelong  >0      \b,
2251 >>44    use     khronos-ktx2-supercompression
2252 >12     lelong  >0      \b,
2253 >>12    use     khronos-ktx2-vkFormat
2254
2255 # Type: Valve VTF texture.
2256 # From: David Korth <gerbilsoft@gerbilsoft.com>
2257 # References:
2258 # - https://developer.valvesoftware.com/wiki/Valve_Texture_Format
2259
2260 # VTF image formats.
2261 0       name    vtf-image-format
2262 >0      lelong  0       RGBA8888
2263 >0      lelong  1       ABGR8888
2264 >0      lelong  2       RGB888
2265 >0      lelong  3       BGR888
2266 >0      lelong  4       RGB565
2267 >0      lelong  5       I8
2268 >0      lelong  6       IA88
2269 >0      lelong  7       P8
2270 >0      lelong  8       A8
2271 >0      lelong  9       RGB888 (bluescreen)
2272 >0      lelong  10      BGR888 (bluescreen)
2273 >0      lelong  11      ARGB8888
2274 >0      lelong  12      BGRA8888
2275 >0      lelong  13      DXT1
2276 >0      lelong  14      DXT3
2277 >0      lelong  15      DXT5
2278 >0      lelong  16      BGRx8888
2279 >0      lelong  17      BGR565
2280 >0      lelong  18      BGRx5551
2281 >0      lelong  19      BGRA4444
2282 >0      lelong  20      DXT1+A1
2283 >0      lelong  21      BGRA5551
2284 >0      lelong  22      UV88
2285 >0      lelong  23      UVWQ8888
2286 >0      lelong  24      RGBA16161616F
2287 >0      lelong  25      RGBA16161616
2288 >0      lelong  26      UVLX8888
2289
2290 # Main VTF header.
2291 0       string  VTF\0                           Valve Texture Format
2292 >4      lelong  x                               v%u
2293 >8      lelong  x                               \b.%u
2294 >0x10   leshort x                               \b, %u
2295 >0x12   leshort >1                              x %u
2296 >4      lequad  0x0000000700000002
2297 >>0x3F  leshort >1                              x %u
2298 >0x18   leshort >1                              \b, %u frames
2299 >0x38   byte    x                               \b, mipmaps: %u
2300 >0x34   lelong  >-1                             \b,
2301 >>0x34  use     vtf-image-format
2302
2303 # Type: Valve VTF3 (PS3) texture.
2304 # From: David Korth <gerbilsoft@gerbilsoft.com>
2305 0       string          VTF3    Valve Texture Format (PS3)
2306 >0x14   beshort         x       \b, %u
2307 >0x16   beshort         x       \b x %u
2308 >0x10   belong&0x2000   0       \b, DXT1
2309 >0x10   belong&0x2000   0x2000  \b, DXT5
2310
2311 # Type: ASTC texture.
2312 # From: David Korth <gerbilsoft@gerbilsoft.com>
2313 # References:
2314 # - https://stackoverflow.com/questions/22600678/determine-internal-format-of-given-astc-compressed-image-through-its-header
2315 # - https://stackoverflow.com/a/22682244
2316 0       lelong  0x5ca1ab13                      ASTC
2317 >4      byte    x                               %u
2318 >5      byte    x                               \bx%u
2319 >6      byte    >1                              \bx%u
2320 # X, Y, and Z dimensions are stored as 24-bit LE.
2321 # Pretend it's 32-bit and mask off the high byte.
2322 >7      lelong&0x00FFFFFF       x               texture, %u
2323 >10     lelong&0x00FFFFFF       x               x %u
2324 >13     lelong&0x00FFFFFF       >1              x %u
2325
2326 # Zebra Metafile graphic
2327 # http://www.fileformat.info/format/zbr/egff.htm
2328 0       beshort 0x9a02  Zebra Metafile graphic
2329 >2      leshort 1       (version 1.x)
2330 >2      leshort 2       (version 1.1x or 1.2x)
2331 >2      leshort 3       (version 1.49)
2332 >2      leshort 4       (version 1.50)
2333 >4      string  x       (comment = %s)
2334
2335 # Microsoft Paint graphic
2336 # http://www.fileformat.info/format/mspaint/egff.htm
2337 0       string  DanM    icrosoft Paint image data (version 1.x)
2338 >4      leshort x       (%d
2339 >>6     leshort x       x %d)
2340 0       string  LinS    Microsoft Paint image data (version 2.0)
2341 >4      leshort x       (%d
2342 >>6     leshort x       x %d)
2343
2344 # reMarkable tablet internal file format (https://www.remarkable.com/)
2345 # https://github.com/ax3l/lines-are-beautiful
2346 # https://plasma.ninja/blog/devices/remarkable/binary/format/2017/12/26/\
2347 #       reMarkable-lines-file-format.html#what-to-do-next
2348 # from Axel Huebl
2349 0               string  reMarkable
2350 >11             string  lines
2351 >>17            string  with
2352 >>>22           string  selections
2353 >>>>33          string  and
2354 >>>>>37         string  layers
2355 >>>>>>43        lelong  x       reMarkable tablet notebook lines, 1404 x 1872, %x page(s)
2356
2357 # newer per-page files for the reMarkable
2358 0               string  reMarkable
2359 >11             string  .lines
2360 >>18            string  file,
2361 >>>24           string  version=
2362 >>>>32          byte    x       reMarkable tablet page (v%c), 1404 x 1872,
2363 >>>>>43         lelong  x       %d layer(s)
2364
2365 # Type: PVR3 texture.
2366 # From: David Korth <gerbilsoft@gerbilsoft.com>
2367 # References:
2368 # - http://cdn.imgtec.com/sdk-documentation/PVR+File+Format.Specification.pdf
2369
2370 # PVR3 pixel formats.
2371 0       name            pvr3-pixel-format
2372 >0      ulelong 0       PVRTC 2bpp RGB
2373 >0      ulelong 1       PVRTC 2bpp RGBA
2374 >0      ulelong 2       PVRTC 4bpp RGB
2375 >0      ulelong 3       PVRTC 4bpp RGBA
2376 >0      ulelong 4       PVRTC-II 2bpp
2377 >0      ulelong 5       PVRTC-II 4bpp
2378 >0      ulelong 6       ETC1
2379 >0      ulelong 7       DXT1
2380 >0      ulelong 8       DXT2
2381 >0      ulelong 9       DXT3
2382 >0      ulelong 10      DXT4
2383 >0      ulelong 11      DXT5
2384 >0      ulelong 12      BC4
2385 >0      ulelong 13      BC5
2386 >0      ulelong 14      BC6
2387 >0      ulelong 15      BC7
2388 >0      ulelong 16      UYVY
2389 >0      ulelong 17      YUY2
2390 >0      ulelong 18      BW1bpp
2391 >0      ulelong 19      R9G9B9E5 Shared Exponent
2392 >0      ulelong 20      RGBG8888
2393 >0      ulelong 21      GRGB8888
2394 >0      ulelong 22      ETC2 RGB
2395 >0      ulelong 23      ETC2 RGBA
2396 >0      ulelong 24      ETC2 RGB A1
2397 >0      ulelong 25      EAC R11
2398 >0      ulelong 26      EAC RG11
2399 >0      ulelong 27      ASTC_4x4
2400 >0      ulelong 28      ASTC_5x4
2401 >0      ulelong 29      ASTC_5x5
2402 >0      ulelong 30      ASTC_6x5
2403 >0      ulelong 31      ASTC_6x6
2404 >0      ulelong 32      ASTC_8x5
2405 >0      ulelong 33      ASTC_8x6
2406 >0      ulelong 34      ASTC_8x8
2407 >0      ulelong 35      ASTC_10x5
2408 >0      ulelong 36      ASTC_10x6
2409 >0      ulelong 37      ASTC_10x8
2410 >0      ulelong 38      ASTC_10x10
2411 >0      ulelong 39      ASTC_12x10
2412 >0      ulelong 40      ASTC_12x12
2413 >0      ulelong 41      ASTC_3x3x3
2414 >0      ulelong 42      ASTC_4x3x3
2415 >0      ulelong 43      ASTC_4x4x3
2416 >0      ulelong 44      ASTC_4x4x4
2417 >0      ulelong 45      ASTC_5x4x4
2418 >0      ulelong 46      ASTC_5x5x4
2419 >0      ulelong 47      ASTC_5x5x5
2420 >0      ulelong 48      ASTC_6x5x5
2421 >0      ulelong 49      ASTC_6x6x5
2422 >0      ulelong 50      ASTC_6x6x6
2423
2424 0       string          PVR\x03                 PowerVR 3.0 texture:
2425 >0x18   ulelong         x       %u x
2426 >0x1C   ulelong         x       %u
2427 >0x20   ulelong         >1      x %u
2428 >0x08   byte            x       \b,
2429 >0x0C   ulelong         0
2430 >>0x08  use     pvr3-pixel-format
2431 >0x0C   ulelong         !0
2432 >>0x08  byte    !0      %c
2433 >>>0x0C byte    !0      \b%u
2434 >>0x09  byte    !0      \b%c
2435 >>>0x0D byte    !0      \b%u
2436 >>0x0A  byte    !0      \b%c
2437 >>>0x0E byte    !0      \b%u
2438 >>0x0B  byte    !0      \b%c
2439 >>>0x0F byte    !0      \b%u
2440 >0x10   ulelong         1       \b, sRGB
2441 >0x04   ulelong&0x02    0x02    \b, premultiplied alpha
2442
2443 0       string          \x03RVP                 PowerVR 3.0 texture: BE,
2444 >0x18   ubelong         x       %u x
2445 >0x1C   ubelong         x       %u
2446 >0x20   ubelong         >1      x %u
2447 >0x08   byte            x       \b,
2448 >0x0C   ubelong         0
2449 >>0x08  use     pvr3-pixel-format
2450 >0x0C   ubelong         !0
2451 >>0x0B  byte    !0      %c
2452 >>>0x0F byte    !0      \b%u
2453 >>0x0A  byte    !0      \b%c
2454 >>>0x0E byte    !0      \b%u
2455 >>0x09  byte    !0      \b%c
2456 >>>0x0D byte    !0      \b%u
2457 >>0x08  byte    !0      \b%c
2458 >>>0x0C byte    !0      \b%u
2459 >0x10   ubelong         1       \b, sRGB
2460 >0x04   ubelong&0x02    0x02    \b, premultiplied alpha
2461
2462 # Type: Microsoft Xbox XPR0 texture.
2463 # From: David Korth <gerbilsoft@gerbilsoft.com>
2464 # References:
2465 # - https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/develop/src/core/hle/D3D8/XbD3D8Types.h
2466
2467 # XPR pixel formats.
2468 0       name    xbox-xpr-pixel-format
2469 >0      byte    0x00    L8
2470 >0      byte    0x01    AL8
2471 >0      byte    0x02    ARGB1555
2472 >0      byte    0x03    RGB555
2473 >0      byte    0x04    ARGB4444
2474 >0      byte    0x05    RGB565
2475 >0      byte    0x06    ARGB8888
2476 >0      byte    0x07    xRGB8888
2477 >0      byte    0x0B    P8
2478 >0      byte    0x0C    DXT1
2479 >0      byte    0x0E    DXT2
2480 >0      byte    0x0F    DXT4
2481 >0      byte    0x10    Linear ARGB1555
2482 >0      byte    0x11    Linear RGB565
2483 >0      byte    0x12    Linear ARGB8888
2484 >0      byte    0x13    Linear L8
2485 >0      byte    0x16    Linear R8B8
2486 >0      byte    0x17    Linear G8B8
2487 >0      byte    0x19    A8
2488 >0      byte    0x1A    A8L8
2489 >0      byte    0x1B    Linear AL8
2490 >0      byte    0x1C    Linear RGB555
2491 >0      byte    0x1D    Linear ARGB4444
2492 >0      byte    0x1E    Linear xRGB8888
2493 >0      byte    0x1F    Linear A8
2494 >0      byte    0x20    Linear A8L8
2495 >0      byte    0x24    YUY2
2496 >0      byte    0x25    UYVY
2497 >0      byte    0x27    L6V5U5
2498 >0      byte    0x28    V8U8
2499 >0      byte    0x29    R8B8
2500 >0      byte    0x2A    D24S8
2501 >0      byte    0x2B    F24S8
2502 >0      byte    0x2C    D16
2503 >0      byte    0x2D    F16
2504 >0      byte    0x2E    Linear D24S8
2505 >0      byte    0x2F    Linear F24S8
2506 >0      byte    0x30    Linear D16
2507 >0      byte    0x31    Linear F16
2508 >0      byte    0x32    L16
2509 >0      byte    0x33    V16U16
2510 >0      byte    0x35    Linear L16
2511 >0      byte    0x36    Linear V16U16
2512 >0      byte    0x37    Linear L6V5U5
2513 >0      byte    0x38    RGBA5551
2514 >0      byte    0x39    RGBA4444
2515 >0      byte    0x3A    QWVU8888
2516 >0      byte    0x3B    BGRA8888
2517 >0      byte    0x3C    RGBA8888
2518 >0      byte    0x3D    Linear RGBA5551
2519 >0      byte    0x3E    Linear RGBA4444
2520 >0      byte    0x3F    Linear ABGR8888
2521 >0      byte    0x40    Linear BGRA8888
2522 >0      byte    0x41    Linear RGBA8888
2523 >0      byte    0x64    Vertex Data
2524
2525 0       string          XPR0    Microsoft Xbox XPR0 texture
2526 >0x19   byte    x       \b, format:
2527 >>0x19  use     xbox-xpr-pixel-format
2528
2529 # ILDA Image Data Transfer Format
2530 # https://www.ilda.com/resources/StandardsDocs/ILDA_IDTF14_rev011.pdf
2531 #
2532 # Updated by Chuck Hein (laser@geekdude.com)
2533 #
2534 0       string  ILDA    ILDA Image Data Transfer Format
2535 >7      byte    0x00    3D Coordinates with Indexed Color
2536 >7      byte    0x01    2D Coordinates with Indexed Color
2537 >7      byte    0x02    Color Palette
2538 >7      byte    0x04    3D Coordinates with True Color
2539 >7      byte    0x05    2D Coordinates with True Color
2540 >8      string  >0      \b, palette %s
2541 >16     string  >0      \b, company %s
2542 >24     beshort >0      \b, number of records %d
2543 >>26    beshort x       \b, palette number %d
2544 >>28    beshort >0      \b, number of frames %d
2545 >>30    byte    >0      \b, projector number %d
2546
2547 # Dropbox "lepton" compressed jpeg format
2548 # https://github.com/dropbox/lepton
2549 0       belong&0xfffff0ff       0xcf84005a      Lepton image file
2550 >2      byte                    x               (version %d)
2551
2552 # Apple QuickTake camera raw images
2553 # https://en.wikipedia.org/wiki/Apple_QuickTake
2554 # dcraw can decode them
2555 0       name quicktake
2556 >4      belong  8
2557 >>544   beshort x       \b, %dx
2558 >>546   beshort x       \b%d
2559 >4      belong  4
2560 >>546   beshort x       \b, %dx
2561 >>544   beshort x       \b%d
2562
2563 0       string  qktk    Apple QuickTake 100 Raw Image
2564 >0      use quicktake
2565
2566 0       string  qktn
2567 >4      byte    0       Apple QuickTake 150 Raw Image
2568 >4      byte    >0      Apple QuickTake 200 Raw Image
2569 >0      use quicktake