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