xref: /netbsd-src/external/bsd/file/dist/magic/magdir/images (revision afab4e300d3a9fb07dd8c80daf53d0feb3345706)
1
2#------------------------------------------------------------------------------
3# $File: images,v 1.229 2022/09/23 13:21:22 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}[\040\t\f\r\n]+[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	ubyte		48		version 2
264>21	ubyte		51		version 3
2650	string		.MDP		MicroDesign page data
266>21	ubyte		48		version 2
267>21	ubyte		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	uleshort	x	\b, version %d.
281>14	uleshort	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	ubyte		x	\b, version %d.
292>11	ubyte		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	uleshort	x		\b, direntries=%d
324>2	use		tiff_entry
325
3260	name		tiff_entry
327# NewSubFileType
328>0	uleshort	0xfe
329>>12	use		tiff_entry
330>0	uleshort	0x100
331>>4	ulelong		1
332>>>12	use		tiff_entry
333>>>8	uleshort	x		\b, width=%d
334>0	uleshort	0x101
335>>4	ulelong		1
336>>>8	uleshort	x		\b, height=%d
337>>>12	use		tiff_entry
338>0	uleshort	0x102
339>>8	uleshort	x		\b, bps=%d
340>>12	use		tiff_entry
341>0	uleshort	0x103
342>>4	ulelong		1		\b, compression=
343>>>8	uleshort	1		\bnone
344>>>8	uleshort	2		\bhuffman
345>>>8	uleshort	3		\bbi-level group 3
346>>>8	uleshort	4		\bbi-level group 4
347>>>8	uleshort	5		\bLZW
348>>>8	uleshort	6		\bJPEG (old)
349>>>8	uleshort	7		\bJPEG
350>>>8	uleshort	8		\bdeflate
351>>>8	uleshort	9		\bJBIG, ITU-T T.85
352>>>8	uleshort	0xa		\bJBIG, ITU-T T.43
353>>>8	uleshort	0x7ffe		\bNeXT RLE 2-bit
354>>>8	uleshort	0x8005		\bPackBits (Macintosh RLE)
355>>>8	uleshort	0x8029		\bThunderscan RLE
356>>>8	uleshort	0x807f		\bRasterPadding (CT or MP)
357>>>8	uleshort	0x8080		\bRLE (Line Work)
358>>>8	uleshort	0x8081		\bRLE (High-Res Cont-Tone)
359>>>8	uleshort	0x8082		\bRLE (Binary Line Work)
360>>>8	uleshort	0x80b2		\bDeflate (PKZIP)
361>>>8	uleshort	0x80b3		\bKodak DCS
362>>>8	uleshort	0x8765		\bJBIG
363>>>8	uleshort	0x8798		\bJPEG2000
364>>>8	uleshort	0x8799		\bNikon NEF Compressed
365>>>8	default		x
366>>>>8	uleshort	x		\b(unknown %#x)
367>>>12	use		tiff_entry
368>0	uleshort	0x106		\b, PhotometricInterpretation=
369>>8	clear		x
370>>8	uleshort	0		\bWhiteIsZero
371>>8	uleshort	1		\bBlackIsZero
372>>8	uleshort	2		\bRGB
373>>8	uleshort	3		\bRGB Palette
374>>8	uleshort	4		\bTransparency Mask
375>>8	uleshort	5		\bCMYK
376>>8	uleshort	6		\bYCbCr
377>>8	uleshort	8		\bCIELab
378>>8	default		x
379>>>8	uleshort	x		\b(unknown=%#x)
380>>12	use		tiff_entry
381# FillOrder
382>0	uleshort	0x10a
383>>4	ulelong		1
384>>>12	use		tiff_entry
385# DocumentName
386>0	uleshort	0x10d
387>>(8.l)	string		x		\b, name=%s
388>>>12	use		tiff_entry
389# ImageDescription
390>0	uleshort	0x10e
391>>(8.l)	string		x		\b, description=%s
392>>>12	use		tiff_entry
393# Make
394>0	uleshort	0x10f
395>>(8.l)	string		x		\b, manufacturer=%s
396>>>12	use		tiff_entry
397# Model
398>0	uleshort	0x110
399>>(8.l)	string		x		\b, model=%s
400>>>12	use		tiff_entry
401# StripOffsets
402>0	uleshort	0x111
403>>12	use		tiff_entry
404# Orientation
405>0	uleshort	0x112		\b, orientation=
406>>8	uleshort	1		\bupper-left
407>>8	uleshort	3		\blower-right
408>>8	uleshort	6		\bupper-right
409>>8	uleshort	8		\blower-left
410>>8	uleshort	9		\bundefined
411>>8	default		x
412>>>8	uleshort	x		\b[*%d*]
413>>12	use		tiff_entry
414# XResolution
415>0	uleshort	0x11a
416>>8	ulelong		x		\b, xresolution=%d
417>>12	use		tiff_entry
418# YResolution
419>0	uleshort	0x11b
420>>8	ulelong		x		\b, yresolution=%d
421>>12	use		tiff_entry
422# ResolutionUnit
423>0	uleshort	0x128
424>>8	uleshort	x		\b, resolutionunit=%d
425>>12	use		tiff_entry
426# Software
427>0	uleshort	0x131
428>>(8.l)	string		x		\b, software=%s
429>>12	use		tiff_entry
430# Datetime
431>0	uleshort	0x132
432>>(8.l)	string		x		\b, datetime=%s
433>>12	use		tiff_entry
434# HostComputer
435>0	uleshort	0x13c
436>>(8.l)	string		x		\b, hostcomputer=%s
437>>12	use		tiff_entry
438# WhitePoint
439>0	uleshort	0x13e
440>>12	use		tiff_entry
441# PrimaryChromaticities
442>0	uleshort	0x13f
443>>12	use		tiff_entry
444# YCbCrCoefficients
445>0	uleshort	0x211
446>>12	use		tiff_entry
447# YCbCrPositioning
448>0	uleshort	0x213
449>>12	use		tiff_entry
450# ReferenceBlackWhite
451>0	uleshort	0x214
452>>12	use		tiff_entry
453# Copyright
454>0	uleshort	0x8298
455>>(8.l)	string		x		\b, copyright=%s
456>>12	use		tiff_entry
457# ExifOffset
458>0	uleshort	0x8769
459>>12	use		tiff_entry
460# GPS IFD
461>0	uleshort	0x8825		\b, GPS-Data
462>>12	use		tiff_entry
463
464#>0	uleshort	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	ubelong		x		\b, %d x
482>4	ubelong		x		%d,
483>8	ubyte		x		%d-bit
484>9	ubyte		0		grayscale,
485>9	ubyte		2		\b/color RGB,
486>9	ubyte		3		colormap,
487>9	ubyte		4		gray+alpha,
488>9	ubyte		6		\b/color RGBA,
489#>10	ubyte		0		deflate/32K,
490>12	ubyte		0		non-interlaced
491>12	ubyte		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	uleshort	>0		%d x
536>8	uleshort	>0		%d
537#>10	ubyte		&0x80		color mapped,
538#>10	ubyte&0x07	=0x00		2 colors
539#>10	ubyte&0x07	=0x01		4 colors
540#>10	ubyte&0x07	=0x02		8 colors
541#>10	ubyte&0x07	=0x03		16 colors
542#>10	ubyte&0x07	=0x04		32 colors
543#>10	ubyte&0x07	=0x05		64 colors
544#>10	ubyte&0x07	=0x06		128 colors
545#>10	ubyte&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	ulelong		>0		%d x
551>8	ulelong		>0		%d,
552>12	ulelong		>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
599# URL: 		http://fileformats.archiveteam.org/wiki/Fig
600#		https://en.wikipedia.org/wiki/Xfig
601# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/f/fig.trid.xml
602# https://web.archive.org/web/20070920204655/http://epb.lbl.gov/xfig/fig-format.html
603# Update:	Joerg Jenderek
604# Note:		called "FIG vector drawing" by TrID,
605#		4 byte magic is assumed to be always at offset 0 and
606#		verified by `fig2mpdf -v bootloader.fig && file bootloader.pdf`
607#0	search/1/tb	#FIG		FIG image text
608# GRR: with --keep-going option the line above gives duplicate messages
6090	search/1/ts	#FIG
610>&0	use		image-xfig
611# binary data variant with non ASCII text characters like Control-A or �C in thermostat.fig
6120	search/1/bs	#FIG
613>&0	use		image-xfig
614#	display XFIG image describing text, mime type, file name extension and version
6150	name		image-xfig
616>8	ubyte		x		FIG image text
617#!:mime	text/plain
618# https://reposcope.com/mimetype/image/x-xfig
619!:mime	image/x-xfig
620!:ext	fig
621# version string like: 1.4 2.1 3.1 3.2
622>5	string		x		\b, version %.3s
623# some times after version text like: "Produced by xfig version 3.2.5-alpha5"
624>8	ubyte		>0x0D
625>>8	string		x		"%s"
626# should be point character (2Eh) of version string according to TrID
627#>6	ubyte		!0x2E		\b, at 6 %#x
628# caret character (23h) at the beginning in most or probaly all exanples
629#>0	ubyte		!0x23		\b, starting with character %#x
630# URL: 		http://fileformats.archiveteam.org/wiki/DeskMate_Draw
631#		http://en.wikipedia.org/wiki/Deskmate
632# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/d/dm-fig.trid.xml
633# From:		Joerg Jenderek
634# Note:		called "DeskMate Draw drawing" by TrID
6350	string		\x14FIG		DeskMate Drawing
636#!:mime	application/octet-stream
637!:mime	image/x-deskmate-fig
638!:ext	fig
639# TODO:
640#	"Cabri 3D Figure"	by TrID fig-cabri.trid.xml
641#	"Playmation Figure"	by TrID fig-playmation.trid.xml
642
643# PHIGS
6440	string		ARF_BEGARF		PHIGS clear text archive
6450	string		@(#)SunPHIGS		SunPHIGS
646# version number follows, in the form m.n
647>40	string		SunBin			binary
648>32	string		archive			archive
649
650# GKS (Graphics Kernel System)
6510	string		GKSM		GKS Metafile
652>24	string		SunGKS		\b, SunGKS
653
654# CGM image files
6550	string		BEGMF		clear text Computer Graphics Metafile
656
657# MGR bitmaps  (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
6580	string	yz	MGR bitmap, modern format, 8-bit aligned
6590	string	zz	MGR bitmap, old format, 1-bit deep, 16-bit aligned
6600	string	xz	MGR bitmap, old format, 1-bit deep, 32-bit aligned
6610	string	yx	MGR bitmap, modern format, squeezed
662
663# Fuzzy Bitmap (FBM) images
6640	string		%bitmap\0	FBM image data
665>30	long		0x31		\b, mono
666>30	long		0x33		\b, color
667
668# facsimile data
6691	string		PC\ Research,\ Inc	group 3 fax data
670>29	ubyte		0		\b, normal resolution (204x98 DPI)
671>29	ubyte		1		\b, fine resolution (204x196 DPI)
672# From: Herbert Rosmanith <herp@wildsau.idv.uni.linz.at>
6730	string		Sfff		structured fax file
674
675# From: Joerg Jenderek <joerg.jen.der.ek@gmx.net>
676# URL:	http://fileformats.archiveteam.org/wiki/Award_BIOS_logo
677# Note:	verified by XnView command `nconvert -fullinfo *.EPA`
6780	string		\x11\x06	Award BIOS Logo, 136 x 84
679!:mime	image/x-award-bioslogo
680!:ext	epa
6810	string		\x11\x09	Award BIOS Logo, 136 x 126
682!:mime	image/x-award-bioslogo
683!:ext	epa
684# https://telparia.com/fileFormatSamples/image/epa/IO.EPA
685# Note:	by bitmap-awbm-v1x1009.trid.xml called "Award BIOS logo bitmap (128x126) (v1)"
686#	verified by RECOIL `recoil2png -o tmp.png IO.EPA; file tmp.png`
6870	string		\x10\x09	Award BIOS Logo, 128 x 126
688!:mime	image/x-award-bioslogo
689!:ext	epa
690#0	string		\x07\x1f	BIOS Logo corrupted?
691# http://www.blackfiveservices.co.uk/awbmtools.shtml
692# http://biosgfx.narod.ru/v3/
693# http://biosgfx.narod.ru/abr-2/
6940	string		AWBM
695# Note:    by bitmap-awbm.trid.xml called "Award BIOS logo bitmap (v2)"
696>4	uleshort	<1981		Award BIOS Logo, version 2
697#>4	uleshort	<1981		Award BIOS bitmap
698!:mime	image/x-award-bioslogo2
699#!:mime	image/x-award-bmp
700!:ext	epa/bmp
701# image width is a multiple of 4
702>>4	uleshort&0x0003	0
703>>>4	uleshort	x		\b, %d
704>>>6	uleshort	x		x %d
705>>4	uleshort&0x0003	>0		\b,
706>>>4	uleshort&0x0003	=1
707>>>>4	uleshort	x		%d+3
708>>>4	uleshort&0x0003	=2
709>>>>4	uleshort	x		%d+2
710>>>4	uleshort&0x0003	=3
711>>>>4	uleshort	x		%d+1
712>>>6	uleshort	x		x %d
713# at offset 8 starts imagedata followed by "RGB " marker
714
715# PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
716# https://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.\
717# 28bitmap_information_header.29
718# Note:	variant starting direct with DIB header see
719#	http://fileformats.archiveteam.org/wiki/BMP
720#	verified by ImageMagick version 6.8.9-8 command `identify *.dib`
7210	uleshort		40
722# skip bad samples like GAME by looking for valid number of color planes
723>12	uleshort	1		Device independent bitmap graphic
724!:mime	image/x-ms-bmp
725!:apple	????BMPp
726!:ext	dib
727>>4	ulelong		x		\b, %d x
728>>8	ulelong		x		%d x
729>>14	uleshort	x		%d
730# number of color planes (must be 1)
731#>>12	uleshort	>1		\b, %u color planes
732# compression method: 0~no 1~RLE 8-bit/pixel 3~Huffman 1D
733#>>16	ulelong		3		\b, Huffman 1D compression
734>>16	ulelong		>0		\b, %u compression
735# image size is the size of raw bitmap; a dummy 0 can be given for BI_RGB bitmaps
736>>20	ulelong		x		\b, image size %u
737# horizontal and vertical resolution of the image (pixel per metre, signed integer)
738>>24	ulelong		>0		\b, resolution %d x
739>>>28	ulelong		x		%d px/m
740# number of colors in palette, or 0 to default to 2**n
741#>>32	ulelong		>0		\b, %u colors
742# number of important colors used, or 0 when every color is important
743>>36	ulelong		>0		\b, %u important colors
744# From:		Joerg Jenderek
745# URL:		http://fileformats.archiveteam.org/wiki/VBM_(VDC_BitMap)
746# Reference:	http://csbruce.com/cbm/postings/csc19950906-1.txt
747#		http://mark0.net/download/triddefs_xml.7z
748#		defs/b/bitmap-vbm.trid.xml
749#		defs/b/bitmap-vbm-v3.trid.xml
750# Note:		called "VDC BitMap" by TrID
751#		verified by RECOIL `recoil2png -o tmp.png coke_can.vbm; file tmp.png`
752# begin with a signature of 'B' 'M' 0xCB, followed by a version byte 2 or 3
753# Similar to the unrelated Windows BMP format
754#	check for VDC bitmap and then display image dimension and version
7550	name		bitmap-vbm
756>2	ubyte		0xCB		VDC bitmap
757!:mime	image/x-commodore-vbm
758# http://recoil.sourceforge.net/formats.html
759!:ext	bm/vbm
760# the VBM format version number: 2 or 3
761>>3	ubyte		x		\b, version %u
762# width of the image in Hi/Lo format
763>>4	ubeshort	x		\b, %u
764# height of the image
765>>6	ubeshort	x		x %u
766# version 3 images have the following additional header information
767>>3	ubyte		=3
768# data-encoding type: 0~uncompressed 1~RLE-compressed
769>>>8	ubyte		0		\b, uncompressed
770>>>8	ubyte		1		\b, RLE-compressed
771# byte code for general RLE repetitions
772#>>>9	ubyte		x		\b, RLE repetition code 0x%x
773# reserved := 0
774#>>>14	short		>0		\b, reserved 0x%x
775# length of comment text; 0~no comment text
776#>>>16	ubeshort	>0		\b, comment length %u
777>>>16	pstring/H	>0		\b, comment "%s"
778#
7790	string		BM
780# check for magic and version 2 of VDC bitmap or BMP with cbSize=715=CB02
781>2	ubeshort		0xCB02
782>>6	short		=0
783>>>0	use     	bitmap-bmp
784# VDC bitmap height or maybe a few OS/2 BMP with nonzero "hotspot coordinates"
785>>6	short		!0
786>>>0	use     	bitmap-vbm
787# check for magic and version 3 of VDC bitmap or BMP with cbSize=971=CB03
788>2	ubeshort		0xCB03
789# check for reserved value (=0) of VDC bitmap
790>>14	short		=0
791>>>0	use     	bitmap-vbm
792# BMP with cbSize=????03CBh and dib header size != 0
793>>14	short		!0
794>>>0	use     	bitmap-bmp
795# cbSize is size of header or file size of Windows BMP bitmap
796>2	default		x
797>>0	use     	bitmap-bmp
7980	name		bitmap-bmp
799>14	ulelong		12		PC bitmap, OS/2 1.x format
800!:mime	image/bmp
801!:ext	bmp
802>>18	uleshort	x		\b, %d x
803>>20	uleshort	x		%d
804# number of color planes (must be 1)
805#>>22	uleshort	!1		\b, %u color planes
806# number of bits per pixel (color depth); found 4 8
807>>24	uleshort	x		x %d
808# x, y coordinates of the hotspot
809>>6	uleshort	>0		\b, hotspot %ux
810>>>8	uleshort	x		\b%u
811# cbSize; size of file or header like 1Ah 228C8h
812>>2	ulelong		x		\b, cbSize %u
813#>>2	ulelong		x		\b, cbSize 0x%8.8x
814# offBits; offset to bitmap data like:
815>>10	ulelong		x	\b, bits offset %u
816# http://fileformats.archiveteam.org/wiki/BMP#OS.2F2_BMP_2.0 no examples found
817>14	ulelong		48		PC bitmap, OS/2 2.x format (DIB header size=48)
818>14	ulelong		24		PC bitmap, OS/2 2.x format (DIB header size=24)
819# http://entropymine.com/jason/bmpsuite/bmpsuite/q/pal8os2v2-16.bmp
820# Note:    by bitmap-bmp-v2o.trid.xml called "Windows Bitmap (v2o)"
821>14	ulelong		16		PC bitmap, OS/2 2.x format (DIB header size=16)
822!:mime	image/bmp
823!:apple	????BMPp
824!:ext	bmp
825# image width and height fields are unsigned integers for OS/2
826>>18	ulelong		x		\b, %u x
827>>22	ulelong		x		%u
828# number of bits per pixel (color depth); found 8
829>>28	uleshort	>1		x %u
830# x, y coordinates of the hotspot
831>>6	uleshort	>0		\b, hotspot %ux
832>>>8	uleshort	x		\b%u
833# number of color planes (must be 1)
834#>>26	uleshort	>1		\b, %u color planes
835# cbSize; size of file like: 241E
836>>2	ulelong		x		\b, cbSize %u
837#>>2	ulelong		x		\b, cbSize 0x%x
838# offBits; offset to bitmap data like: 41E
839>>10	ulelong		x	\b, bits offset %u
840#>>10	ulelong		x	\b, bits offset 0x%x
841>14	ulelong		64		PC bitmap, OS/2 2.x format
842!:mime	image/bmp
843!:apple	????BMPp
844!:ext	bmp
845# image width and height fields are unsigned integers for OS/2
846>>18	ulelong		x		\b, %u x
847>>22	ulelong		x		%u
848# number of bits per pixel (color depth); found 1 4 8
849>>28	uleshort	>1		x %u
850# x, y coordinates of the hotspot
851>>6	uleshort	>0		\b, hotspot %ux
852>>>8	uleshort	x		\b%u
853>>26	uleshort	>1		\b, %u color planes
854# cbSize; size of file or headers
855>>2	ulelong		x		\b, cbSize %u
856# BMP with cbSize 000002CBh=715 or 000003CBh=971 maybe misinterpreted as VDC bitmap
857#>>2	ulelong		x		\b, cbSize %#x
858# offBits; offset to bitmap data like 56h 5Eh 8Eh 43Eh
859>>10	ulelong		x	\b, bits offset %u
860#>>10	ulelong		x	\b, bits offset %#x
861#>>(10.l) ubequad	!0	\b, bits %#16.16llx
862# BITMAPV2INFOHEADER	adds RGB bit masks
863>14	ulelong		52		PC bitmap, Adobe Photoshop
864!:mime	image/bmp
865!:apple	????BMPp
866!:ext	bmp
867>>18	ulelong		x		\b, %d x
868>>22	ulelong		x		%d x
869# number of bits per pixel (color depth); found 16 32
870>>28	uleshort	x		%d
871# x, y coordinates of the hotspot; should be zero for Windows variant
872>>6	uleshort	>0		\b, hotspot %ux
873>>>8	uleshort	x		\b%u
874# cbSize; size of file like: 14A 7F42
875>>2	ulelong		x		\b, cbSize %u
876#>>2	ulelong		x		\b, cbSize 0x%x
877# offBits; offset to bitmap data like: 42h
878>>10	ulelong		x	\b, bits offset %u
879#>>10	ulelong		x	\b, bits offset 0x%x
880# BITMAPV3INFOHEADER	adds alpha channel bit mask
881>14	ulelong		56		PC bitmap, Adobe Photoshop with alpha channel mask
882!:mime	image/bmp
883!:apple	????BMPp
884!:ext	bmp
885>>18	ulelong		x		\b, %d x
886>>22	ulelong		x		%d x
887# number of bits per pixel (color depth); found 16 32
888>>28	uleshort		x		%d
889# x, y coordinates of the hotspot; should be zero for Windows variant
890>>6	uleshort	>0		\b, hotspot %ux
891>>>8	uleshort	x		\b%u
892# cbSize; size of file like: 4E 7F46 131DE 14046h
893>>2	ulelong		x		\b, cbSize %u
894#>>2	ulelong		x		\b, cbSize 0x%x
895# offBits; offset to bitmap data like: 46h
896>>10	ulelong			x	\b, bits offset %u
897#>>10	ulelong			x	\b, bits offset 0x%x
898>14	ulelong		40
899# jump 4 bytes before end of file/header to skip fmt-116-signature-id-118.dib
900# broken for large bitmaps
901#>>(2.l-4)	ulong	x		PC bitmap, Windows 3.x format
902>>14	ulelong		40		PC bitmap, Windows 3.x format
903!:mime	image/bmp
904!:apple	????BMPp
905>>>18	ulelong		x		\b, %d x
906>>>22	ulelong		x		%d
907# 320 x 400		https://en.wikipedia.org/wiki/LOGO.SYS
908>>>18	ulequad		=0x0000019000000140	x
909!:ext	bmp/sys
910>>>18	ulequad		!0x0000019000000140
911# compression method 2~RLE 4-bit/pixel implies also extension rle
912>>>>30	ulelong		2		x
913!:ext	bmp/rle
914# not RLE compressed and not 320x400 dimension
915>>>>30	default		x
916# "small" dimensions like: 14x15 15x16 16x14 16x16 32x32
917#	https://en.wikipedia.org/wiki/Favicon
918>>>>>18	ulequad&0xffFFffC0ffFFffC0 =0	x
919# https://www.politi-kdigital.de/favicon.ico
920# http://forum.rpc1.org/favicon.ico
921!:ext	bmp/ico
922# "big" dimensions > 63
923>>>>>18	default		x		x
924!:ext	bmp
925# number of bits per pixel (color depth); found 1 2 4 8 16 24 32
926>>>28	uleshort	x		%d
927# x, y coordinates of the hotspot; there is no hotspot in bitmaps, so values 0
928#>>>6	uleshort	>0		\b, hotspot %ux
929#>>>>8	uleshort	x		\b%u
930# number of color planes (must be 1), except badplanes.bmp for testing
931#>>>26	uleshort	>1		\b, %u color planes
932# compression method: 0~no 1~RLE 8-bit/pixel 2~RLE 4-bit/pixel 3~Huffman 1D 6~RGBA bit field masks
933#>>>30	ulelong		3		\b, Huffman 1D compression
934>>>30	ulelong		>0		\b, %u compression
935# image size is the size of raw bitmap; a dummy 0 can be given for BI_RGB bitmaps
936>>>34	ulelong		>0		\b, image size %u
937# horizontal and vertical resolution of the image (pixel per metre, signed integer)
938>>>38	ulelong		>0		\b, resolution %d x
939>>>>42	ulelong		x		%d px/m
940# number of colors in palette 16 256, or 0 to default to 2**n
941#>>>46	ulelong		>0		\b, %u colors
942# number of important colors used, or 0 when every color is important
943>>>50	ulelong		>0		\b, %u important colors
944# cbSize; often size of file
945>>>2	ulelong		x		\b, cbSize %u
946#>>>2	ulelong		x		\b, cbSize %#x
947# offBits; offset to bitmap data like 36h 76h BEh 236h 406h 436h 4E6h
948>>>10	ulelong		x	\b, bits offset %u
949#>>>10	ulelong		x	\b, bits offset %#x
950#>>>(10.l) ubequad	!0	\b, bits %#16.16llxd
951>14	ulelong		124		PC bitmap, Windows 98/2000 and newer format
952!:mime	image/bmp
953!:ext	bmp
954>>18	ulelong		x		\b, %d x
955>>22	ulelong		x		%d x
956# color planes; must be 1
957#>>>26	uleshort	>1		\b, %u color planes
958# 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)
959>>28	uleshort	x		%d
960# x, y coordinates of the hotspot; should be zero for Windows variant
961>>6	uleshort	>0		\b, hotspot %ux
962>>>8	uleshort	x		\b%u
963# cbSize; size of file like: 8E AA 48A 999 247A 4F02 7F8A 3F88E B216E 1D4C8A 100008A
964>>2	ulelong		x		\b, cbSize %u
965#>>2	ulelong		x		\b, cbSize 0x%x
966# offBits; offset to bitmap data like: 8A 47A ABABABAB (fmt-119-signature-id-121.bmp)
967>>10	ulelong		x	\b, bits offset %u
968#>>10	ulelong		x	\b, bits offset 0x%x
969>14	ulelong		108		PC bitmap, Windows 95/NT4 and newer format
970!:mime	image/bmp
971!:ext	bmp
972>>18	ulelong		x		\b, %d x
973>>22	ulelong		x		%d x
974# number of bits per pixel (color depth); found 8 24 32
975>>28	uleshort	x		%d
976# x, y coordinates of the hotspot; should be zero for Windows variant
977>>6	uleshort	>0		\b, hotspot %ux
978>>>8	uleshort	x		\b%u
979# cbSize; size of file like: 82 8A 9A 9F86 1E07A 3007A 88B7A C007A
980>>2	ulelong		x		\b, cbSize %u
981#>>2	ulelong		x		\b, cbSize 0x%x
982# offBits; offset to bitmap data like: 7A 7E 46A
983>>10	ulelong		x	\b, bits offset %u
984#>>10	ulelong		x	\b, bits offset 0x%x
985# Update:	Joerg Jenderek
986# URL:		http://fileformats.archiveteam.org/wiki/OS/2_Icon
987# Reference:	http://www.fileformat.info
988#		/format/os2bmp/spec/902d5c253f2a43ada39c2b81034f27fd/view.htm
989# Note: verified by command like `deark -l -d3 OS2MEMU.ICO`
9900	string		IC
991# skip Lotus smart icon *.smi by looking for valid hotspot coordinates
992>6	ulelong&0xFF00FF00	=0	OS/2 icon
993# jump 4 bytes before end of header/file and test for accessibility
994#>>(2.l-4) ubelong	x	End of header is OK!
995!:mime	image/x-os2-ico
996!:ext	ico
997# cbSize; size of header or file in bytes like 1ah 120h 420h
998>>2	ulelong		x	\b, cbSize %u
999# xHotspot, yHotspot; coordinates of the hotspot for icons like 16 32
1000>>6	uleshort	x	\b, hotspot %ux
1001>>8	uleshort	x	\b%u
1002# offBits; offset in bytes to the beginning of the bit-map pel data like 20h
1003>>10	ulelong		x	\b, bits offset %u
1004#>>(10.l) ubequad	x	\b, bits %#16.16llx
1005#0	string		PI		PC pointer image data
1006#0	string		CI		PC color icon data
10070	string		CI
1008# test also for valid dib header sizes 12 or 64
1009>14	ulelong		<65		OS/2
1010# test also for valid hotspot coordinates
1011#>>6	ulelong&0xFE00FE00	=0	OS/2
1012!:mime	image/x-os2-ico
1013!:ext	ico
1014>>14	ulelong		12		1.x color icon
1015# image width and height fields are unsigned integers for OS/2
1016>>>18	uleshort	x		%u x
1017# stored height = 2 * real height
1018>>>20	uleshort/2	x		%u
1019# number of bits per pixel (color depth). Typical 32 24 16 8 4 but only 1 found
1020>>>24	uleshort	>1		x %u
1021# color planes; must be 1
1022#>>>22	uleshort	>1		\b, %u color planes
1023>>14	ulelong		64		2.x color icon
1024# image width and height
1025>>>18	ulelong		x		%u x
1026# stored height = 2 * real height
1027>>>22	ulelong/2	x		%u
1028# number of bits per pixel (color depth). only 1 found
1029>>>28	uleshort	>1		x %u
1030#>>>26	uleshort	>1		\b, %u color planes
1031# compression method: 0~no 3~Huffman 1D
1032>>>30	ulelong		3		\b, Huffman 1D compression
1033#>>>30	ulelong		>0		\b, %u compression
1034# xHotspot, yHotspot; coordinates of the hotspot like 0 1 16 20 32 33 63 64
1035>>6	uleshort	x	\b, hotspot %ux
1036>>8	uleshort	x	\b%u
1037# cbSize; size of header or maybe file in bytes like 1Ah 4Eh 84Eh
1038>>2	ulelong		x	\b, cbSize %u
1039#>>2	ulelong		x	\b, cbSize %x
1040# offBits; offset to bitmap data (pixel array) like E4h 3Ah 66h 6Ah 33Ah 4A4h
1041>>10	ulelong		x	\b, bits offset %u
1042#>>10	ulelong		x	\b, bits offset %#x
1043#>>(10.l) ubequad	!0	\b, bits %#16.16llx
1044# dib header size: 12~Ch~OS/2 1.x 64~40h~OS/2 2.x
1045#>>14	ulelong		x		\b, dib header size %u
1046#0	string		CP		PC color pointer image data
1047# URL:		http://fileformats.archiveteam.org/wiki/OS/2_Pointer
1048# Reference:	http://www.fileformat.info/format/os2bmp/egff.htm
10490	string		CP
1050# skip many Corel Photo-Paint image "CPT9FILE" by checking for positive bits offset
1051>10	ulelong		>0
1052# skip CPU-Z Report by checking for valid dib header sizes 12 or 64
1053>>14	ulelong		=12
1054>>>0		use		os2-ptr
1055>>14	ulelong		=64
1056>>>0		use		os2-ptr
1057#	display information of OS/2 pointer bitmaps
10580	name		os2-ptr
1059>14	ulelong		x		OS/2
1060# http://extension.nirsoft.net/PTR
1061!:mime	image/x-ibm-pointer
1062!:ext	ptr
1063>>14	ulelong		12		1.x color pointer
1064# image width and height fields are unsigned integers for OS/2
1065>>>18	uleshort	x		%u x
1066# stored height = 2 * real height
1067>>>20	uleshort/2	x		%u
1068# number of bits per pixel (color depth). Typical 32 24 16 8 4 but only 1 found
1069>>>24	uleshort	>1		x %u
1070# color planes; must be 1
1071#>>>22	uleshort	>1		\b, %u color planes
1072>>14	ulelong		64		2.x color pointer
1073# image width and height
1074>>>18	ulelong		x		%u x
1075# stored height = 2 * real height
1076>>>22	ulelong/2	x		%u
1077# number of bits per pixel (color depth). only 1 found
1078>>>28	uleshort	>1		x %u
1079#>>>26	uleshort	>1		\b, %u color planes
1080# compression method: 0~no 3~Huffman 1D
1081>>>30	ulelong		3		\b, Huffman 1D compression
1082#>>>30	ulelong		>0		\b, %u compression
1083# xHotspot, yHotspot; coordinates of the hotspot like 0 3 4 8 15 16 23 27 31
1084>>6	uleshort	x	\b, hotspot %ux
1085>>8	uleshort	x	\b%u
1086# cbSize; size of header or maybe file in bytes like 1Ah 4Eh
1087>>2	ulelong		x	\b, cbSize %u
1088#>>2	ulelong		x	\b, cbSize %x
1089# offBits; offset to bitmap data (pixel array) like 6Ah A4h E4h 4A4h
1090>>10	ulelong		x	\b, bits offset %u
1091#>>10	ulelong		x	\b, bits offset %#x
1092#>>(10.l) ubequad	!0	\b, bits %#16.16llx
1093# dib header size: 12~Ch~OS/2 1.x 64~40h~OS/2 2.x
1094#>>14	ulelong		x		\b, dib header size %u
1095# Conflicts with other entries [BABYL]
1096# URL:	http://fileformats.archiveteam.org/wiki/BMP#OS.2F2_Bitmap_Array
1097# Note:	container for OS/2 icon "IC", color icon "CI", color pointer "CP" or bitmap "BM"
1098#0	string		BA		PC bitmap array data
10990	string		BA
1100# skip old Emacs RMAIL BABYL ./mail.news by checking for low header size
1101>2	ulelong		<0x004c5942	OS/2 graphic array
1102!:mime	image/x-os2-graphics
1103#!:apple	????BMPf
1104# cbSize; size of header like 28h 5Ch
1105>>2	ulelong		x	\b, cbSize %u
1106#>>2	ulelong		x	\b, cbSize %#x
1107# offNext; offset to data like 0 48h F2h 4Eh 64h C6h D2h D6h DAh E6h EAh 348h
1108>>6	ulelong		>0	\b, data offset %u
1109#>>6	ulelong		>0	\b, data offset %#x
1110#>>(6.l) ubequad	!0	\b, data %#16.16llx
1111# dimensions of the intended device like 640 x 480 for VGA or 1024 x 768
1112>>10	uleshort	>0		\b, display %u
1113>>>12	uleshort	>0		x %u
1114# usType of first array element
1115#>>14	string		x		\b, usType %2.2s
1116# 1 space char after "1st"
1117# no *.bga examples found https://www.openwith.org/file-extensions/bga/1342
1118>>14	string		BM	\b; 1st
1119!:ext	bmp/bga
1120>>14	string		CI	\b; 1st
1121!:ext	ico
1122>>14	string		CP	\b; 1st
1123!:ext	ico
1124>>14	string		IC	\b; 1st
1125!:ext	ico
1126# no white-black pointer found
1127#>>14	string		PT	\b; 1st
1128#!:ext
1129>>14	indirect	x
1130
1131# XPM icons (Greg Roelofs, newt@uchicago.edu)
1132# Update:	Joerg Jenderek
1133# URL:		http://fileformats.archiveteam.org/wiki/XPM
1134# Reference:	http://www.x.org/docs/XPM/xpm.pdf
1135#		http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-xpm.trid.xml
1136# Note:		called "X PixMap bitmap" by TrID and "X-Windows Pixmap Image" by DROID via PUID x-fmt/208
1137# starting with c comment like: logo.xpm
11380	string			/*\040
1139# 9 byte c-comment "/* XPM */" not at the beginning like: mozicon16.xpm mozicon50.xpm (thunderbird)
1140>0	search/0xCE		/*\ XPM\ */
1141# skip DROID x-fmt-208-signature-id-620.xpm by looking for char aray without explict length
1142# and match mh-logo.xpm (emacs)
1143>>&0		search/1249	[]
1144>>>0		use		xpm-image
1145# non standard because no 9 byte c-comment "/* XPM */" like: logo.xpm in qemu package
1146>0	default			x
1147# words are separated by a white space which can be composed of space and tabulation characters
1148>>0		search/0x52	static\040char\040
1149# skip debug.c testmlc.c by looking for char aray without explict length
1150# https://www.clamav.net/downloads/production/clamav-0.104.2.tar.gz
1151# clamav-0.104.2\libclammspack\mspack\debug.c
1152>>>&0		search/64	[]
1153>>>>0		use		xpm-image
1154#	display X pixmap image information
11550	name			xpm-image
1156>0	string		x	X pixmap image text
1157#!:mime	text/plain
1158# https://reposcope.com/mimetype/image/x-xpixmap
1159# alias
1160#!:mime	image/x-xpm
1161!:mime	image/x-xpixmap
1162!:ext	xpm
1163# NO pm example found!
1164#!:ext	xpm/pm
1165# look for start of character array at beginning of a line like: psetupl.xpm (OpenOffice 4.1.7)
1166>0	search/0x406	\n"
1167# DEBUG VALUES string
1168#>>&0	string		x		'%s'
1169# width with optional white space before like: 16 24 32 48 1280
1170>>&0	regex/8		[0-9]{1,5}	\b, %s
1171# height with white space like: 15 16 17 24 32 48 1024
1172>>>&0	regex/8		[0-9]{1,5}	x %s
1173# number of colors with white space like: 1 2 3 4 5 8 11 14 162 255 but unrelistic 4294967295 by hardcopy tool
1174>>>>&0	regex/12	[0-9]{1,9}	x %s
1175# chars_per_pixel with white space like: 1 2
1176>>>>>&0	regex/14	[0-9]{1,2}	\b, %s chars/pixel
1177# non standard because not starting with 9 byte c-comment "/* XPM */"
1178>0	string		!/*\ XPM\ */
1179>>0	string		x	\b, 1st line "%s"
1180
1181# Utah Raster Toolkit RLE images (janl@ifi.uio.no)
11820	uleshort	0xcc52		RLE image data,
1183>6	uleshort	x		%d x
1184>8	uleshort	x		%d
1185>2	uleshort	>0		\b, lower left corner: %d
1186>4	uleshort	>0		\b, lower right corner: %d
1187>10	ubyte&0x1	=0x1		\b, clear first
1188>10	ubyte&0x2	=0x2		\b, no background
1189>10	ubyte&0x4	=0x4		\b, alpha channel
1190>10	ubyte&0x8	=0x8		\b, comment
1191>11	ubyte		>0		\b, %d color channels
1192>12	ubyte		>0		\b, %d bits per pixel
1193>13	ubyte		>0		\b, %d color map channels
1194
1195# image file format (Robert Potter, potter@cs.rochester.edu)
11960	string		Imagefile\ version-	iff image data
1197# this adds the whole header (inc. version number), informative but longish
1198>10	string		>\0		%s
1199
1200# Sun raster images, from Daniel Quinlan (quinlan@yggdrasil.com)
12010	ubelong		0x59a66a95	Sun raster image data
1202>4	ubelong		>0		\b, %d x
1203>8	ubelong		>0		%d,
1204>12	ubelong		>0		%d-bit,
1205#>16	ubelong		>0		%d bytes long,
1206>20	ubelong		0		old format,
1207#>20	ubelong		1		standard,
1208>20	ubelong		2		compressed,
1209>20	ubelong		3		RGB,
1210>20	ubelong		4		TIFF,
1211>20	ubelong		5		IFF,
1212>20	ubelong		0xffff		reserved for testing,
1213>24	ubelong		0		no colormap
1214>24	ubelong		1		RGB colormap
1215>24	ubelong		2		raw colormap
1216#>28	ubelong		>0		colormap is %d bytes long
1217
1218# SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
1219#
1220# See
1221#	http://reality.sgi.com/grafica/sgiimage.html
1222#
12230	ubeshort		474		SGI image data
1224#>2	ubyte		0		\b, verbatim
1225>2	ubyte		1		\b, RLE
1226#>3	ubyte		1		\b, normal precision
1227>3	ubyte		2		\b, high precision
1228>4	ubeshort	x		\b, %d-D
1229>6	ubeshort	x		\b, %d x
1230>8	ubeshort	x		%d
1231>10	ubeshort	x		\b, %d channel
1232>10	ubeshort	!1		\bs
1233>80	string		>0		\b, "%s"
1234
12350	string		IT01		FIT image data
1236>4	ubelong		x		\b, %d x
1237>8	ubelong		x		%d x
1238>12	ubelong		x		%d
1239#
12400	string		IT02		FIT image data
1241>4	ubelong		x		\b, %d x
1242>8	ubelong		x		%d x
1243>12	ubelong		x		%d
1244#
12452048	string		PCD_IPI		Kodak Photo CD image pack file
1246>0xe02	ubyte&0x03	0x00		, landscape mode
1247>0xe02	ubyte&0x03	0x01		, portrait mode
1248>0xe02	ubyte&0x03	0x02		, landscape mode
1249>0xe02	ubyte&0x03	0x03		, portrait mode
12500	string		PCD_OPA		Kodak Photo CD overview pack file
1251
1252# FITS format.  Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
1253# FITS is the Flexible Image Transport System, the de facto standard for
1254# data and image transfer, storage, etc., for the astronomical community.
1255# (FITS floating point formats are big-endian.)
12560	string	SIMPLE\ \ =	FITS image data
1257!:mime	image/fits
1258!:ext	fits/fts
1259>109	string	8		\b, 8-bit, character or unsigned binary integer
1260>108	string	16		\b, 16-bit, two's complement binary integer
1261>107	string	\ 32		\b, 32-bit, two's complement binary integer
1262>107	string	-32		\b, 32-bit, floating point, single precision
1263>107	string	-64		\b, 64-bit, floating point, double precision
1264
1265# other images
12660	string	This\ is\ a\ BitMap\ file	Lisp Machine bit-array-file
1267
1268# From SunOS 5.5.1 "/etc/magic" - appeared right before Sun raster image
1269# stuff.
1270#
12710	ubeshort		0x1010		PEX Binary Archive
1272
1273# DICOM medical imaging data
1274# URL:		https://en.wikipedia.org/wiki/DICOM#Data_format
1275# Note:		"dcm" is the official file name extension
1276# 		XnView mention also "dc3" and "acr" as file name extension
1277128	string	DICM			DICOM medical imaging data
1278!:mime	application/dicom
1279!:ext dcm/dicom/dic
1280
1281# XWD - X Window Dump file.
1282# URL:		http://fileformats.archiveteam.org/wiki/XWD
1283# Reference:	https://wiki.multimedia.cx/index.php?title=XWD
1284#		http://mark0.net/download/triddefs_xml.7z/defs/x/xdm-x11.trid.xml
1285# Note:		called "X-Windows Screen Dump (X11)" by TrID and
1286#		"X-Windows Screen Dump" version X11 by DROID via PUID fmt/483
1287#		verfied by XnView `nconvert -in xwd -info *`
1288#		and ImageMagick 6.9.11 `identify -verbose *` as XWD X Windows system window dump
1289#		and `xwud -in fig41.wxd -dumpheader`
1290#   As described in /usr/X11R6/include/X11/XWDFile.h
1291#   used by the xwd program.
1292#   Bradford Castalia, idaeim, 1/01
1293#   updated by Adam Buchbinder, 2/09 and Joerg Jenderek, May 2022
1294# The following assumes version 7 of the format; the first long is the length
1295# of the header, which is at least 25 4-byte longs, and the one at offset 8
1296# is a constant which is always either 1 or 2. Offset 12 is the pixmap depth,
1297# which is a maximum of 32.
1298# Size of the entire file header (bytes) like: 100 104 105 106 107 109 110 113 114 115 118 172
12990	ubelong	>99
1300# pixmap_format; Pixmap format; 0~1-bit (XYBitmap) format 1~single-plane (XYPixmap) 2~bitmap with two or more planes (ZPixmap)
1301>8	ubelong	<3
1302# pixmap_depth; Pixmap depth; value 1 - 32
1303>>12	ubelong	<33
1304# file_version; XWD_FILE_VERSION=7
1305>>>4	ubelong	7
1306# skip DROID fmt-401-signature-id-618.xwd by test for existing border field
1307>>>>96	ubelong	x			X-Window screen dump image data, version X11
1308# ./images (version 1.205) labeled the above entry as "XWD X Window Dump image data"
1309# https://reposcope.com/mimetype/image/x-xwindowdump
1310!:mime	image/x-xwindowdump
1311#!:ext	xwd
1312!:ext	xwd/dmp
1313# https://www.xnview.com/en/image_formats/ NO example with x11 suffix FOUND!
1314#!:ext	xwd/dmp/x11
1315# https://www.nationalarchives.gov.uk/PRONOM/fmt/401 NO example with xdm suffix FOUND!
1316#!:ext	xwd/dmp/x11/xmd
1317# file comment if header > 100; so not in MARBLES.XWD and hardcopy-x-window-v11.xwd
1318>>>>>0	ubelong	>100
1319# comment or windows name
1320>>>>>>100 string	>\0			\b, "%s"
1321# pixmap_width;	pixmap width like: 576 800 1014 1280 1419 NOT -1414812757=abABabABh
1322>>>>>16	ubelong	x			\b, %dx
1323# pixmap_height; pixmap height like: 449 454 600 704 720 1001 1024 NOT -1414812757=abABabABh
1324>>>>>20	ubelong	x			\b%dx
1325# pixmap_depth;	pixmap depth
1326>>>>>12	ubelong	x			\b%d
1327# XOffset; Bitmap X offset; pixel numbers to ignore at the beginning of each scan-line
1328#>>>>>24	ubelong	x			\b, %u ignore
1329# ByteOrder; byte order of image data: 0~least significant byte first 1~most significant byte first
1330>>>>>28	ubelong	>0			\b, order %u
1331# BitmapUnit; bitmap base data size unit in each scan line like: 8 16 32
1332#>>>>>32	ubelong	x			\b, unit %u
1333# BitmapBitOrder; bit-order of image data; apparently same as ByteOrder
1334#>>>>>36	ubelong	x			\b, bit order %u
1335# BitmapPad; number of padding bits added to each scan line like: 8 16 32
1336#>>>>>40	ubelong	x			\b, pad %u
1337# BitsPerPixel; Bits per pixel: 1~StaticGray and GrayScale 2-15~StaticColor and PseudoColor 16,24,32~TrueColor and DirectColor
1338#>>>>>44	ubelong	x			\b, %u bits/pixel
1339# BytesPerLine; size of each scan line in bytes
1340#>>>>>48	ubelong	x			\b, %u bytes/line
1341# VisualClass; class of the image: 0~StaticGray 1~GrayScale 2~StaticColor 3~PseudoColor 4~TrueColor 5~DirectColor
1342#>>>>>52	ubelong	x			\b, %u Class
1343# RedMask; red RGB mask values used by ZPixmaps like: 0 0xff0000
1344#>>>>>56	ubelong	!0			\b, %#x red
1345# GreenMask; green mask like: 0
1346#>>>>>60	ubelong	!0			\b, %#x green
1347# BlueMask; blue mask like: 0 0xff
1348#>>>>>64	ubelong	!0			\b, %#x blue
1349# BitsPerRgb; Size of each color mask in bits like: 0 1 8 24
1350#>>>>>68	ubelong	x			\b, %u bits/RGB
1351# NumberOfColors; number of colors in image like: 256 4 2 0 (WHAT DOES THIS MEAN?)
1352>>>>>72	ubelong	x			\b, %u colors
1353# ColorMapEntries; number of entries in color map like: 256 16 2 0~no color map
1354>>>>>76	ubelong	x			%u entries
1355# WindowWidth; window width
1356#>>>>>80	ubelong	x			\b, %u width
1357# WindowHeight; window height
1358#>>>>>84	ubelong	x			\b, %u height
1359# WindowX; Window upper left X coordinate like: 0 24 32 80 237 290 422 466 568 (lenna.dmp)
1360>>>>>88	ubelong	!0			\b, x=%d
1361# WindowY; Window upper left Y coordinate like: 0 8 18 26 60 73 107 (fig41.xwd) 128
1362>>>>>92	ubelong	!0			\b, y=%d
1363# WindowBorderWidth; Window border width; apparently pixmap_width=WindowWidth+2*WindowBorderWidth
1364# like: 1 (fig41.xwd) 2 (maze.dmp) 3 (lenna.dmp mandrill.dmp)
1365>>>>>96	ubelong	>0			\b, %u border
1366# From:		Joerg Jenderek
1367# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/x/xdm-x10.trid.xml
1368# Note:		called "X-Windows Screen Dump (X10)" by TrID and
1369#		"X-Windows Screen Dump" version X10 by DROID via PUID x-fmt/300
1370#		verfied by XnView `nconvert -in xwd -info *`
1371# HeaderSize is the size of the header in bytes; always 40 for X10 variant
13720	ubelong		=0x000000028
1373# FileVersion; always 6 for X10 variant
1374>4	ubelong		=6
1375# skip DROID x-fmt-300-signature-id-619.xdm by test existing border field
1376>>36	ubeshort	x		X-Window screen dump image data, version X10
1377!:mime	image/x-xwindowdump
1378!:ext	xwd
1379# http://www.nationalarchives.gov.uk/pronom/fmt/401 NO example with xdm suffix FOUND!
1380#!:ext	xwd/xdm
1381# PixmapWidth; pixmap width like: 127 1280
1382>>>20	ubelong		x		\b, %d
1383# PixmapHeight; pixmap height like: 64 1024
1384>>>24	ubelong		x		\bx%d
1385# DisplayPlanes; number of display planes like: 1 4 8
1386>>>12	ubelong		x		\bx%u
1387# DisplayType; display type like: 1 3
1388#>>>8	ubelong		x		\b, type %u
1389# PixmapFormat; pixmap format like: 1~bitmap with two or more planes (ZPixmap) 0~single-plane bitmap (XYBitmap)
1390#>>>16	ubelong	x			\b, %u format
1391# WindowWidth; window width; probably PixmapWidth=WindowWidth+2*WindowBorderWidth
1392#>>>28	ubeshort	x		\b, width %u
1393# WindowHeight;  window height; probably PixmapWidth=PixmapHeight+2*WindowBorderWidth
1394#>>>30	ubeshort	x		\b, height %u
1395# WindowX; window upper left X coordinate like: 0
1396>>>32	ubeshort		!0	\b, x=%d
1397# WindowY; window upper left Y coordinate like: 0
1398>>>34	ubeshort		!0	\b, y=%d
1399# WindowBorderWidth; window border width like: 0
1400>>>36	ubeshort	!0		\b, %u border
1401# WindowNumColors; Number of color entries in window like: 2 16 256
1402#>>>38	ubeshort	x		\b, %u colors
1403# if the image is a PseudoColor image, a color map immediately follows the header. X10COLORMAP[WindowNumColors];
1404# EntryNumber; number of the color-map entry like: 0
1405#>>>40	ubeshort	x		\b, colors #%u
1406# Red; red-channel value
1407#>>>42	ubeshort	!0		\b, red %#x
1408# Green; green-channel value
1409#>>>44	ubeshort	!0		\b, green %#x
1410# Blue; blue-channel value
1411#>>>46	ubeshort	!0		\b, blue %#x
1412# 2ND Entry like: 2
1413#>>>48	ubeshort	x		\b, colors #%u
1414
1415# PDS - Planetary Data System
1416#   These files use Parameter Value Language in the header section.
1417#   Unfortunately, there is no certain magic, but the following
1418#   strings have been found to be most likely.
14190	string	NJPL1I00		PDS (JPL) image data
14202	string	NJPL1I			PDS (JPL) image data
14210	string	CCSD3ZF			PDS (CCSD) image data
14222	string	CCSD3Z			PDS (CCSD) image data
14230	string	PDS_			PDS image data
14240	string	LBLSIZE=		PDS (VICAR) image data
1425
1426# pM8x: ATARI STAD compressed bitmap format
1427#
1428# from Oskar Schirmer <schirmer@scara.com> Feb 2, 2001
1429# p M 8 5/6 xx yy zz data...
1430# Atari ST STAD bitmap is always 640x400, bytewise runlength compressed.
1431# bytes either run horizontally (pM85) or vertically (pM86). yy is the
1432# most frequent byte, xx and zz are runlength escape codes, where xx is
1433# used for runs of yy.
1434#
14350	string	pM85		Atari ST STAD bitmap image data (hor)
1436>5	ubyte	0x00		(white background)
1437>5	ubyte	0xFF		(black background)
14380	string	pM86		Atari ST STAD bitmap image data (vert)
1439>5	ubyte	0x00		(white background)
1440>5	ubyte	0xFF		(black background)
1441
1442# From: Alex Myczko <alex@aiei.ch>
1443# https://www.atarimax.com/jindroush.atari.org/afmtatr.html
14440	uleshort	0x0296		Atari ATR image
1445
1446# URL:		http://fileformats.archiveteam.org/wiki/DEGAS_image
1447# Reference:	https://wiki.multimedia.cx/index.php?title=Degas
1448# From:		Joerg Jenderek
1449#		http://mark0.net/download/triddefs_xml.7z/defs/b
1450#		bitmap-pi2-degas.trid.xml bitmap-pi3-degas.trid.xml
1451#		bitmap-pc1-degas.trid.xml bitmap-pc2-degas.trid.xml bitmap-pc3-degas.trid.xml
1452# Note:		verified by NetPBM `pi3topbm sigirl1.pi3 | file`
1453# 		`deark -m degas -l -d2 ataribak.pi1`
1454#		XnView `nconvert -fullinfo *.p??`
1455# DEGAS low-res uncompressed bitmap *.pi1
14560		beshort		0x0000
1457# skip some ISO 9660 CD-ROM filesystems like plpbt.iso by test for 4 non black colors in palette entries
1458>2		quad		!0
1459# skip g3test.g3 by test for unused bits of 2nd color entry
1460>>4		ubeshort&0xF000	0
1461#>>>0		beshort	x	1ST_VALUE=%x
1462#>>>-0		offset	x	FILE_SIZE=%lld
1463# standard DEGAS low-res uncompressed bitmap *.pi1 with file size 32034
1464>>>-0		offset	=32034
1465#>>>>0		beshort	x	1st_VALUE=%x
1466# like: 8ball.pi1 teddy.pi1 sonic01.pi1
1467>>>>0		use		degas-bitmap
1468# about 61 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 32066
1469>>>-0		offset	=32066
1470# like: spider.pi1 pinkgirl.pi1 frog3.pi1
1471>>>>0		use		degas-bitmap
1472# about 55 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 32128
1473>>>-0		offset	=32128
1474# like: mountain.pi1 bigspid.pi1 alf33.pi1
1475>>>>0		use		degas-bitmap
1476# 1 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 44834
1477>>>-0		offset	=44834
1478# like: kenshin.pi1
1479>>>>0		use		degas-bitmap
1480# DEGAS mid-res uncompressed bitmap *.pi2 (strength=50) after GEM Images like:
1481# BEETHVEN.IMG CHURCH.IMG GAMEOVR4.IMG TURKEY.IMG clinton.img
14820		beshort		0x0001
1483#!:strength +0
1484# skip many control files like gnucash-4.8.setup.exe.aria2 by test for non black in 4 palette entries
1485>2		quad		!0
1486# skip control file load-v0001.aria2 by test for unused bits of 5th color palette entry
1487>>10		ubeshort&0xF000	0
1488# skip many GEM Image data like DANCER.IMG GAMEOVR4.IMG SHIP.IMG by test for unused bits of 8th color palette entry
1489>>>16		ubeshort&0xF000	0
1490# skip many GEM Image data like BEETHVEN.IMG CABINETS.IMG MEMO.IMG by test for unused bits of 14th color palette entry
1491>>>>28		ubeshort&0xF000	0
1492# skip few GEM Image data like CHURCH.IMG by test for unused bits of 15th color palette entry
1493>>>>>30		ubeshort&0xF000	0
1494# skip many GEM Image data like TIGER.IMG TURKEY.IMG XMAS.IMG by test for unused bits of 16th color palette entry
1495>>>>>>32	ubeshort&0xF000	0
1496# skip GEM Image data like clinton.img by test for existing bytes at the end
1497>>>>>>>32026	quad		x
1498>>>>>>>>0	use		degas-bitmap
1499# DEGAS high-res uncompressed bitmap *.pi3
15000	beshort		0x0002
1501# skip Intel ia64 COFF msvcrt.lib by test for unused bits of 1st atari color palette entry
1502>2		ubeshort&0xF000	0
1503# skip few Adobe PhotoShop Brushes like Faux-Spitzen.abr by check
1504# for invalid Adobe PhotoShop Brush UTF16-LE string length
1505>>19		ubyte			=0
1506# many like: 4th_ofj2.pi3 GEMINI03.PI3 PEOPLE18.PI3 POWERFIX.PI3 abydos.pi3 highres.pi3 sigirl1.pi3 vanna5.pi3
1507>>>0		use		degas-bitmap
1508# Adobe PhotoShop Brush UTF16-LE string length 15 "Gitter - klein " 8 "Kreis 1 "
1509>>19		ubyte			!0
1510#>>19		ubyte			!0	\b, NOTE LENGTH %u
1511#>>>21		lestring16		x	\b, BRUSH NOTE "%s"
1512>>>(19.b*2)	ubequad			x
1513# maybe last character of Adobe PhotoShop Brush UTF16-LE string and terminating nul char like
1514# 006e0000 for n in "Faux-Spitzen.abr" 00310000 for 1 in "Verschiedene Spitzen.abr"
1515# 00000000 "LEREDACT.PI3" 03730773 "TBX_DEMO.PI3"
1516#>>>>&8		ubelong			x	\b, LAST CHAR+NIL %8.8x
1517>>>>&8		ubelong&0xff00ffFF	!0
1518# skip many Adobe Photoshop Color swatch (ANPA-Farben.aco TOYO-Farbsystem.aco) with invalid 3rd color entry (1319 2201 2206 21f5 2480 24db 25fd)
1519>>>>>6		ubeshort&0xF000	0
1520# skip few Adobe Photoshop Color swatch (FOCOLTONE-Farben.aco "PANTONE process coated.aco") with invalid 4th color entry  (ffff)
1521>>>>>>8		ubeshort&0xF000	0
1522# many DEGAS bitmap like: ARABDEMO.PI3 ELMRSESN.PI3 GEMVIEW.PI3 LEREDACT.PI3 PICCOLO.PI3 REPRO_JR.PI3 ST_TOOLS.PI3 TBX_DEMO.PI3 evgem7.pi3
1523>>>>>>>0	use		degas-bitmap
1524# test for last character of Adobe PhotoShop Brush UTF16-LE string and terminating nul char
1525>>>>&8		ubelong&0xff00ffFF	=0
1526# select last DEGAS bitmaps by invalid last char of brush note like BASICNES.PI3 DB_HELP.PI3 DB_WRITR.PI3 LEREDACT.PI3
1527>>>>>&-4	ubelong&0x00FF0000	<0x00200000
1528>>>>>>0		use		degas-bitmap
1529# last character of Adobe PhotoShop Brush UTF16-LE note
1530#>>>>>&-4	ubelong&0x00FF0000	>0x001F0000	\b, THAT IS ABR
1531# DEGAS low-res compressed bitmap *.pc1 like: BATTLSHP.PC1 GNUCHESS.PC1 MEDUSABL.PC1 MOONLORD.PC1 WILDROSE.PC1
15320		beshort			0x8000
1533# skip lif files handled via ./lif by test for unused bits of 1st palette entry
1534>2		ubeshort&0xF000		0
1535>>0		use		degas-bitmap
1536# DEGAS mid-res compressed bitmap *.pc2 like: abydos.pc2 ARTIS3.PC2 SMTHDRAW.PC2 STAR_2K.PC2 TX2_DEMO.PC2
15370		beshort			0x8001
1538>0		use		degas-bitmap
1539# DEGAS high-res compressed bitmap *.pc3 like: abydos.pc3 COYOTE.PC3 ELEPHANT.PC3 TX2_DEMO.PC3 SMTHDRAW.PC3
15400		beshort			0x8002
1541>0		use		degas-bitmap
1542# display information of Atari DEGAS and DEGAS Elite bitmap images
15430	name		degas-bitmap
1544>0	ubyte		x		Atari DEGAS
1545#!:mime	application/octet-stream
1546!:mime	image/x-atari-degas
1547# compressed
1548>0	ubyte		=0x80		Elite compressed
1549# uncompressed
1550#>0	ubyte		=0x00		uncompressed
1551#>0	ubyte		=0x00		un.
1552>0	ubyte		=0x00
1553# check for existence of footer for DEGAS Elite images
1554>>32042	ubequad		x		Elite
1555>0	beshort		0x0000		bitmap
1556!:ext	pi1
1557>0	beshort		0x0001		bitmap
1558!:ext	pi2
1559>0	beshort		0x0002		bitmap
1560# no example with SUH extension found
1561#!:ext	pi3/suh
1562!:ext	pi3
1563>0	beshort		0x8000		bitmap
1564!:ext	pc1
1565>0	beshort		0x8001		bitmap
1566!:ext	pc2
1567>0	beshort		0x8002		bitmap
1568!:ext	pc3
1569# low resolution; 320x200, 16 colors
1570>1	ubyte		=0		320 x 200 x 16
1571# medium resolution; 640x200, 4 colors
1572>1	ubyte		=1		640 x 200 x 4
1573# high resolution; 640x400, 2 colors
1574>1	ubyte		=2		640 x 400 x 2
1575# http://fileformats.archiveteam.org/wiki/Atari_ST_color_palette
1576# hardware_palette[16]; 9 bit ?????RRR?GGG?BBB; 12 bit ????RRRRGGGGBBBB for Atari STE
1577# for Atari DEGAS apparently no Spectrum 512 Enhanced 15 bit palette RGB?RRRRGGGGBBBB
1578# Red Green Blue unused bit ? often 0 but not bilboule.pi1; color_value (examples or numbers)
1579# 1st color palette entry like: 0777 (61) 0fff (LEREDACT.PI3) 0fcf (devgem7.pi3) 0001 (9)
1580>2	ubeshort	x		\b, color palette %4.4x
1581# 2nd palette entry like: 0000 (32) 0700 (38) 0f00 (LEREDACT.PI3 devgem7.pi3)
1582>4	ubeshort	x		%4.4x
1583# 3rd palette entry
1584>6	ubeshort	x		%4.4x
1585# 4th palette entry like: 0000 (72)
1586>8	ubeshort	x		%4.4x
1587# 5th palette entry
1588>10	ubeshort	x		%4.4x
1589>2	ubeshort	x		...
1590# 6th palette entry
1591#>12	ubeshort	x		%4.4x
1592# 7th palette entry like: 0000 (16) 0001 (ELMRSESN.PI3 elmrsesn.pi3) 0070 (51) 00f0 (BASICNES.PI3 LEREDACT.PI3) 00f8 (devgem7.pi3)
1593#>14	ubeshort	x		%4.4x
1594# 8th palette entry
1595#>16	ubeshort	x		%4.4x
1596# 9 palette entry
1597#>18	ubeshort	x		%4.4x
1598# 10 palette entry
1599#>20	ubeshort	x		%4.4x
1600# 11 palette entry
1601#>22	ubeshort	x		%4.4x
1602# 12 palette entry
1603#>24	ubeshort	x		%4.4x
1604# 13 palette entry
1605#>26	ubeshort	x		%4.4x
1606# 14th palette entry
1607#>28	ubeshort	x		%4.4x
1608# 15th palette entry
1609#>30	ubeshort	x		%4.4x
1610# 16th palette entry
1611#>32	ubeshort	x		%4.4x
1612# data[16000] for uncompressed images; pixel data
1613#>34	ubequad		x		\b, DATA %#16.16llx...
1614# footer for Elite variant images
1615# https://www.fileformat.info/format/atari/egff.htm
1616# https://pulkomandy.tk/projects/GrafX2/wiki/Develop/FileFormats/Atari
1617# left_color_animation[4]; like: 0000000000000000 0000000100020003 fffafff000000030 (bigspid.pi1)
1618#>32034  ubequad		!0		\b, color animations %16.16llx (left)
1619# right_color_animation[4]; like: 0000000000000000 0000000100020003
1620#>>32042  ubequad	!0		%16.16llx (right)
1621# channel_direction[4]; 0~left 1~none 2~right like: 0001000100010001 0002000000010001 (cycle2.pi1)
1622# sometimes unexpected like: feaafc0000000000 (bigspid.pi1)
1623#>32050  ubequad		!0		\b, channel directions %16.16llx
1624# channel_delay[4]; 128 - channel delay, timebase 1/60 s
1625#>32058  ubequad		!0		\b, channel delays %16.16llx
1626
1627# From:		Joerg Jenderek
1628# URL:		http://fileformats.archiveteam.org/wiki/ImageLab/PrintTechnic
1629# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-b_w.trid.xml
1630# Note:		called "ImageLab bitmap" by TrID
1631#		verfied by XnView `nconvert -fullinfo "MAEDCHEN.B&W"`
16320	string		B&W256	ImageLab bitmap
1633!:mime	image/x-ilab
1634#	https://www.xnview.com/de/image_formats/
1635# GRR: add char & inside parse_ext in ../../src/apprentice.c to avoid in file version 5.40 error like:
1636# Magdir\images, 1090: Warning: EXTENSION type `        b_w/b&w' has bad char '&'
1637!:ext	b_w/b&w
1638# Width
1639>6	ubeshort	x	\b, %u
1640# Height
1641>8	ubeshort	x	x %u
1642
1643# XXX:
1644# This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
1645# magic.
1646# SGI RICE image file <mpruett@sgi.com>
1647#0	ubeshort	0x5249		RICE image
1648#>2	ubeshort	x		v%d
1649#>4	ubeshort	x		(%d x
1650#>6	ubeshort	x		%d)
1651#>8	ubeshort	0		8 bit
1652#>8	ubeshort	1		10 bit
1653#>8	ubeshort	2		12 bit
1654#>8	ubeshort	3		13 bit
1655#>10	ubeshort	0		4:2:2
1656#>10	ubeshort	1		4:2:2:4
1657#>10	ubeshort	2		4:4:4
1658#>10	ubeshort	3		4:4:4:4
1659#>12	ubeshort	1		RGB
1660#>12	ubeshort	2		CCIR601
1661#>12	ubeshort	3		RP175
1662#>12	ubeshort	4		YUV
1663
1664# PCX image files
1665# From: Dan Fandrich <dan@coneharvesters.com>
1666# updated by Joerg Jenderek at Feb 2013 by https://de.wikipedia.org/wiki/PCX
1667# https://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
1668# GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
1669# 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
16700	ubelong&0xffF8fe00	0x0a000000
1671# for PCX bit depth > 0
1672>3	ubyte		>0
1673# test for valid versions
1674>>1	ubyte		<6
1675>>>1	ubyte		!1	PCX
1676!:mime	image/x-pcx
1677#!:mime	image/pcx
1678>>>>1	ubyte		0	ver. 2.5 image data
1679>>>>1	ubyte		2	ver. 2.8 image data, with palette
1680>>>>1	ubyte		3	ver. 2.8 image data, without palette
1681>>>>1	ubyte		4	for Windows image data
1682>>>>1	ubyte		5	ver. 3.0 image data
1683>>>>4	uleshort	x	bounding box [%d,
1684>>>>6	uleshort	x	%d] -
1685>>>>8	uleshort	x	[%d,
1686>>>>10	uleshort	x	%d],
1687>>>>65	ubyte		>1	%d planes each of
1688>>>>3	ubyte		x	%d-bit
1689>>>>68	ubyte		1	colour,
1690>>>>68	ubyte		2	grayscale,
1691# this should not happen
1692>>>>68	default		x	image,
1693>>>>12	uleshort	>0	%d x
1694>>>>>14	uleshort	x	%d dpi,
1695>>>>2	ubyte		0	uncompressed
1696>>>>2	ubyte		1	RLE compressed
1697
1698# Adobe Photoshop
1699# From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
1700# URL: 		http://fileformats.archiveteam.org/wiki/PSD
1701# Reference:	https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
1702# Note:		verfied by XnView `nconvert -fullinfo *.psd *.psb *.pdd`
1703#		and ImageMagick `identify -verbose *.pdd`
17040	string		8BPS
1705# skip DROID x-fmt-92-signature-id-277.psd by checking valid width
1706>18	ubelong		>0	Adobe Photoshop
1707!:mime	image/vnd.adobe.photoshop
1708!:apple	????8BPS
1709# version: always equal to 1, but 2 for PSB
1710>>4   beshort 1
1711# URL: 		http://fileformats.archiveteam.org/wiki/PhotoDeluxe
1712# EXTRAS/PHOTOS/DEMOPIX/ORIGINAL.PDD
1713>>>34	search/0xC0d7	PHUT	Image (PhotoDeluxe)
1714!:ext	pdd
1715>>>34	default		x	Image
1716!:ext	psd
1717# URL: 		http://fileformats.archiveteam.org/wiki/PSB
1718>>4   beshort 2 Image (PSB)
1719!:ext	psb
1720# width in pixels: 1-30000 1-300000 for PSB
1721>>18  belong  x \b, %d x
1722>>14  belong  x %d,
1723# The color mode; 0~Bitmap 1~Grayscale 2~Indexed 3~RGB 4~CMYK 7~Multichannel 9~Duotone 9~Lab
1724>>24  beshort 0 bitmap
1725>>24  beshort 1 grayscale
1726# the number of channels; range is 1 to 56
1727>>>12 beshort 2 with alpha
1728>>24  beshort 2 indexed
1729>>24  beshort 3 RGB
1730>>>12 beshort 4 \bA
1731>>24  beshort 4 CMYK
1732>>>12 beshort 5 \bA
1733>>24  beshort 7 multichannel
1734>>24  beshort 8 duotone
1735>>24  beshort 9 lab
1736>>12  beshort > 1
1737>>>12 beshort x \b, %dx
1738>>12  beshort 1 \b,
1739>>22  beshort x %d-bit channel
1740>>12  beshort > 1 \bs
1741# 6 reserved bytes; must be zero, but spaces inside ImageMagick input.psd
1742# https://download.imagemagick.org/ImageMagick/download/ImageMagick-7.0.11-11.zip
1743# ImageMagick-7.0.11-11\PerlMagick\t\input.psd
1744>>6   bequad&0xFFffFFffFFff0000 !0 \b, at offset 6
1745>>>6  belong  x	 0x%8.8x
1746>>>6  beshort x   \b%4.4x
1747
1748# From:		Joerg Jenderek
1749# URL:		https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
1750#		http://fileformats.archiveteam.org/wiki/Photoshop
1751# Reference:	http://www.nomodes.com/aco.html
1752# Note:		registers as Photoshop.SwatchesFile for Photoshop.exe on Windows
1753# check for valid versions like: 2 (newest) 1 (old) 0 (oldest no examples)
17540		ubeshort				<3
1755# skip few Atari DEGAS med-res bitmap (DIAGRAM1.PI2) and many ISO 9660 CD-ROM by check for invalid low color numbers (0)
1756>2		ubeshort				>0
1757# skip few Targa (bmpsuite-15col.tga rgb24_top_left_colormap.tga) by check for invalid high color space ID (F0 1D)
1758>>4		ubeshort				<16
1759# skip many (69/327) Targa image *.TGA by check of accessing near the ending of first color space section (size=nc*5*2)
1760>>>(2.S*10)	ubelong					x
1761# RGB branch for Adobe Photoshop Color swatch
1762>>>>4		ubeshort				=0
1763# skip many (220/327) Targa by check of for invalid high RGB color z value (hexadecimal 2 3 2e03 4600 5e04 7502 8002 8b05 c700)
1764>>>>>12			ubeshort			=0
1765# RGB branch for Adobe Photoshop Color swatch for older versions
1766>>>>>>0				ubeshort		<2
1767>>>>>>>0				use		adobe-aco
1768# RGB branch for Adobe Photoshop Color swatch for newer version 2
1769>>>>>>0				ubeshort		=2
1770# skip many (74/176) Atari DEGAS hi-res bitmap (*.PI3) by check for invalid low color name length (0)
1771>>>>>>>16				ubeshort	>0
1772>>>>>>>>0					use	adobe-aco
1773# non RGB branch for Adobe Photoshop Color swatch
1774>>>>4		ubeshort				!0
1775# non RGB branch for Adobe Photoshop Color swatch for older versions
1776>>>>>0			ubeshort			<2
1777# skip many GEM Image (CHURCH.IMG TIGER.IMG) by check for invalid second high color space ID (55 114 143 157 256 288 450)
1778>>>>>>14			ubeshort		<16
1779>>>>>>>0				use		adobe-aco
1780# non RGB branch for Adobe Photoshop Color swatch for newer version 2
1781>>>>>0			ubeshort			=2
1782# skip few Atari DEGAS hi-res bitmap (pal1wb-blue.pi3) and few ABR by check for invalid "high" nil bytes (7) before color name length
1783>>>>>>14			ubeshort		=0
1784>>>>>>>0				use		adobe-aco
1785#	display Adobe Photoshop Color swatch file information (version, number of colors, color spaces, coordinates, names)
17860	name		adobe-aco
1787>0		ubeshort				x		Adobe Photoshop Color swatch, version %u
1788#!:mime		application/octet-stream
1789!:mime		application/x-adobe-aco
1790!:apple		????8BCO
1791!:ext		aco
1792>0		ubeshort				<2
1793>>(2.S*10)	ubelong					x
1794# version 2 section after version 1 section
1795>>>&0		ubeshort				2		and 2
1796# nc; number of colors like: 20 50 86 88 126 204 300 1050 1137 1280 2092 3010 4096
1797>2		ubeshort				x		\b, %u colors
1798# maybe last 4 bytes of first section (probably y z color value) like: 0 0x66660000 0xfe700000 0xffff0000
1799#>(2.S*10)	ubelong					x		1ST_SECTION_END=%#8.8x
1800>0		ubeshort				<2		\b; 1st
1801# first older Adobe Photoshop Color entry
1802>>4			use				aco-color
1803>>>2				ubeshort		>1		\b; 2nd
1804# second older Adobe Photoshop Color entry
1805>>>>14					use		aco-color
1806>0		ubeshort				=2		\b; 1st
1807# first new Adobe Photoshop Color entry
1808>>4			use				aco-color-v2
1809>>>2				ubeshort		>1		\b; 2nd
1810# jump first color name length words
1811>>>>(16.S*2)				ubequad		x
1812# second new Adobe Photoshop Color entry
1813>>>>>&10					use	aco-color-v2
1814#	display Adobe Photoshop Color entry (color space, color coordinates)
18150	name		aco-color
1816# each color spec entry occupies five words
1817# color space: 0~RGB 1~HSB 2~CMYK 3~Pantone 4~Focoltone 5~Trumatch 6~Toyo 7~Lab 8~Grayscale 9?~wideCMYK 10~HKS ...
1818#>0		ubeshort				x		COLOR_ENTRY
1819>0		ubeshort				0		RGB
1820>0		ubeshort				1		HSB
1821>0		ubeshort				2		CMYK
1822>0		ubeshort				3		Pantone
1823>0		ubeshort				4		Focoltone
1824>0		ubeshort				5		Trumatch
1825>0		ubeshort				6		Toyo
1826>0		ubeshort				7		Lab
1827>0		ubeshort				8		Grayscale
1828>0		ubeshort				9		wide CMYK
1829>0		ubeshort				10		HKS
1830# unofficial
1831# >0		ubeshort				12		foo
1832# >0		ubeshort				13		bar
1833# >0		ubeshort				14		FOO
1834# >0		ubeshort				15		BAR
1835>0		ubeshort				x		space (%u)
1836# color coordinate w
1837>2		ubeshort				x		\b, w %#x
1838# color coordinate x
1839>4		ubeshort				x		\b, x %#x
1840# color coordinate y
1841>6		ubeshort				x		\b, y %#x
1842# color coordinate z; zero for RGB space
1843>8		ubeshort				x		\b, z %#x
1844#	display Adobe Photoshop Color entry version 2 (color space, color coordinates names)
18450	name		aco-color-v2
1846>0		use					aco-color
1847#>10		ubeshort				x		\b, NUL_BYTES %#x
1848# color name lenght plus one (len+1) like: 7 8 9 13 14 15 16 17 22 26
1849#>>12		ubeshort			 	x		\b, LENGTH %u
1850>>12		ubeshort-1				x		\b, %u chars
1851# len words; UTF-16 representation of the color name like: "DIC 1s" "PANTONE Process Yellow PC"
1852>>14		bestring16				x		"%s"
1853# followed by nil word
1854
1855# XV thumbnail indicator (ThMO)
1856# URL:		https://en.wikipedia.org/wiki/Xv_(software)
1857# Reference:	http://fileformats.archiveteam.org/wiki/XV_thumbnail
1858# Update:	Joerg Jenderek
18590	string		P7\ 332		XV thumbnail image data
1860#0	string		P7\ 332		XV "thumbnail file" (icon) data
1861!:mime	image/x-xv-thumbnail
1862# thumbnail .xvpic/foo.bar for graphic foo.bar
1863!:ext	p7/gif/tif/xpm/jpg
1864
1865# NITF is defined by United States MIL-STD-2500A
18660	string	NITF	National Imagery Transmission Format
1867>25	string	>\0	dated %.14s
1868
1869# GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
1870# Format variations from: Bernd Nuernberger <bernd.nuernberger@web.de>
1871# Update: Joerg Jenderek
1872# See http://fileformats.archiveteam.org/wiki/GEM_Raster
1873# For variations, also see:
1874#    https://www.seasip.info/Gem/ff_img.html (Ventura)
1875#    http://www.atari-wiki.com/?title=IMG_file (XIMG, STTT)
1876#    http://www.fileformat.info/format/gemraster/spec/index.htm (XIMG, STTT)
1877#    http://sylvana.net/1stguide/1STGUIDE.ENG (TIMG)
18780       beshort     0x0001
1879# header_size
1880>2      beshort     0x0008
1881>>0     use gem_info
1882>2      beshort     0x0009
1883>>0     use gem_info
1884# no example for NOSIG
1885>2      beshort     24
1886>>0     use gem_info
1887# no example for HYPERPAINT
1888>2      beshort     25
1889>>0     use gem_info
189016      string      XIMG\0
1891>0      use gem_info
1892# no example
189316      string      STTT\0\x10
1894>0      use gem_info
1895# no example or description
189616      string      TIMG\0
1897>0      use gem_info
1898
18990   name        gem_info
1900# version is 2 for some XIMG and 1 for all others
1901>0	ubeshort		<0x0003		GEM
1902# https://www.snowstone.org.uk/riscos/mimeman/mimemap.txt
1903!:mime	image/x-gem
1904# header_size 24 25 27 59 779 words for colored bitmaps
1905>>2	ubeshort	>9
1906>>>16	string		STTT\0\x10	STTT
1907>>>16	string		TIMG\0		TIMG
1908# HYPERPAINT or NOSIG variant
1909>>>16	string		\0\x80
1910>>>>2	ubeshort	=24		NOSIG
1911>>>>2	ubeshort	!24		HYPERPAINT
1912# NOSIG or XIMG variant
1913>>>16	default		x
1914>>>>16	string		!XIMG\0		NOSIG
1915>>16	string		=XIMG\0		XIMG Image data
1916!:ext	img/ximg
1917# to avoid Warning: Current entry does not yet have a description for adding a EXTENSION type
1918>>16	string		!XIMG\0		Image data
1919!:ext	img
1920# header_size is 9 for Ventura files and 8 for other GEM Paint files
1921>>2	ubeshort	9		(Ventura)
1922#>>2	ubeshort	8		(Paint)
1923>>12	ubeshort	x		%d x
1924>>14	ubeshort	x		%d,
1925# 1 4 8
1926>>4	ubeshort	x		%d planes,
1927# in tenths of a millimetre
1928>>8	ubeshort	x		%d x
1929>>10	ubeshort	x		%d pixelsize
1930# pattern_size 1-8. 2 for GEM Paint
1931>>6	ubeshort	!2		\b, pattern size %d
1932
1933# GEM Metafile (Wolfram Kleff)
19340	ulelong		0x0018FFFF	GEM Metafile data
1935>4	uleshort	x		version %d
1936
1937#
1938# SMJPEG. A custom Motion JPEG format used by Loki Entertainment
1939# Software Torbjorn Andersson <d91tan@Update.UU.SE>.
1940#
19410	string	\0\nSMJPEG	SMJPEG
1942>8	ubelong	x		%d.x data
1943# According to the specification you could find any number of _TXT
1944# headers here, but I can't think of any way of handling that. None of
1945# the SMJPEG files I tried it on used this feature. Even if such a
1946# file is encountered the output should still be reasonable.
1947>16	string		_SND		\b,
1948>>24	ubeshort	>0		%d Hz
1949>>26	ubyte		8		8-bit
1950>>26	ubyte		16		16-bit
1951>>28	string		NONE		uncompressed
1952# >>28	string		APCM		ADPCM compressed
1953>>27	ubyte		1		mono
1954>>28	ubyte		2		stereo
1955# Help! Isn't there any way to avoid writing this part twice?
1956# Yes, use a name/use
1957>>32	string		_VID		\b,
1958# >>>48	string		JFIF		JPEG
1959>>>40	ubelong		>0		%d frames
1960>>>44	ubeshort	>0		(%d x
1961>>>46	ubeshort	>0		%d)
1962>16	string		_VID		\b,
1963# >>32	string		JFIF		JPEG
1964>>24	ubelong		>0		%d frames
1965>>28	ubeshort	>0		(%d x
1966>>30	ubeshort	>0		%d)
1967
19680	string	Paint\ Shop\ Pro\ Image\ File	Paint Shop Pro Image File
1969
1970# taken from fkiss: (<yav@mte.biglobe.ne.jp> ?)
19710	string		KiSS		KISS/GS
1972>4	ubyte		16		color
1973>>5	ubyte		x		%d bit
1974>>8	uleshort	x		%d colors
1975>>10	uleshort	x		%d groups
1976>4	ubyte		32		cell
1977>>5	ubyte		x		%d bit
1978>>8	uleshort	x		%d x
1979>>10	uleshort	x		%d
1980>>12	uleshort	x		+%d
1981>>14	uleshort	x		+%d
1982
1983# Webshots (www.webshots.com), by John Harrison
19840       string          C\253\221g\230\0\0\0 Webshots Desktop .wbz file
1985
1986# Hercules DASD image files
1987# From Jan Jaeger <jj@septa.nl> and Jay Maynard <jaymaynard@gmail.com>
19880       string  CKD_P370        Hercules CKD DASD image file
1989>8      lelong  x               \b, %d heads per cylinder
1990>12     lelong  x               \b, track size %d bytes
1991>16     byte    x               \b, device type 33%2.2X
1992
19930       string  CKD_C370        Hercules compressed CKD DASD image file
1994>8      lelong  x               \b, %d heads per cylinder
1995>12     lelong  x               \b, track size %d bytes
1996>16     byte    x               \b, device type 33%2.2X
1997>552    lelong  x               \b, %d total cylinders
1998>>557   byte    0               \b, no compression
1999>>557   byte    1               \b, ZLIB compression
2000>>557   byte    2               \b, BZ2 compression
2001
20020       string  CKD_S370        Hercules CKD DASD shadow file
2003>8      lelong  x               \b, %d heads per cylinder
2004>12     lelong  x               \b, track size %d bytes
2005>16     byte    x               \b, device type 33%2.2X
2006
20070       string  CKD_P064        Hercules CKD64 DASD image file
2008>8      lelong  x               \b, %d heads per cylinder
2009>12     lelong  x               \b, track size %d bytes
2010>16     byte    x               \b, device type 33%2.2X
2011
20120       string  CKD_C064        Hercules compressed CKD64 DASD image file
2013>8      lelong  x               \b, %d heads per cylinder
2014>12     lelong  x               \b, track size %d bytes
2015>16     byte    x               \b, device type 33%2.2X
2016>524    lelong  x               \b, %d total cylinders
2017>>585   byte    0               \b, no compression
2018>>585   byte    1               \b, ZLIB compression
2019>>585   byte    2               \b, BZ2 compression
2020
20210       string  CKD_S064        Hercules CKD64 DASD shadow file
2022>8      lelong  x               \b, %d heads per cylinder
2023>12     lelong  x               \b, track size %d bytes
2024>16     byte    x               \b, device type 33%2.2X
2025
2026# Squeak images and programs - etoffi@softhome.net
20270	string		\146\031\0\0	Squeak image data
20280	search/1	'From\040Squeak	Squeak program text
2029
2030# partimage: file(1) magic for PartImage files (experimental, incomplete)
2031# Author: Hans-Joachim Baader <hjb@pro-linux.de>
20320		string	PaRtImAgE-VoLuMe	PartImage
2033>0x0020		string	0.6.1		file version %s
2034>>0x0060	ulelong	>-1		volume %d
2035#>>0x0064 8 byte identifier
2036#>>0x007c reserved
2037>>0x0200	string	>\0		type %s
2038>>0x1400	string	>\0		device %s,
2039>>0x1600	string	>\0		original filename %s,
2040# Some fields omitted
2041>>0x2744	ulelong	0		not compressed
2042>>0x2744	ulelong	1		gzip compressed
2043>>0x2744	ulelong	2		bzip2 compressed
2044>>0x2744	ulelong	>2		compressed with unknown algorithm
2045>0x0020		string	>0.6.1		file version %s
2046>0x0020		string	<0.6.1		file version %s
2047
2048# DCX is multi-page PCX, using a simple header of up to 1024
2049# offsets for the respective PCX components.
2050# From: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
2051# Update:	Joerg Jenderek
2052# URL:		http://fileformats.archiveteam.org/wiki/DCX
20530	ulelong	987654321	DCX multi-page
2054# http://www.nationalarchives.gov.uk/pronom/x-fmt/348
2055!:mime	image/x-dcx
2056!:ext	dcx
2057# The first file offset usually starts at file offset 0x1004
2058# print 1 space after 0x100? offset and then handles PCX images by ./images
2059>4	ulelong	x		\b, at %#x
2060>(4.l)	indirect		x
2061# possible 2nd PCX image
2062#>8	ulelong	!0		\b, at %#x
2063#>>(8.l)	indirect		x
2064# possible 3rd PCX image
2065#>12	ulelong	!0		\b, at %#x
2066#>>(12.l)	indirect		x
2067
2068# Simon Walton <simonw@matteworld.com>
2069# Kodak Cineon format for scanned negatives
2070# http://www.kodak.com/US/en/motion/support/dlad/
20710	ulelong  0xd75f2a80	Cineon image data
2072>200	ubelong  >0		\b, %d x
2073>204	ubelong  >0		%d
2074
2075
2076# Bio-Rad .PIC is an image format used by microscope control systems
2077# and related image processing software used by biologists.
2078# From: Vebjorn Ljosa <vebjorn@ljosa.com>
2079# BOOL values are two-byte integers; use them to rule out false positives.
2080# https://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
2081# Samples: https://www.loci.wisc.edu/software/sample-data
208214	uleshort	<2
2083>62	uleshort	<2
2084>>54	uleshort	12345		Bio-Rad .PIC Image File
2085>>>0	uleshort	>0		%d x
2086>>>2	uleshort	>0		%d,
2087>>>4	uleshort	=1		1 image in file
2088>>>4	uleshort	>1		%d images in file
2089
2090# From Jan "Yenya" Kasprzak <kas@fi.muni.cz>
2091# The description of *.mrw format can be found at
2092# http://www.dalibor.cz/minolta/raw_file_format.htm
20930	string	\000MRM			Minolta Dimage camera raw image data
2094
2095# Summary: DjVu image / document
2096# Extension: .djvu
2097# Reference: http://djvu.org/docs/DjVu3Spec.djvu
2098# Submitted by: Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
2099# Modified by (1): Abel Cheung <abelcheung@gmail.com>
21000	string	AT&TFORM
2101>12	string	DJVM		DjVu multiple page document
2102!:mime	image/vnd.djvu
2103>12	string	DJVU		DjVu image or single page document
2104!:mime	image/vnd.djvu
2105>12	string	DJVI		DjVu shared document
2106!:mime	image/vnd.djvu
2107>12	string	THUM		DjVu page thumbnails
2108!:mime	image/vnd.djvu
2109
2110# Originally by Marc Espie
2111# Modified by Robert Minsk <robertminsk at yahoo.com>
2112# https://www.openexr.com/openexrfilelayout.pdf
21130	ulelong		20000630	OpenEXR image data,
2114!:mime image/x-exr
2115>4	ulelong&0x000000ff x		version %d,
2116>4	ulelong		^0x00000200	storage: scanline
2117>4	ulelong		&0x00000200	storage: tiled
2118>8	search/0x1000	compression\0	\b, compression:
2119>>&16	ubyte		0		none
2120>>&16	ubyte		1		rle
2121>>&16	ubyte		2		zips
2122>>&16	ubyte		3		zip
2123>>&16	ubyte		4		piz
2124>>&16	ubyte		5		pxr24
2125>>&16	ubyte		6		b44
2126>>&16	ubyte		7		b44a
2127>>&16	ubyte		8		dwaa
2128>>&16	ubyte		9		dwab
2129>>&16	ubyte		>9		unknown
2130>8	 search/0x1000	dataWindow\0	\b, dataWindow:
2131>>&10	ulelong		x		(%d
2132>>&14	ulelong		x		%d)-
2133>>&18	ulelong		x		\b(%d
2134>>&22	ulelong		x		%d)
2135>8	search/0x1000	displayWindow\0	\b, displayWindow:
2136>>&10	ulelong		x		(%d
2137>>&14	ulelong		x		%d)-
2138>>&18	ulelong		x		\b(%d
2139>>&22	ulelong		x		%d)
2140>8	search/0x1000	lineOrder\0	 \b, lineOrder:
2141>>&14	ubyte		0		increasing y
2142>>&14	ubyte		1		decreasing y
2143>>&14	ubyte		2		random y
2144>>&14	ubyte		>2		unknown
2145
2146# SMPTE Digital Picture Exchange Format, SMPTE DPX
2147#
2148# ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
2149# Moving-Picture Exchange (DPX), v1.0, 18 February 1994
2150# Robert Minsk <robertminsk at yahoo.com>
2151# Modified by Harry Mallon <hjmallon at gmail.com>
21520	string		SDPX	DPX image data, big-endian,
2153!:mime image/x-dpx
2154>0	use		dpx_info
21550	string		XPDS	DPX image data, little-endian,
2156!:mime image/x-dpx
2157>0	use		\^dpx_info
2158
21590	name		dpx_info
2160>768	ubeshort	<4
2161>>772	ubelong		x	%dx
2162>>776	ubelong		x	\b%d,
2163>768	ubeshort	>3
2164>>776	ubelong		x	%dx
2165>>772	ubelong		x	\b%d,
2166>768	ubeshort	0	left to right/top to bottom
2167>768	ubeshort	1	right to left/top to bottom
2168>768	ubeshort	2	left to right/bottom to top
2169>768	ubeshort	3	right to left/bottom to top
2170>768	ubeshort	4	top to bottom/left to right
2171>768	ubeshort	5	top to bottom/right to left
2172>768	ubeshort	6	bottom to top/left to right
2173>768	ubeshort	7	bottom to top/right to left
2174
2175# From: Tom Hilinski <tom.hilinski@comcast.net>
2176# Update:	Joerg Jenderek
2177# URL: 		https://en.wikipedia.org/wiki/NetCDF
2178#		http://fileformats.archiveteam.org/wiki/NetCDF
2179# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/n/netcdf.trid.xml
2180#		https://www.loc.gov/preservation/digital/formats/fdd/fdd000330.shtml
2181# Note:		called "NetCDF Network Common Data Form" by TrID and
2182#		"netCDF-3 Classic" by DROID via PUID fmt/282
2183# https://www.unidata.ucar.edu/packages/netcdf/
21840	string	CDF\001
2185# skip DROID fmt-282-signature-id-298.nc by test for more content bytes
2186>3	uleshort	>0		NetCDF Data Format data
2187#!:mime	application/netcdf
2188# https://reposcope.com/mimetype/application/x-netcdf
2189!:mime	application/x-netcdf
2190!:ext	nc
2191# https://fileinfo.com/extension/cdf
2192# https://www.file-extensions.org/cdf-file-extension-unidata-network-common-data-form
2193# in 1994 changed from CDF to NC file extension avoid a clash with other file formats
2194#!:ext	nc/cdf
2195# 64-bit offset netcdf Classic https://www.unidata.ucar.edu/software/netcdf/docs/file_format_specifications
2196# Note:		called "netCDF-3 64-bit" by DROID via PUID fmt/283
21970	string	CDF\002
2198# skip DROID fmt-283-signature-id-299.nc by test for more content bytes
2199>3	uleshort	>0		NetCDF Data Format data (64-bit offset)
2200#!:mime	application/netcdf
2201!:mime	application/x-netcdf
2202!:ext	nc
2203
2204# From: Michael Liu
2205# https://en.wikipedia.org/wiki/Common_Data_Format
22060	ubelong	0xCDF30001	Common Data Format (Version 3 or later) data
2207!:mime  application/x-cdf
2208
22090	ubelong	0xCDF26002	Common Data Format (Version 2.6 or 2.7) data
2210!:mime  application/x-cdf
2211
22120	ubelong	0x0000FFFF	Common Data Format (Version 2.5 or earlier) data
2213!:mime  application/x-cdf
2214
2215# Hierarchical Data Format, used to facilitate scientific data exchange
2216# specifications at http://hdf.ncsa.uiuc.edu/
2217# URL: 		http://fileformats.archiveteam.org/wiki/HDF
2218#		https://en.wikipedia.org/wiki/Hierarchical_Data_Format
2219# Reference:	https://portal.hdfgroup.org/download/attachments/52627880/HDF5_File_Format_Specification_Version-3.0.pdf
22200	ubelong	0x0e031301	Hierarchical Data Format (version 4) data
2221!:mime	application/x-hdf
2222!:ext	hdf/hdf4/h4
22230	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) data
2224#!:mime	application/x-hdf
2225!:mime	application/x-hdf5
2226!:ext	h5/hdf5/hdf/he5
2227512	string	\211HDF\r\n\032\n
2228# skip Matlab v5 mat-file testhdf5_7.4_GLNX86.mat handled by ./mathematica
2229>0	string	!MATLAB			Hierarchical Data Format (version 5) with 512 bytes user block
2230#!:mime	application/x-hdf
2231!:mime	application/x-hdf5
2232!:ext	h5/hdf5/hdf/he5
22331024	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 1k user block
2234#!:mime	application/x-hdf
2235!:mime	application/x-hdf5
2236!:ext	h5/hdf5/hdf/he5
22372048	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 2k user block
2238#!:mime	application/x-hdf
2239!:mime	application/x-hdf5
2240!:ext	h5/hdf5/hdf/he5
22414096	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 4k user block
2242#!:mime	application/x-hdf
2243!:mime	application/x-hdf5
2244!:ext	h5/hdf5/hdf/he5
2245
2246# From: Tobias Burnus <burnus@net-b.de>
2247# Xara (for a while: Corel Xara) is a graphic package, see
2248# http://www.xara.com/ for Windows and as GPL application for Linux
22490	string	XARA\243\243	Xara graphics file
2250
2251# From:		Joerg Jenderek
2252# URL:		http://fileformats.archiveteam.org/wiki/Corel_Gallery
2253# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bmf-corel.trid.xml
2254# Note:		called "Corel Binary Material Format" by TrID and
2255# 		"Corel Flow" by XnView
22560	string	@CorelBMF\n\rCorel\040Corporation 	Corel GALLERY Clipart
2257!:mime	image/x-corel-bmf
2258!:ext	bmf
2259
2260# https://www.cartesianinc.com/Tech/
2261# Reference:	http://fileformats.archiveteam.org/wiki/Cartesian_Perceptual_Compression
22620	string	CPC\262		Cartesian Perceptual Compression image
2263!:mime	image/x-cpi
2264!:ext	cpi/cpc
2265
2266# From Albert Cahalan <acahalan@gmail.com>
2267# puredigital used it for the CVS disposable camcorder
2268#8       lelong		4       ZBM bitmap image data
2269#>4      uleshort	x       %u x
2270#>6      uleshort	x       %u
2271
2272# From Albert Cahalan <acahalan@gmail.com>
2273# uncompressed 5:6:5 HighColor image for OLPC XO firmware icons
22740       string		C565     OLPC firmware icon image data
2275>4      uleshort	x       %u x
2276>6      uleshort	x       %u
2277
2278# Applied Images - Image files from Cytovision
2279# Gustavo Junior Alves <gjalves@gjalves.com.br>
22800	string	\xce\xda\xde\xfa	Cytovision Metaphases file
22810	string	\xed\xad\xef\xac	Cytovision Karyotype file
22820	string	\x0b\x00\x03\x00	Cytovision FISH Probe file
22830	string	\xed\xfe\xda\xbe	Cytovision FLEX file
22840	string	\xed\xab\xed\xfe	Cytovision FLEX file
22850	string	\xad\xfd\xea\xad	Cytovision RATS file
2286
2287# Wavelet Scalar Quantization format used in gray-scale fingerprint images
2288# From Tano M Fotang <mfotang@quanteq.com>
22890	string	\xff\xa0\xff\xa8\x00	Wavelet Scalar Quantization image data
2290
2291# Type:		PCO B16 image files
2292# URL:		http://www.pco.de/fileadmin/user_upload/db/download/MA_CWDCOPIE_0412b.pdf
2293# From:		Florian Philipp <florian.philipp@binarywings.net>
2294# Extension:	.b16
2295# Description:	Pixel image format produced by PCO Camware, typically used
2296#		together with PCO cameras.
2297# Note:		Different versions exist for e.g. 8 bit and 16 bit images.
2298#		Documentation is incomplete.
22990	string/b	PCO-	PCO B16 image data
2300>12	ulelong		x	\b, %dx
2301>16	ulelong		x	\b%d
2302>20	ulelong		0	\b, short header
2303>20	ulelong		-1	\b, extended header
2304>>24	ulelong		0	\b, grayscale
2305>>>36	ulelong		0	linear LUT
2306>>>36	ulelong		1	logarithmic LUT
2307>>>28	ulelong		x	[%d
2308>>>32	ulelong		x	\b,%d]
2309>>24	ulelong		1	\b, color
2310>>>64	ulelong		0	linear LUT
2311>>>64	ulelong		1	logarithmic LUT
2312>>>40	ulelong		x	r[%d
2313>>>44	ulelong		x	\b,%d]
2314>>>48	ulelong		x	g[%d
2315>>>52	ulelong		x	\b,%d]
2316>>>56	ulelong		x	b[%d
2317>>>60	ulelong		x	\b,%d]
2318
2319# Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
2320# From: Markus Heidelberg <markus.heidelberg at web.de>
23210	string/t	[BitmapInfo2]	Polar Monitor Bitmap text
2322!:mime	image/x-polar-monitor-bitmap
2323
2324# From: Rick Richardson <rickrich@gmail.com>
2325# updated by: Joerg Jenderek
2326# URL: http://techmods.net/nuvi/
23270	string	GARMIN\ BITMAP\ 01	Garmin Bitmap file
2328# extension is also used for
2329# Sony SRF raw image (image/x-sony-srf)
2330# SRF map
2331# Terragen Surface Map (https://www.planetside.co.uk/terragen)
2332# FileLocator Pro search criteria file (https://www.mythicsoft.com/filelocatorpro)
2333!:ext srf
2334#!:mime	image/x-garmin-srf
2335# version 1.00,2.00,2.10,2.40,2.50
2336>0x2f	string		>0		\b, version %4.4s
2337# width (2880,2881,3240)
2338>0x55	uleshort	>0		\b, %dx
2339# height (80,90)
2340>>0x53	uleshort	x		\b%d
2341
2342# From:		Joerg Jenderek
2343# URL:		http://fileformats.archiveteam.org/wiki/Imageiio/imaginfo_(Ulead)
2344# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pe3.trid.xml
2345# Note:		called "Ulead Imageiio/Imaginfo thumbnail" by TrID
23460	string	IIO1$			Ulead Photo Explorer 3
2347#!:mime	application/octet-stream
2348!:mime	image/x-ulead-pe3
2349# IMAGEIIO.PE3
2350!:ext	pe3
2351# look for DOS/Windows drive letter
2352>5	search/192/s	:\\
2353# directory or full name of corresponding imaginfo.pe3 like: "T:\SAMPLES\TEXTURES\SKY_SNOW\IIOE371.TMP "S:\PI3\PIMPACT3\PROGRAMS\PATTERNS\imaginfo.pe3"
2354>>&-1	string	x			"%s"
2355# look for DOS/Windows network path if no drive letter part
2356>5	default		x
2357>>5	search/192/s	\x5c\x5c
2358# full name of corresponding imaginfo.pe3 like: "\\Lionking\upi\SAMPLES\IMAGES\ANIMALS\imaginfo.pe3"
2359>>>&0	string	x			"%s"
2360# Type:	Ulead Photo Explorer5 (.pe5)
2361# URL:		http://fileformats.archiveteam.org/wiki/Imageiio/imaginfo_(Ulead)
2362# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pe4.trid.xml
2363# From:	Simon Horman <horms@debian.org>
2364# Update:	Joerg Jenderek
2365# Note:		some called "Ulead Imageiio/Imaginfo thumbnail" by TrID
2366#		and used in various Ulead applications
23670	string	IIO2H			Ulead Photo Explorer 4 or 5
2368#!:mime	application/octet-stream
2369!:mime	image/x-ulead-pe4
2370# IMAGEIIO.PE4
2371!:ext	pe4/pe5
2372# look in most samples for JPEG signature like: SAMPLES/IMAGES/SCENES/IMAGINFO.PE4
2373>0x4c2	search/0xE02/s	JFIF		with JPEG image data
2374>>&-6	use			jpeg
2375# near the end list of image names like: Img0001.pcd 1116012L.JPG NCARD4.TPL
2376#
2377# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pe3-imaginfo.trid.xml
237811	string	\001\0\0\0\0
2379# check for version 3 part
2380>19	string	\0\001\0\003\0
2381>>0	use	ulead-imaginfo
2382# From:		Joerg Jenderek
2383# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pe4-imaginfo.trid.xml
238411	string	\001\0\0\0\0
2385# check for version 4 part
2386>19	string	\0\0\0\004\0
2387>>0	use	ulead-imaginfo
2388# display information about Ulead Imaginfo thumbnail (version, directory, image extension)
23890	name	ulead-imaginfo
2390>22	ubyte	x			Ulead Imaginfo thumbnail
2391#!:mime	application/octet-stream
2392!:mime	image/x-ulead-imaginfo
2393>22	ubyte	=3			\b, version 3
2394# IMAGINFO.PE3
2395!:ext	pe3
2396>22	ubyte	=4			\b, version 4
2397# IMAGINFO.PE4
2398!:ext	pe4
2399# MAYBE ALSO VERSION 5 ?
2400#>22	ubyte	=5			\b, version 5
2401#!:ext	pe5
2402>22	ubyte	x
2403# look for DOS/Windows driver letter
2404>>4	search/192/s	:\x5c
2405# skip f:\Programme\iPhoto Plus 4\Template\Business Cards\IMAGINFO.PE4
2406# by looking for driver letter in range A-Z
2407>>>&-1	ubyte	>0x40
2408# directory path like: "E:\iPE\CDSample\Images\Scenes" "D:\XmasCard\Samples" "C:\TEMP\PLANTS"
2409>>>>&-5	pstring/l	>0		\b, "%s"
2410# look for DOS/Windows network path if no valid drive letter part
2411>>>&-1	default		x
2412>>>>4	search/192/s	\x5c\x5c
2413# directory path like: "\\FSX\SYS\OPPS\IPE.ENG\TEMPLATE\BUSINESS" "\\Lionking\upi\SAMPLES\IMAGES\ANIMALS"
2414>>>>>&-4 pstring/l	>0		\b, "%s"
2415# look for DOS/Windows network path if no drive letter part
2416>>4	default		x
2417>>>4	search/192/s	\x5c\x5c
2418# directory path like: "\\FSX\SYS\opps\ipe.eng\samples" "\\DANIEL\IPE_CD\IPE.ITA"
2419>>>>&-4 pstring/l	>0		\b, "%s"
2420# look for point character inside image names
2421>56	search/38/s	.
2422# image name extension like: bmp jpg pcd tpl
2423>>&1	string	x			with %-.3s images
2424# Summary:	Ulead Pattern image (Corel Corporation)
2425# URL:		https://en.wikipedia.org/wiki/Ulead_Systems
2426#		https://www.file-extensions.org/pst-file-extension-ulead-pattern-image-format
2427# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pst-ulead.trid.xml
2428# From:		Joerg Jenderek
2429# Note:		used also by CorelDraw Essentials 3 version 13.0.0.800
2430#		there seems to exist other versions
24310	ubelong		0xFFFF0100
2432>8	search/21	PresetInfo	Ulead pattern image
2433#!:mime	application/octet-stream
2434!:mime	image/x-ulead-pst
2435!:ext	pst
2436# string length like: 16 18 19 21 24
2437#>>4	uleshort	x		n=%u
2438# like: BlendPresetInfo DropShadowPresetInfo FileNewPresetInfo VectorExtrudePresetInfo EnvelopePresetInfo ContourPresetInfo DistortionPresetInfo
2439>>4	pstring/h	x		"%s"
2440
2441# Type:	X11 cursor
2442# URL:	http://webcvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?view=markup
2443# From:	Mathias Brodala <info@noctus.net>
24440	string	Xcur			X11 cursor
2445
2446# Type:	Olympus ORF raw images.
2447# URL:	https://libopenraw.freedesktop.org/wiki/Olympus_ORF
2448# From:	Adam Buchbinder <adam.buchbinder@gmail.com>
24490	string		MMOR		Olympus ORF raw image data, big-endian
2450!:mime	image/x-olympus-orf
24510	string		IIRO		Olympus ORF raw image data, little-endian
2452!:mime	image/x-olympus-orf
24530	string		IIRS		Olympus ORF raw image data, little-endian
2454!:mime	image/x-olympus-orf
2455
2456# Type: files used in modern AVCHD camcoders to store clip information
2457# Extension: .cpi
2458# From: Alexander Danilov <alexander.a.danilov@gmail.com>
24590	string	HDMV0100	AVCHD Clip Information
2460
2461# From: Adam Buchbinder <adam.buchbinder@gmail.com>
2462# URL: http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
2463# Radiance HDR; usually has .pic or .hdr extension.
24640	string	#?RADIANCE\n	Radiance HDR image data
2465#!mime	image/vnd.radiance
2466
2467# From: Adam Buchbinder <adam.buchbinder@gmail.com>
2468# URL: https://www.mpi-inf.mpg.de/resources/pfstools/pfs_format_spec.pdf
2469# Used by the pfstools packages. The regex matches for the image size could
2470# probably use some work. The MIME type is made up; if there's one in
2471# actual common use, it should replace the one below.
24720	string	PFS1\x0a	PFS HDR image data
2473#!mime	image/x-pfs
2474>1	regex	[0-9]*\ 	\b, %s
2475>>1	regex	\ [0-9]{4}	\bx%s
2476
2477# Type: Foveon X3F
2478# URL:  https://www.photofo.com/downloads/x3f-raw-format.pdf
2479# From: Adam Buchbinder <adam.buchbinder@gmail.com>
2480# Note that the MIME type isn't defined anywhere that I can find; if
2481# there's a canonical type for this format, it should replace this one.
24820	string	FOVb	Foveon X3F raw image data
2483!:mime	image/x-x3f
2484>6	uleshort	x	\b, version %d.
2485>4	uleshort	x	\b%d
2486>28	ulelong		x	\b, %dx
2487>32	ulelong		x	\b%d
2488
2489# Paint.NET file
2490# From Adam Buchbinder <adam.buchbinder@gmail.com>
24910	string	PDN3	Paint.NET image data
2492!:mime	image/x-paintnet
2493
2494# Not really an image.
2495# From: "Tano M. Fotang" <mfotang@quanteq.com>
24960	string	\x46\x4d\x52\x00	ISO/IEC 19794-2 Format Minutiae Record (FMR)
2497
2498# doc: https://www.shikino.co.jp/eng/products/images/FLOWER.jpg.zip
2499# example: https://www.shikino.co.jp/eng/products/images/FLOWER.wdp.zip
250090	ubequad		0x574D50484F544F00	JPEG-XR Image
2501>98	ubyte&0x08	=0x08			\b, hard tiling
2502>99	ubyte&0x80	=0x80			\b, tiling present
2503>99	ubyte&0x40	=0x40			\b, codestream present
2504>99	ubyte&0x38	x			\b, spatial xform=
2505>99	ubyte&0x38	0x00			\bTL
2506>99	ubyte&0x38	0x08			\bBL
2507>99	ubyte&0x38	0x10			\bTR
2508>99	ubyte&0x38	0x18			\bBR
2509>99	ubyte&0x38	0x20			\bBT
2510>99	ubyte&0x38	0x28			\bRB
2511>99	ubyte&0x38	0x30			\bLT
2512>99	ubyte&0x38	0x38			\bLB
2513>100	ubyte&0x80	=0x80			\b, short header
2514>>102	ubeshort+1	x			\b, %d
2515>>104	ubeshort+1	x			\bx%d
2516>100	ubyte&0x80	=0x00			\b, long header
2517>>102	ubelong+1	x			\b, %x
2518>>106	ubelong+1	x			\bx%x
2519>101	ubeshort&0xf	x			\b, bitdepth=
2520>>101	ubeshort&0xf	0x0			\b1-WHITE=1
2521>>101	ubeshort&0xf	0x1			\b8
2522>>101	ubeshort&0xf	0x2			\b16
2523>>101	ubeshort&0xf	0x3			\b16-SIGNED
2524>>101	ubeshort&0xf	0x4			\b16-FLOAT
2525>>101	ubeshort&0xf	0x5			\b(reserved 5)
2526>>101	ubeshort&0xf	0x6			\b32-SIGNED
2527>>101	ubeshort&0xf	0x7			\b32-FLOAT
2528>>101	ubeshort&0xf	0x8			\b5
2529>>101	ubeshort&0xf	0x9			\b10
2530>>101	ubeshort&0xf	0xa			\b5-6-5
2531>>101	ubeshort&0xf	0xb			\b(reserved %d)
2532>>101	ubeshort&0xf	0xc			\b(reserved %d)
2533>>101	ubeshort&0xf	0xd			\b(reserved %d)
2534>>101	ubeshort&0xf	0xe			\b(reserved %d)
2535>>101	ubeshort&0xf	0xf			\b1-BLACK=1
2536>101	ubeshort&0xf0	x			\b, colorfmt=
2537>>101	ubeshort&0xf0	0x00			\bYONLY
2538>>101	ubeshort&0xf0	0x10			\bYUV240
2539>>101	ubeshort&0xf0	0x20			\bYWV422
2540>>101	ubeshort&0xf0	0x30			\bYWV444
2541>>101	ubeshort&0xf0	0x40			\bCMYK
2542>>101	ubeshort&0xf0	0x50			\bCMYKDIRECT
2543>>101	ubeshort&0xf0	0x60			\bNCOMPONENT
2544>>101	ubeshort&0xf0	0x70			\bRGB
2545>>101	ubeshort&0xf0	0x80			\bRGBE
2546>>101	ubeshort&0xf0	>0x80			\b(reserved %#x)
2547
2548# From: Johan van der Knijff <johan.vanderknijff@kb.nl>
2549#
2550# BPG (Better Portable Graphics) format
2551# https://bellard.org/bpg/
2552# http://fileformats.archiveteam.org/wiki/BPG
2553#
25540	string	\x42\x50\x47\xFB	BPG (Better Portable Graphics)
2555!:mime  image/bpg
2556
2557# From: Joerg Jenderek
2558# URL: https://en.wikipedia.org/wiki/Apple_Icon_Image_format
25590	string		icns		Mac OS X icon
2560!:mime	image/x-icns
2561!:apple	????icns
2562!:ext icns
2563>4	ubelong		>0
2564# file size
2565>>4	ubelong		x		\b, %d bytes
2566# icon type
2567>>8	string		x		\b, "%4.4s" type
2568
2569# TIM images
2570# URL:		http://fileformats.archiveteam.org/wiki/TIM_(PlayStation_graphics)
2571# Reference:	https://mrclick.zophar.net/TilEd/download/timgfx.txt
2572# Update:	Joerg Jenderek
2573# Note:		called as "PSX TIM *bpp bitmap" by bitmap-tim-*.trid.xml
2574#		verified as "TIM PSX" by XnView `nconvert -fullinfo *.tim` and
2575#		by RECOIL `recoil2png -o TMP.PNG input.tim; file TMP.PNG` and often
2576#		as "PSX TIM" by ImageMagick version 7.1.0-10 command `identify *.tim`
2577#		here signed integers are used but according to Kaitai unsigned
25780		ulelong		0x00000010
2579# 32 Flag bits *cttt; c~CLUT flag t~type 000~4BPP 001~8BPP 010~16BPP 011~24BPP 100~Mixed
2580#>4		ulelong  	x		FLAGS=%#x
2581# 12+Size of CLUT (2Ch for 4BPP; 20Ch 40Ch 60Ch 80Ch C0Ch for 8BPP) or
2582# +image data size (800Ch 2000Ch 2580C for 16BPP) (02000003h for dBase memo test.dbt)
2583#>8		ulelong		x		\b, 12+CLUT or data size=%#8.8x
2584# CLUT or data size remainder is 12 (Ch), but 03 for dBase memo test.dbt
2585#>8		ubyte&0x0F	=0x0C		\b, SIZE REMAINDER IS 12
2586# skip dBase III memo test.dbt with invalid flags 22D10189h
2587>4		ulelong&0xffFFffF0	=0	Sony PlayStation PSX image,
2588# file (version 5.40) labeled the above entry as "TIM image"
2589!:mime	image/x-sony-tim
2590!:ext	tim
2591#>>4		ulelong&0x00000007	x	\b, BPP~%u
2592# 4BPP and 8BPP examples exist with CLUT or without CLUT
2593>>4		ulelong&0x07	0x0		4-Bit,
2594>>4		ulelong&0x07	0x1		8-Bit,
2595# 16BPP and 24BPP examples have no CLUT
2596>>4		ulelong  	0x2		15-Bit,
2597>>4		ulelong  	0x3		24-Bit,
2598# no example
2599>>4		ulelong&0x07  	0x4		Mixed-Bit,
2600# CLUT flag set
2601>>4		ulelong 	&8
2602# 12 + size of CLUT like: 1000Ch 800Ch 400Ch 40Ch and 2FEh (KAGE.TIM)
2603#>>>(8.l+8)	ulelong		x		\b, 12+CLUT SIZE=%#8.8x
2604>>>(8.l+12)	uleshort	x		Pixel at (%d,
2605>>>(8.l+14)	uleshort	x		\b%d) Size=
2606# image width (to get actual width multiply by 4 for 4BPP and by 2 for 8BPP)
2607>>>>4		ulelong  	0x8
2608>>>>>(8.l+16)	uleshort*4	x		\b%d
2609>>>>4		ulelong  	0x9
2610>>>>>(8.l+16)	uleshort*2	x		\b%d
2611# image height like: 32 64 128 144 160 208 256
2612>>>(8.l+18)	uleshort	x		\bx%d,
2613>>>4		ulelong 	0x8		16 CLUT Entries at
2614>>>4		ulelong 	0x9		256 CLUT Entries at
2615>>>12		uleshort	x		(%d,
2616>>>14		uleshort	x		\b%d)
2617# no Color LookUp Table (CLUT)
2618>>4		ulelong		^8
2619# image origin X Y
2620>>>12		uleshort	x		Pixel at (%d,
2621>>>14		uleshort	x		\b%d) Size=
2622# real image width = multiply by 4 (4BPP) 2 (8BPP) 1 (16BPP) 2/3 (24BPP)
2623>>>>4		ulelong  	0x0
2624>>>>>16		uleshort*4	x		\b%d
2625>>>>4		ulelong  	0x1
2626>>>>>16		uleshort*2	x		\b%d
2627>>>>4		ulelong  	0x2
2628>>>>>16		uleshort		x		\b%d
2629>>>>4		ulelong  	0x3
2630# GRR: NOT working
2631#>>>>>16		uleshort*2/3	x		\b%d
2632>>>>>16		uleshort		x		\b2/3*%d
2633# mixed format width not explained!
2634>>>>4		ulelong  	0x4
2635>>>>>16		uleshort		x		\b%d
2636# image height like: 64 240 256
2637>>>18		uleshort		x		\bx%d
2638# TIM image data
2639
2640# MDEC streams
26410		ulelong		0x80010160	MDEC video stream,
2642>16		uleshort	x		%dx
2643>18		uleshort	x		\b%d
2644#>8		ulelong		x		%d frames
2645#>4		uleshort	x		secCount=%d;
2646#>6		uleshort	x		nSectors=%d;
2647#>12		ulelong		x		frameSize=%d;
2648
2649# BS encoded bitstreams
26502		uleshort	0x3800		BS image,
2651>6		uleshort	x		Version %d,
2652>4		uleshort	x		Quantization %d,
2653>0		uleshort	x		(Decompresses to %d words)
2654
2655# Type: farbfeld image.
2656# Url: http://tools.suckless.org/farbfeld/
2657# From: Ian D. Scott <ian@iandouglasscott.com>
2658#
26590		string		farbfeld	farbfeld image data,
2660>8		ubelong		x		%dx
2661>12		ubelong		x		\b%d
2662
2663# Type: Microsoft DirectDraw Surface (DXGI formats)
2664# URL:	https://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
2665# From: Morten Hustveit <morten@debian.org>
2666# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
26670	name	ms-directdraw-dx10
2668>0	ulelong	x	\b, DXGI format:
2669>0	ulelong	1	R32G32B32A32_TYPELESS
2670>0	ulelong	2	R32G32B32A32_FLOAT
2671>0	ulelong	3	R32G32B32A32_UINT
2672>0	ulelong	4	R32G32B32A32_SINT
2673>0	ulelong	5	R32G32B32_TYPELESS
2674>0	ulelong	6	R32G32B32_FLOAT
2675>0	ulelong	7	R32G32B32_UINT
2676>0	ulelong	8	R32G32B32_SINT
2677>0	ulelong	9	R16G16B16A16_TYPELESS
2678>0	ulelong	10	R16G16B16A16_FLOAT
2679>0	ulelong	11	R16G16B16A16_UNORM
2680>0	ulelong	12	R16G16B16A16_UINT
2681>0	ulelong	13	R16G16B16A16_SNORM
2682>0	ulelong	14	R16G16B16A16_SINT
2683>0	ulelong	15	R32G32_TYPELESS
2684>0	ulelong	16	R32G32_FLOAT
2685>0	ulelong	17	R32G32_UINT
2686>0	ulelong	18	R32G32_SINT
2687>0	ulelong	19	R32G8X24_TYPELESS
2688>0	ulelong	20	D32_FLOAT_S8X24_UINT
2689>0	ulelong	21	R32_FLOAT_X8X24_TYPELESS
2690>0	ulelong	22	X32_TYPELESS_G8X24_UINT
2691>0	ulelong	23	R10G10B10A2_TYPELESS
2692>0	ulelong	24	R10G10B10A2_UNORM
2693>0	ulelong	25	R10G10B10A2_UINT
2694>0	ulelong	26	R11G11B10_FLOAT
2695>0	ulelong	27	R8G8B8A8_TYPELESS
2696>0	ulelong	28	R8G8B8A8_UNORM
2697>0	ulelong	29	R8G8B8A8_UNORM_SRGB
2698>0	ulelong	30	R8G8B8A8_UINT
2699>0	ulelong	31	R8G8B8A8_SNORM
2700>0	ulelong	32	R8G8B8A8_SINT
2701>0	ulelong	33	R16G16_TYPELESS
2702>0	ulelong	34	R16G16_FLOAT
2703>0	ulelong	35	R16G16_UNORM
2704>0	ulelong	36	R16G16_UINT
2705>0	ulelong	37	R16G16_SNORM
2706>0	ulelong	38	R16G16_SINT
2707>0	ulelong	39	R32_TYPELESS
2708>0	ulelong	40	D32_FLOAT
2709>0	ulelong	41	R32_FLOAT
2710>0	ulelong	42	R32_UINT
2711>0	ulelong	43	R32_SINT
2712>0	ulelong	44	R24G8_TYPELESS
2713>0	ulelong	45	D24_UNORM_S8_UINT
2714>0	ulelong	46	R24_UNORM_X8_TYPELESS
2715>0	ulelong	47	X24_TYPELESS_G8_UINT
2716>0	ulelong	48	R8G8_TYPELESS
2717>0	ulelong	49	R8G8_UNORM
2718>0	ulelong	50	R8G8_UINT
2719>0	ulelong	51	R8G8_SNORM
2720>0	ulelong	52	R8G8_SINT
2721>0	ulelong	53	R16_TYPELESS
2722>0	ulelong	54	R16_FLOAT
2723>0	ulelong	55	D16_UNORM
2724>0	ulelong	56	R16_UNORM
2725>0	ulelong	57	R16_UINT
2726>0	ulelong	58	R16_SNORM
2727>0	ulelong	59	R16_SINT
2728>0	ulelong	60	R8_TYPELESS
2729>0	ulelong	61	R8_UNORM
2730>0	ulelong	62	R8_UINT
2731>0	ulelong	63	R8_SNORM
2732>0	ulelong	64	R8_SINT
2733>0	ulelong	65	A8_UNORM
2734>0	ulelong	66	R1_UNORM
2735>0	ulelong	67	R9G9B9E5_SHAREDEXP
2736>0	ulelong	68	R8G8_B8G8_UNORM
2737>0	ulelong	69	G8R8_G8B8_UNORM
2738>0	ulelong	70	BC1_TYPELESS
2739>0	ulelong	71	BC1_UNORM
2740>0	ulelong	72	BC1_UNORM_SRGB
2741>0	ulelong	73	BC2_TYPELESS
2742>0	ulelong	74	BC2_UNORM
2743>0	ulelong	75	BC2_UNORM_SRGB
2744>0	ulelong	76	BC3_TYPELESS
2745>0	ulelong	77	BC3_UNORM
2746>0	ulelong	78	BC3_UNORM_SRGB
2747>0	ulelong	79	BC4_TYPELESS
2748>0	ulelong	80	BC4_UNORM
2749>0	ulelong	81	BC4_SNORM
2750>0	ulelong	82	BC5_TYPELESS
2751>0	ulelong	83	BC5_UNORM
2752>0	ulelong	84	BC5_SNORM
2753>0	ulelong	85	B5G6R5_UNORM
2754>0	ulelong	86	B5G5R5A1_UNORM
2755>0	ulelong	87	B8G8R8A8_UNORM
2756>0	ulelong	88	B8G8R8X8_UNORM
2757>0	ulelong	89	R10G10B10_XR_BIAS_A2_UNORM
2758>0	ulelong	90	B8G8R8A8_TYPELESS
2759>0	ulelong	91	B8G8R8A8_UNORM_SRGB
2760>0	ulelong	92	B8G8R8X8_TYPELESS
2761>0	ulelong	93	B8G8R8X8_UNORM_SRGB
2762>0	ulelong	94	BC6H_TYPELESS
2763>0	ulelong	95	BC6H_UF16
2764>0	ulelong	96	BC6H_SF16
2765>0	ulelong	97	BC7_TYPELESS
2766>0	ulelong	98	BC7_UNORM
2767>0	ulelong	99	BC7_UNORM_SRGB
2768>0	ulelong	100	AYUV
2769>0	ulelong	101	Y410
2770>0	ulelong	102	Y416
2771>0	ulelong	103	NV12
2772>0	ulelong	104	P010
2773>0	ulelong	105	P016
2774>0	ulelong	106	420_OPAQUE
2775>0	ulelong	107	YUY2
2776>0	ulelong	108	Y210
2777>0	ulelong	109	Y216
2778>0	ulelong	110	NV11
2779>0	ulelong	111	AI44
2780>0	ulelong	112	IA44
2781>0	ulelong	113	P8
2782>0	ulelong	114	A8P8
2783>0	ulelong	115	B4G4R4A4_UNORM
2784
2785>0	ulelong	116	XBOX_R10G10B10_7E3_A2_FLOAT
2786>0	ulelong	117	XBOX_R10G10B10_6E4_A2_FLOAT
2787>0	ulelong	118	XBOX_D16_UNORM_S8_UINT
2788>0	ulelong	119	XBOX_R16_UNORM_X8_TYPELESS
2789>0	ulelong	120	XBOX_X16_TYPELESS_G8_UINT
2790
2791>0	ulelong	130	DXGI_FORMAT_P208
2792>0	ulelong	131	DXGI_FORMAT_V208
2793>0	ulelong	132	DXGI_FORMAT_V408
2794
2795>0	ulelong	133	ASTC_4X4_TYPELESS
2796>0	ulelong	134	ASTC_4X4_UNORM
2797>0	ulelong	135	ASTC_4X4_UNORM_SRGB
2798>0	ulelong	137	ASTC_5X4_TYPELESS
2799>0	ulelong	138	ASTC_5X4_UNORM
2800>0	ulelong	139	ASTC_5X4_UNORM_SRGB
2801>0	ulelong	141	ASTC_5X5_TYPELESS
2802>0	ulelong	142	ASTC_5X5_UNORM
2803>0	ulelong	143	ASTC_5X5_UNORM_SRGB
2804>0	ulelong	145	ASTC_6X5_TYPELESS
2805>0	ulelong	146	ASTC_6X5_UNORM
2806>0	ulelong	147	ASTC_6X5_UNORM_SRGB
2807>0	ulelong	149	ASTC_6X6_TYPELESS
2808>0	ulelong	150	ASTC_6X6_UNORM
2809>0	ulelong	151	ASTC_6X6_UNORM_SRGB
2810>0	ulelong	153	ASTC_8X5_TYPELESS
2811>0	ulelong	154	ASTC_8X5_UNORM
2812>0	ulelong	155	ASTC_8X5_UNORM_SRGB
2813>0	ulelong	157	ASTC_8X6_TYPELESS
2814>0	ulelong	158	ASTC_8X6_UNORM
2815>0	ulelong	159	ASTC_8X6_UNORM_SRGB
2816>0	ulelong	161	ASTC_8X8_TYPELESS
2817>0	ulelong	162	ASTC_8X8_UNORM
2818>0	ulelong	163	ASTC_8X8_UNORM_SRGB
2819>0	ulelong	165	ASTC_10X5_TYPELESS
2820>0	ulelong	166	ASTC_10X5_UNORM
2821>0	ulelong	167	ASTC_10X5_UNORM_SRGB
2822>0	ulelong	169	ASTC_10X6_TYPELESS
2823>0	ulelong	170	ASTC_10X6_UNORM
2824>0	ulelong	171	ASTC_10X6_UNORM_SRGB
2825>0	ulelong	173	ASTC_10X8_TYPELESS
2826>0	ulelong	174	ASTC_10X8_UNORM
2827>0	ulelong	175	ASTC_10X8_UNORM_SRGB
2828>0	ulelong	177	ASTC_10X10_TYPELESS
2829>0	ulelong	178	ASTC_10X10_UNORM
2830>0	ulelong	179	ASTC_10X10_UNORM_SRGB
2831>0	ulelong	181	ASTC_12X10_TYPELESS
2832>0	ulelong	182	ASTC_12X10_UNORM
2833>0	ulelong	183	ASTC_12X10_UNORM_SRGB
2834>0	ulelong	185	ASTC_12X12_TYPELESS
2835>0	ulelong	186	ASTC_12X12_UNORM
2836>0	ulelong	187	ASTC_12X12_UNORM_SRGB
2837
2838>0	ulelong	190	XBOX_R10G10B10_SNORM_A2_UNORM
2839>0	ulelong	189	XBOX_R4G4_UNORM
2840>0	ulelong	0xFFFFFFFF	DXGI_FORMAT_FORCE_UINT
2841
2842# Type: Microsoft DirectDraw Surface (common data)
2843# URL:	https://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
2844# From: Morten Hustveit <morten@debian.org>
2845# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
28460	name	ms-directdraw-surface
2847>0x10	ulelong	x			%u x
2848>0x0C	ulelong	x			%u
2849# Color depth.
2850>0x58	ulelong	>0			\b, %u-bit color
2851# Determine the pixel format.
2852>0x50	ulelong&0x4	4
2853# FIXME: Handle DX10 and XBOX formats.
2854>>0x54	string	DX10
2855>>>0x80	use	ms-directdraw-dx10
2856>>0x54	string	!DX10			\b, compressed using %.4s
2857>0x50	ulelong&0x2	0x2		\b, alpha only
2858>0x50	ulelong&0x200	0x200		\b, YUV
2859>0x50	ulelong&0x20000	0x20000		\b, luminance
2860# RGB pixel format
2861>0x50	ulelong&0x40	0x40
2862
2863# Determine the RGB format using the color masks.
2864# ulequad order: 0xGGGGGGGGRRRRRRRR, 0xAAAAAAAABBBBBBBB
2865
2866>>0x58		ulelong	16
2867
2868# NOTE: 15-bit color formats usually have 16-bit listed as the color depth.
2869>>>0x5C		ulequad	0x000003E000007C00
2870>>>>0x64	ulequad 0x000000000000001F	\b, RGB555
2871>>>0x5C		ulequad	0x000003E000001F00
2872>>>>0x64	ulequad 0x000000000000007C	\b, BGR555
2873
2874>>>0x5C		ulequad	0x000007E00000F800
2875>>>>0x64	ulequad 0x000000000000001F	\b, RGB565
2876>>>0x5C		ulequad	0x000007E000001F00
2877>>>>0x64	ulequad 0x00000000000000F8	\b, BGR565
2878
2879>>>0x5C		ulequad	0x000000F000000F00
2880>>>>0x64	ulequad 0x0000F0000000000F	\b, ARGB4444
2881>>>0x5C		ulequad	0x000000F00000000F
2882>>>>0x64	ulequad 0x0000F00000000F00	\b, ABGR4444
2883
2884>>>0x5C		ulequad	0x00000F000000F000
2885>>>>0x64	ulequad 0x0000000F000000F0	\b, RGBA4444
2886>>>0x5C		ulequad	0x00000F00000000F0
2887>>>>0x64	ulequad 0x0000000F0000F000	\b, BGRA4444
2888
2889>>>0x5C		ulequad	0x000000F000000F00
2890>>>>0x64	ulequad 0x000000000000000F	\b, xRGB4444
2891>>>0x5C		ulequad	0x000000F00000000F
2892>>>>0x64	ulequad 0x0000000000000F00	\b, xBGR4444
2893
2894>>>0x5C		ulequad	0x00000F000000F000
2895>>>>0x64	ulequad 0x00000000000000F0	\b, RGBx4444
2896>>>0x5C		ulequad	0x00000F00000000F0
2897>>>>0x64	ulequad 0x000000000000F000	\b, BGRx4444
2898
2899>>>0x5C		ulequad	0x000003E000007C00
2900>>>>0x64	ulequad 0x000080000000001F	\b, ARGB1555
2901>>>0x5C		ulequad	0x000003E000001F00
2902>>>>0x64	ulequad 0x000080000000007C	\b, ABGR1555
2903>>>0x5C		ulequad	0x000007C00000F800
2904>>>>0x64	ulequad 0x000000010000003E	\b, RGBA5551
2905>>>0x5C		ulequad	0x000007C00000003E
2906>>>>0x64	ulequad 0x000000010000F800	\b, BGRA5551
2907
2908>>88		ulelong 24
2909>>>0x5C		ulequad	0x0000FF0000FF0000
2910>>>>0x64	ulequad 0x00000000000000FF	\b, RGB888
2911>>>0x5C		ulequad	0x0000FF00000000FF
2912>>>>0x64	ulequad 0x0000000000FF0000	\b, BGR888
2913
2914>>88		ulelong 32
2915>>>0x5C		ulequad	0x0000FF0000FF0000
2916>>>>0x64	ulequad 0xFF000000000000FF	\b, ARGB8888
2917>>>0x5C		ulequad	0x0000FF00000000FF
2918>>>>0x64	ulequad 0xFF00000000FF0000	\b, ABGR8888
2919
2920>>>0x5C		ulequad	0x00FF0000FF000000
2921>>>>0x64	ulequad 0x000000FF0000FF00	\b, RGBA8888
2922>>>0x5C		ulequad	0x00FF00000000FF00
2923>>>>0x64	ulequad 0x000000FFFF000000	\b, BGBA8888
2924
2925>>>0x5C		ulequad	0x0000FF0000FF0000
2926>>>>0x64	ulequad 0x00000000000000FF	\b, xRGB8888
2927>>>0x5C		ulequad	0x0000FF00000000FF
2928>>>>0x64	ulequad 0x0000000000FF0000	\b, xBGR8888
2929
2930>>>0x5C		ulequad	0x00FF0000FF000000
2931>>>>0x64	ulequad 0x000000000000FF00	\b, RGBx8888
2932>>>0x5C		ulequad	0x00FF00000000FF00
2933>>>>0x64	ulequad 0x00000000FF000000	\b, BGBx8888
2934
2935# Less common 32-bit color formats.
2936>>>0x5C		ulequad	0xFFFF00000000FFFF
2937>>>>0x64	ulequad 0x0000000000000000	\b, G16R16
2938>>>0x5C		ulequad	0x0000FFFFFFFF0000
2939>>>>0x64	ulequad 0x0000000000000000	\b, R16G16
2940
2941>>>0x5C		ulequad	0x000FFC003FF00000
2942>>>>0x64	ulequad 0xC0000000000003FF	\b, A2R10G10B10
2943>>>0x5C		ulequad	0x000FFC00000003FF
2944>>>>0x64	ulequad 0xC00000003FF00000	\b, A2B10G10R10
2945
2946# Type: Microsoft DirectDraw Surface
2947# URL:	https://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
2948# From: Morten Hustveit <morten@debian.org>
2949# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
29500	string/b	DDS\040\174\000\000\000 Microsoft DirectDraw Surface (DDS):
2951>0	use	ms-directdraw-surface
2952
2953# Type: Sega PVR image.
2954# From: David Korth <gerbilsoft@gerbilsoft.com>
2955# References:
2956# - https://fabiensanglard.net/Mykaruga/tools/segaPVRFormat.txt
2957# - https://github.com/yazgoo/pvrx2png
2958# - https://github.com/nickworonekin/puyotools
2959
2960# Sega PVR header.
29610	name	sega-pvr-image-header
2962>0x0C	uleshort	x	%u x
2963>0x0E	uleshort	x	%u
2964# Image format.
2965>0x08	ubyte	0	\b, ARGB1555
2966>0x08	ubyte	1	\b, RGB565
2967>0x08	ubyte	2	\b, ARGB4444
2968>0x08	ubyte	3	\b, YUV442
2969>0x08	ubyte	4	\b, Bump
2970>0x08	ubyte	5	\b, 4bpp
2971>0x08	ubyte	6	\b, 8bpp
2972# Image data type.
2973>0x09	ubyte	0x01	\b, square twiddled
2974>0x09	ubyte	0x02	\b, square twiddled & mipmap
2975>0x09	ubyte	0x03	\b, VQ
2976>0x09	ubyte	0x04	\b, VQ & mipmap
2977>0x09	ubyte	0x05	\b, 8-bit CLUT twiddled
2978>0x09	ubyte	0x06	\b, 4-bit CLUT twiddled
2979>0x09	ubyte	0x07	\b, 8-bit direct twiddled
2980>0x09	ubyte	0x08	\b, 4-bit direct twiddled
2981>0x09	ubyte	0x09	\b, rectangle
2982>0x09	ubyte	0x0B	\b, rectangular stride
2983>0x09	ubyte	0x0D	\b, rectangular twiddled
2984>0x09	ubyte	0x10	\b, small VQ
2985>0x09	ubyte	0x11	\b, small VQ & mipmap
2986>0x09	ubyte	0x12	\b, square twiddled & mipmap
2987
2988# Sega PVR image.
29890	string	PVRT
2990>0x10	string	DDS\040\174\000\000\000 Sega PVR (Xbox) image:
2991>>0x20	use	ms-directdraw-surface
2992>0x10	ubelong	!0x44445320		Sega PVR image:
2993>>0	use	sega-pvr-image-header
2994
2995# Sega PVR image with GBIX.
29960	string	GBIX
2997>0x10	string	PVRT
2998>>0x10	string	DDS\040\174\000\000\000 Sega PVR (Xbox) image:
2999>>>0x20	use	ms-directdraw-surface
3000>>0x10	ubelong	!0x44445320		Sega PVR image:
3001>>>0x10	use	sega-pvr-image-header
3002>>0x08	ulelong	x	\b, global index = %u
3003
3004# Sega GVR header.
30050	name	sega-gvr-image-header
3006>0x0C	ubeshort	x	%u x
3007>0x0E	ubeshort	x	%u
3008# Image data format.
3009>0x0B	ubyte	0	\b, I4
3010>0x0B	ubyte	1	\b, I8
3011>0x0B	ubyte	2	\b, IA4
3012>0x0B	ubyte	3	\b, IA8
3013>0x0B	ubyte	4	\b, RGB565
3014>0x0B	ubyte	5	\b, RGB5A3
3015>0x0B	ubyte	6	\b, ARGB8888
3016>0x0B	ubyte	8	\b, CI4
3017>0x0B	ubyte	9	\b, CI8
3018>0x0B	ubyte	14	\b, DXT1
3019
3020# Sega GVR image.
30210	string	GVRT	Sega GVR image:
3022>0x10	use	sega-gvr-image-header
3023
3024# Sega GVR image with GBIX.
30250	string	GBIX
3026>0x10	string	GVRT	Sega GVR image:
3027>>0x10	use	sega-gvr-image-header
3028>>0x08	ubelong	x	\b, global index = %u
3029
3030# Sega GVR image with GCIX. (Wii)
30310	string	GCIX
3032>0x10	string	GVRT	Sega GVR image:
3033>>0x10	use	sega-gvr-image-header
3034>>0x08	ubelong	x	\b, global index = %u
3035
3036# Light Field Picture
3037# Documentation: http://optics.miloush.net/lytro/TheFileFormat.aspx
3038# Typical file extensions: .lfp .lfr .lfx
3039
30400	ubelong	0x894C4650
3041>4	ubelong	0x0D0A1A0A
3042>12	ubelong	0x00000000	Lytro Light Field Picture
3043>8	ubelong	x		\b, version %d
3044
3045# Type: Vision Research Phantom CINE Format
3046# URL: https://www.phantomhighspeed.com/
3047# URL2: http://phantomhighspeed.force.com/vriknowledge/servlet/fileField?id=0BEU0000000Cfyk
3048# From: Harry Mallon <hjmallon at gmail.com>
3049#
3050# This has a short "CI" code but the 44 is the size of the struct which is
3051# stable
30520	string	CI
3053>2	uleshort 44		Vision Research CINE Video,
3054>>4	uleshort	0		Grayscale,
3055>>4	uleshort 1		JPEG Compressed,
3056>>4	uleshort 2		RAW,
3057>>6	uleshort x		version %d,
3058>>20	ulelong	x		%d frames,
3059>>48	ulelong	x		%dx
3060>>52	ulelong	x		\b%d
3061
3062# Type: ARRI Raw Image
3063# Info: SMPTE RDD30:2014
3064# From: Harry Mallon <hjmallon at gmail.com>
30650	string ARRI		ARRI ARI image data,
3066>4	ulelong 0x78563412	little-endian,
3067>4 	ulelong 0x12345678	big-endian,
3068>12	ulelong x		version %d,
3069>20	ulelong x 		%dx
3070>24	ulelong x		\b%d
3071
3072# Type: Khronos KTX texture.
3073# From: David Korth <gerbilsoft@gerbilsoft.com>
3074# Reference: https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
3075
3076# glEnum decoding.
3077# NOTE: Only the most common formats are listed here.
30780	name	khronos-ktx-glEnum
3079>0	ulelong	0x1907	\b, RGB
3080>0	ulelong	0x1908	\b, RGBA
3081>0	ulelong	0x1909	\b, LUMINANCE
3082>0	ulelong	0x190A	\b, LUMINANCE_ALPHA
3083>0	ulelong	0x80E1	\b, BGR
3084>0	ulelong	0x80E2	\b, BGRA
3085>0	ulelong	0x83A0	\b, RGB_S3TC
3086>0	ulelong	0x83A1	\b, RGB4_S3TC
3087>0	ulelong	0x83A2	\b, RGBA_S3TC
3088>0	ulelong	0x83A3	\b, RGBA4_S3TC
3089>0	ulelong	0x83A4	\b, RGBA_DXT5_S3TC
3090>0	ulelong	0x83A5	\b, RGBA4_DXT5_S3TC
3091>0	ulelong	0x83F0	\b, COMPRESSED_RGB_S3TC_DXT1_EXT
3092>0	ulelong	0x83F1	\b, COMPRESSED_RGBA_S3TC_DXT1_EXT
3093>0	ulelong	0x83F2	\b, COMPRESSED_RGBA_S3TC_DXT3_EXT
3094>0	ulelong	0x83F3	\b, COMPRESSED_RGBA_S3TC_DXT5_EXT
3095>0	ulelong	0x8D64	\b, ETC1_RGB8_OES
3096>0	ulelong	0x9270	\b, COMPRESSED_R11_EAC
3097>0	ulelong	0x9271	\b, COMPRESSED_SIGNED_R11_EAC
3098>0	ulelong	0x9272	\b, COMPRESSED_RG11_EAC
3099>0	ulelong	0x9273	\b, COMPRESSED_SIGNED_RG11_EAC
3100>0	ulelong	0x9274	\b, COMPRESSED_RGB8_ETC2
3101>0	ulelong	0x9275	\b, COMPRESSED_SRGB8_ETC2
3102>0	ulelong	0x9276	\b, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
3103>0	ulelong	0x9277	\b, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
3104>0	ulelong	0x9278	\b, COMPRESSED_RGBA2_ETC2_EAC
3105>0	ulelong	0x9279	\b, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
3106>0	ulelong	0x93B0	\b, COMPRESSED_RGBA_ASTC_4x4_KHR
3107>0	ulelong	0x93B1	\b, COMPRESSED_RGBA_ASTC_5x4_KHR
3108>0	ulelong	0x93B2	\b, COMPRESSED_RGBA_ASTC_5x5_KHR
3109>0	ulelong	0x93B3	\b, COMPRESSED_RGBA_ASTC_6x5_KHR
3110>0	ulelong	0x93B4	\b, COMPRESSED_RGBA_ASTC_6x6_KHR
3111>0	ulelong	0x93B5	\b, COMPRESSED_RGBA_ASTC_8x5_KHR
3112>0	ulelong	0x93B6	\b, COMPRESSED_RGBA_ASTC_8x6_KHR
3113>0	ulelong	0x93B7	\b, COMPRESSED_RGBA_ASTC_8x8_KHR
3114>0	ulelong	0x93B8	\b, COMPRESSED_RGBA_ASTC_10x5_KHR
3115>0	ulelong	0x93B9	\b, COMPRESSED_RGBA_ASTC_10x6_KHR
3116>0	ulelong	0x93BA	\b, COMPRESSED_RGBA_ASTC_10x8_KHR
3117>0	ulelong	0x93BB	\b, COMPRESSED_RGBA_ASTC_10x10_KHR
3118>0	ulelong	0x93BC	\b, COMPRESSED_RGBA_ASTC_12x10_KHR
3119>0	ulelong	0x93BD	\b, COMPRESSED_RGBA_ASTC_12x12_KHR
3120>0	ulelong	0x93D0	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
3121>0	ulelong	0x93D1	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
3122>0	ulelong	0x93D2	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
3123>0	ulelong	0x93D3	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
3124>0	ulelong	0x93D4	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
3125>0	ulelong	0x93D5	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
3126>0	ulelong	0x93D6	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
3127>0	ulelong	0x93D7	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
3128>0	ulelong	0x93D8	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
3129>0	ulelong	0x93D9	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
3130>0	ulelong	0x93DA	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
3131>0	ulelong	0x93DB	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
3132>0	ulelong	0x93DC	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
3133>0	ulelong	0x93DD	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
3134
3135# Endian-specific KTX header.
3136# TODO: glType (all textures I've seen so far are GL_UNSIGNED_BYTE)
31370	name	khronos-ktx-endian-header
3138>20	ulelong	x	\b, %u
3139>24	ulelong	>1	x %u
3140>28	ulelong	>1	x %u
3141>8	ulelong	>0
3142>>8	use	khronos-ktx-glEnum
3143>8	ulelong	0
3144>>12	use	khronos-ktx-glEnum
3145
3146# Main KTX header.
3147# Determine endianness, then check the rest of the header.
31480	string	\xABKTX\ 11\xBB\r\n\x1A\n	Khronos KTX texture
3149>12	ulelong	0x04030201			(little-endian)
3150>>16	use	khronos-ktx-endian-header
3151>12	ubelong	0x04030201			(big-endian)
3152>>16	use	\^khronos-ktx-endian-header
3153
3154# Type: Khronos KTX2 texture.
3155# From: David Korth <gerbilsoft@gerbilsoft.com>
3156# Based on draft19.
3157# Reference: http://github.khronos.org/KTX-Specification/
3158
3159# Supercompression enum.
31600	name	khronos-ktx2-supercompression
3161>0	ulelong	1	BasisLZ
3162>0	ulelong	2	Zstandard
3163>0	ulelong	3	ZLIB
3164
3165# Vulkan format identifier.
3166# NOTE: Formats prohibited from KTX2 are commented out.
31670	name	khronos-ktx2-vkFormat
3168>0	ulelong	0	UNDEFINED
3169>0	ulelong	1	R4G4_UNORM_PACK8
3170>0	ulelong	2	R4G4B4A4_UNORM_PACK16
3171>0	ulelong	3	B4G4R4A4_UNORM_PACK16
3172>0	ulelong	4	R5G6B5_UNORM_PACK16
3173>0	ulelong	5	B5G6R5_UNORM_PACK16
3174>0	ulelong	6	R5G5B5A1_UNORM_PACK16
3175>0	ulelong	7	B5G5R5A1_UNORM_PACK16
3176>0	ulelong	8	A1R5G5B5_UNORM_PACK16
3177>0	ulelong	9	R8_UNORM
3178>0	ulelong	10	R8_SNORM
3179#>0	ulelong	11	R8_USCALED
3180#>0	ulelong	12	R8_SSCALED
3181>0	ulelong	13	R8_UINT
3182>0	ulelong	14	R8_SINT
3183>0	ulelong	15	R8_SRGB
3184>0	ulelong	16	R8G8_UNORM
3185>0	ulelong	17	R8G8_SNORM
3186#>0	ulelong	18	R8G8_USCALED
3187#>0	ulelong	19	R8G8_SSCALED
3188>0	ulelong	20	R8G8_UINT
3189>0	ulelong	21	R8G8_SINT
3190>0	ulelong	22	R8G8_SRGB
3191>0	ulelong	23	R8G8B8_UNORM
3192>0	ulelong	24	R8G8B8_SNORM
3193#>0	ulelong	25	R8G8B8_USCALED
3194#>0	ulelong	26	R8G8B8_SSCALED
3195>0	ulelong	27	R8G8B8_UINT
3196>0	ulelong	28	R8G8B8_SINT
3197>0	ulelong	29	R8G8B8_SRGB
3198>0	ulelong	30	B8G8R8_UNORM
3199>0	ulelong	31	B8G8R8_SNORM
3200#>0	ulelong	32	B8G8R8_USCALED
3201#>0	ulelong	33	B8G8R8_SSCALED
3202>0	ulelong	34	B8G8R8_UINT
3203>0	ulelong	35	B8G8R8_SINT
3204>0	ulelong	36	B8G8R8_SRGB
3205>0	ulelong	37	R8G8B8A8_UNORM
3206>0	ulelong	38	R8G8B8A8_SNORM
3207#>0	ulelong	39	R8G8B8A8_USCALED
3208#>0	ulelong	40	R8G8B8A8_SSCALED
3209>0	ulelong	41	R8G8B8A8_UINT
3210>0	ulelong	42	R8G8B8A8_SINT
3211>0	ulelong	43	R8G8B8A8_SRGB
3212>0	ulelong	44	B8G8R8A8_UNORM
3213>0	ulelong	45	B8G8R8A8_SNORM
3214#>0	ulelong	46	B8G8R8A8_USCALED
3215#>0	ulelong	47	B8G8R8A8_SSCALED
3216>0	ulelong	48	B8G8R8A8_UINT
3217>0	ulelong	49	B8G8R8A8_SINT
3218>0	ulelong	50	B8G8R8A8_SRGB
3219#>0	ulelong	51	A8B8G8R8_UNORM_PACK32
3220#>0	ulelong	52	A8B8G8R8_SNORM_PACK32
3221#>0	ulelong	53	A8B8G8R8_USCALED_PACK32
3222#>0	ulelong	54	A8B8G8R8_SSCALED_PACK32
3223#>0	ulelong	55	A8B8G8R8_UINT_PACK32
3224#>0	ulelong	56	A8B8G8R8_SINT_PACK32
3225#>0	ulelong	57	A8B8G8R8_SRGB_PACK32
3226>0	ulelong	58	A2R10G10B10_UNORM_PACK32
3227>0	ulelong	59	A2R10G10B10_SNORM_PACK32
3228#>0	ulelong	60	A2R10G10B10_USCALED_PACK32
3229#>0	ulelong	61	A2R10G10B10_SSCALED_PACK32
3230>0	ulelong	62	A2R10G10B10_UINT_PACK32
3231>0	ulelong	63	A2R10G10B10_SINT_PACK32
3232>0	ulelong	64	A2B10G10R10_UNORM_PACK32
3233>0	ulelong	65	A2B10G10R10_SNORM_PACK32
3234#>0	ulelong	66	A2B10G10R10_USCALED_PACK32
3235#>0	ulelong	67	A2B10G10R10_SSCALED_PACK32
3236>0	ulelong	68	A2B10G10R10_UINT_PACK32
3237>0	ulelong	69	A2B10G10R10_SINT_PACK32
3238>0	ulelong	70	R16_UNORM
3239>0	ulelong	71	R16_SNORM
3240#>0	ulelong	72	R16_USCALED
3241#>0	ulelong	73	R16_SSCALED
3242>0	ulelong	74	R16_UINT
3243>0	ulelong	75	R16_SINT
3244>0	ulelong	76	R16_SFLOAT
3245>0	ulelong	77	R16G16_UNORM
3246>0	ulelong	78	R16G16_SNORM
3247#>0	ulelong	79	R16G16_USCALED
3248#>0	ulelong	80	R16G16_SSCALED
3249>0	ulelong	81	R16G16_UINT
3250>0	ulelong	82	R16G16_SINT
3251>0	ulelong	83	R16G16_SFLOAT
3252>0	ulelong	84	R16G16B16_UNORM
3253>0	ulelong	85	R16G16B16_SNORM
3254#>0	ulelong	86	R16G16B16_USCALED
3255#>0	ulelong	87	R16G16B16_SSCALED
3256>0	ulelong	88	R16G16B16_UINT
3257>0	ulelong	89	R16G16B16_SINT
3258>0	ulelong	90	R16G16B16_SFLOAT
3259>0	ulelong	91	R16G16B16A16_UNORM
3260>0	ulelong	92	R16G16B16A16_SNORM
3261#>0	ulelong	93	R16G16B16A16_USCALED
3262#>0	ulelong	94	R16G16B16A16_SSCALED
3263>0	ulelong	95	R16G16B16A16_UINT
3264>0	ulelong	96	R16G16B16A16_SINT
3265>0	ulelong	97	R16G16B16A16_SFLOAT
3266>0	ulelong	98	R32_UINT
3267>0	ulelong	99	R32_SINT
3268>0	ulelong	100	R32_SFLOAT
3269>0	ulelong	101	R32G32_UINT
3270>0	ulelong	102	R32G32_SINT
3271>0	ulelong	103	R32G32_SFLOAT
3272>0	ulelong	104	R32G32B32_UINT
3273>0	ulelong	105	R32G32B32_SINT
3274>0	ulelong	106	R32G32B32_SFLOAT
3275>0	ulelong	107	R32G32B32A32_UINT
3276>0	ulelong	108	R32G32B32A32_SINT
3277>0	ulelong	109	R32G32B32A32_SFLOAT
3278>0	ulelong	110	R64_UINT
3279>0	ulelong	111	R64_SINT
3280>0	ulelong	112	R64_SFLOAT
3281>0	ulelong	113	R64G64_UINT
3282>0	ulelong	114	R64G64_SINT
3283>0	ulelong	115	R64G64_SFLOAT
3284>0	ulelong	116	R64G64B64_UINT
3285>0	ulelong	117	R64G64B64_SINT
3286>0	ulelong	118	R64G64B64_SFLOAT
3287>0	ulelong	119	R64G64B64A64_UINT
3288>0	ulelong	120	R64G64B64A64_SINT
3289>0	ulelong	121	R64G64B64A64_SFLOAT
3290>0	ulelong	122	B10G11R11_UFLOAT_PACK32
3291>0	ulelong	123	E5B9G9R9_UFLOAT_PACK32
3292>0	ulelong	124	D16_UNORM
3293>0	ulelong	125	X8_D24_UNORM_PACK32
3294>0	ulelong	126	D32_SFLOAT
3295>0	ulelong	127	S8_UINT
3296>0	ulelong	128	D16_UNORM_S8_UINT
3297>0	ulelong	129	D24_UNORM_S8_UINT
3298>0	ulelong	130	D32_SFLOAT_S8_UINT
3299
3300>0	ulelong	131	BC1_RGB_UNORM_BLOCK
3301>0	ulelong	132	BC1_RGB_SRGB_BLOCK
3302>0	ulelong	133	BC1_RGBA_UNORM_BLOCK
3303>0	ulelong	134	BC1_RGBA_SRGB_BLOCK
3304>0	ulelong	135	BC2_UNORM_BLOCK
3305>0	ulelong	136	BC2_SRGB_BLOCK
3306>0	ulelong	137	BC3_UNORM_BLOCK
3307>0	ulelong	138	BC3_SRGB_BLOCK
3308>0	ulelong	139	BC4_UNORM_BLOCK
3309>0	ulelong	140	BC4_SNORM_BLOCK
3310>0	ulelong	141	BC5_UNORM_BLOCK
3311>0	ulelong	142	BC5_SNORM_BLOCK
3312>0	ulelong	143	BC6H_UFLOAT_BLOCK
3313>0	ulelong	144	BC6H_SFLOAT_BLOCK
3314>0	ulelong	145	BC7_UNORM_BLOCK
3315>0	ulelong	146	BC7_SRGB_BLOCK
3316
3317>0	ulelong	147	ETC2_R8G8B8_UNORM_BLOCK
3318>0	ulelong	148	ETC2_R8G8B8_SRGB_BLOCK
3319>0	ulelong	149	ETC2_R8G8B8A1_UNORM_BLOCK
3320>0	ulelong	150	ETC2_R8G8B8A1_SRGB_BLOCK
3321>0	ulelong	151	ETC2_R8G8B8A8_UNORM_BLOCK
3322>0	ulelong	152	ETC2_R8G8B8A8_SRGB_BLOCK
3323
3324>0	ulelong	153	EAC_R11_UNORM_BLOCK
3325>0	ulelong	154	EAC_R11_SNORM_BLOCK
3326>0	ulelong	155	EAC_R11G11_UNORM_BLOCK
3327>0	ulelong	156	EAC_R11G11_SNORM_BLOCK
3328
3329>0	ulelong	157	ASTC_4x4_UNORM_BLOCK
3330>0	ulelong	158	ASTC_4x4_SRGB_BLOCK
3331>0	ulelong	159	ASTC_5x4_UNORM_BLOCK
3332>0	ulelong	160	ASTC_5x4_SRGB_BLOCK
3333>0	ulelong	161	ASTC_5x5_UNORM_BLOCK
3334>0	ulelong	162	ASTC_5x5_SRGB_BLOCK
3335>0	ulelong	163	ASTC_6x5_UNORM_BLOCK
3336>0	ulelong	164	ASTC_6x5_SRGB_BLOCK
3337>0	ulelong	165	ASTC_6x6_UNORM_BLOCK
3338>0	ulelong	166	ASTC_6x6_SRGB_BLOCK
3339>0	ulelong	167	ASTC_8x5_UNORM_BLOCK
3340>0	ulelong	168	ASTC_8x5_SRGB_BLOCK
3341>0	ulelong	169	ASTC_8x6_UNORM_BLOCK
3342>0	ulelong	170	ASTC_8x6_SRGB_BLOCK
3343>0	ulelong	171	ASTC_8x8_UNORM_BLOCK
3344>0	ulelong	172	ASTC_8x8_SRGB_BLOCK
3345>0	ulelong	173	ASTC_10x5_UNORM_BLOCK
3346>0	ulelong	174	ASTC_10x5_SRGB_BLOCK
3347>0	ulelong	175	ASTC_10x6_UNORM_BLOCK
3348>0	ulelong	176	ASTC_10x6_SRGB_BLOCK
3349>0	ulelong	177	ASTC_10x8_UNORM_BLOCK
3350>0	ulelong	178	ASTC_10x8_SRGB_BLOCK
3351>0	ulelong	179	ASTC_10x10_UNORM_BLOCK
3352>0	ulelong	180	ASTC_10x10_SRGB_BLOCK
3353>0	ulelong	181	ASTC_12x10_UNORM_BLOCK
3354>0	ulelong	182	ASTC_12x10_SRGB_BLOCK
3355>0	ulelong	183	ASTC_12x12_UNORM_BLOCK
3356>0	ulelong	184	ASTC_12x12_SRGB_BLOCK
3357
3358>0	ulelong	1000156000	G8B8G8R8_422_UNORM
3359>0	ulelong	1000156001	B8G8R8G8_422_UNORM
3360>0	ulelong	1000156002	G8_B8_R8_3PLANE_420_UNORM
3361>0	ulelong	1000156003	G8_B8R8_2PLANE_420_UNORM
3362>0	ulelong	1000156004	G8_B8_R8_3PLANE_422_UNORM
3363>0	ulelong	1000156005	G8_B8R8_2PLANE_422_UNORM
3364>0	ulelong	1000156006	G8_B8_R8_3PLANE_444_UNORM
3365>0	ulelong	1000156007	R10X6_UNORM_PACK16
3366>0	ulelong	1000156008	R10X6G10X6_UNORM_2PACK16
3367>0	ulelong	1000156009	R10X6G10X6B10X6A10X6_UNORM_4PACK16
3368>0	ulelong	1000156010	G10X6B10X6G10X6R10X6_422_UNORM_4PACK16
3369>0	ulelong	1000156011	B10X6G10X6R10X6G10X6_422_UNORM_4PACK16
3370>0	ulelong	1000156012	G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16
3371>0	ulelong	1000156013	G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16
3372>0	ulelong	1000156014	G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16
3373>0	ulelong	1000156015	G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16
3374>0	ulelong	1000156016	G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16
3375>0	ulelong	1000156017	R12X4_UNORM_PACK16
3376>0	ulelong	1000156018	R12X4G12X4_UNORM_2PACK16
3377>0	ulelong	1000156019	R12X4G12X4B12X4A12X4_UNORM_4PACK16
3378>0	ulelong	1000156020	G12X4B12X4G12X4R12X4_422_UNORM_4PACK16
3379>0	ulelong	1000156021	B12X4G12X4R12X4G12X4_422_UNORM_4PACK16
3380>0	ulelong	1000156022	G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16
3381>0	ulelong	1000156023	G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16
3382>0	ulelong	1000156024	G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16
3383>0	ulelong	1000156025	G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16
3384>0	ulelong	1000156026	G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16
3385>0	ulelong	1000156027	G16B16G16R16_422_UNORM
3386>0	ulelong	1000156028	B16G16R16G16_422_UNORM
3387>0	ulelong	1000156029	G16_B16_R16_3PLANE_420_UNORM
3388>0	ulelong	1000156030	G16_B16R16_2PLANE_420_UNORM
3389>0	ulelong	1000156031	G16_B16_R16_3PLANE_422_UNORM
3390>0	ulelong	1000156032	G16_B16R16_2PLANE_422_UNORM
3391>0	ulelong	1000156033	G16_B16_R16_3PLANE_444_UNORM
3392
3393>0	ulelong	1000054000	PVRTC1_2BPP_UNORM_BLOCK_IMG
3394>0	ulelong	1000054001	PVRTC1_4BPP_UNORM_BLOCK_IMG
3395>0	ulelong	1000054002	PVRTC2_2BPP_UNORM_BLOCK_IMG
3396>0	ulelong	1000054003	PVRTC2_4BPP_UNORM_BLOCK_IMG
3397>0	ulelong	1000054004	PVRTC1_2BPP_SRGB_BLOCK_IMG
3398>0	ulelong	1000054005	PVRTC1_4BPP_SRGB_BLOCK_IMG
3399>0	ulelong	1000054006	PVRTC2_2BPP_SRGB_BLOCK_IMG
3400>0	ulelong	1000054007	PVRTC2_4BPP_SRGB_BLOCK_IMG
3401
3402>0	ulelong	1000066000	ASTC_4x4_SFLOAT_BLOCK_EXT
3403>0	ulelong	1000066001	ASTC_5x4_SFLOAT_BLOCK_EXT
3404>0	ulelong	1000066002	ASTC_5x5_SFLOAT_BLOCK_EXT
3405>0	ulelong	1000066003	ASTC_6x5_SFLOAT_BLOCK_EXT
3406>0	ulelong	1000066004	ASTC_6x6_SFLOAT_BLOCK_EXT
3407>0	ulelong	1000066005	ASTC_8x5_SFLOAT_BLOCK_EXT
3408>0	ulelong	1000066006	ASTC_8x6_SFLOAT_BLOCK_EXT
3409>0	ulelong	1000066007	ASTC_8x8_SFLOAT_BLOCK_EXT
3410>0	ulelong	1000066008	ASTC_10x5_SFLOAT_BLOCK_EXT
3411>0	ulelong	1000066009	ASTC_10x6_SFLOAT_BLOCK_EXT
3412>0	ulelong	1000066010	ASTC_10x8_SFLOAT_BLOCK_EXT
3413>0	ulelong	1000066011	ASTC_10x10_SFLOAT_BLOCK_EXT
3414>0	ulelong	1000066012	ASTC_12x10_SFLOAT_BLOCK_EXT
3415>0	ulelong	1000066013	ASTC_12x12_SFLOAT_BLOCK_EXT
3416
3417# Main KTX2 header.
34180	string	\xABKTX\ 20\xBB\r\n\x1A\n	Khronos KTX2 texture
3419>20	ulelong	x	\b, %u
3420>24	ulelong	>1	x %u
3421>28	ulelong	>1	x %u
3422>32	ulelong	>1	\b, %u layers
3423>36	ulelong	>1	\b, %u faces
3424>40	ulelong	>1	\b, %u mipmaps
3425>44	ulelong	>0	\b,
3426>>44	use	khronos-ktx2-supercompression
3427>12	ulelong	>0	\b,
3428>>12	use	khronos-ktx2-vkFormat
3429
3430# Type: Valve VTF texture.
3431# From: David Korth <gerbilsoft@gerbilsoft.com>
3432# References:
3433# - https://developer.valvesoftware.com/wiki/Valve_Texture_Format
3434
3435# VTF image formats.
34360	name	vtf-image-format
3437>0	ulelong	0	RGBA8888
3438>0	ulelong	1	ABGR8888
3439>0	ulelong	2	RGB888
3440>0	ulelong	3	BGR888
3441>0	ulelong	4	RGB565
3442>0	ulelong	5	I8
3443>0	ulelong	6	IA88
3444>0	ulelong	7	P8
3445>0	ulelong	8	A8
3446>0	ulelong	9	RGB888 (bluescreen)
3447>0	ulelong	10	BGR888 (bluescreen)
3448>0	ulelong	11	ARGB8888
3449>0	ulelong	12	BGRA8888
3450>0	ulelong	13	DXT1
3451>0	ulelong	14	DXT3
3452>0	ulelong	15	DXT5
3453>0	ulelong	16	BGRx8888
3454>0	ulelong	17	BGR565
3455>0	ulelong	18	BGRx5551
3456>0	ulelong	19	BGRA4444
3457>0	ulelong	20	DXT1+A1
3458>0	ulelong	21	BGRA5551
3459>0	ulelong	22	UV88
3460>0	ulelong	23	UVWQ8888
3461>0	ulelong	24	RGBA16161616F
3462>0	ulelong	25	RGBA16161616
3463>0	ulelong	26	UVLX8888
3464
3465# Main VTF header.
34660	string	VTF\0				Valve Texture Format
3467>4	ulelong	x				v%u
3468>8	ulelong	x				\b.%u
3469>0x10	uleshort	x				\b, %u
3470>0x12	uleshort	>1				x %u
3471>4	lequad	0x0000000700000002
3472>>0x3F	uleshort	>1				x %u
3473>0x18	uleshort	>1				\b, %u frames
3474>0x38	ubyte	x				\b, mipmaps: %u
3475>0x34	ulelong	>-1				\b,
3476>>0x34	use	vtf-image-format
3477
3478# Type: Valve VTF3 (PS3) texture.
3479# From: David Korth <gerbilsoft@gerbilsoft.com>
34800	string		VTF3	Valve Texture Format (PS3)
3481>0x14	ubeshort		x	\b, %u
3482>0x16	ubeshort		x	\b x %u
3483>0x10	ubelong&0x2000	0	\b, DXT1
3484>0x10	ubelong&0x2000	0x2000	\b, DXT5
3485
3486# Type: ASTC texture.
3487# From: David Korth <gerbilsoft@gerbilsoft.com>
3488# References:
3489# - https://stackoverflow.com/questions/22600678/determine-internal-format-of-given-astc-compressed-image-through-its-header
3490# - https://stackoverflow.com/a/22682244
34910	ulelong	0x5ca1ab13			ASTC
3492>4	ubyte	x				%u
3493>5	ubyte	x				\bx%u
3494>6	ubyte	>1				\bx%u
3495# X, Y, and Z dimensions are stored as 24-bit LE.
3496# Pretend it's 32-bit and mask off the high byte.
3497>7	ulelong&0x00FFFFFF	x		texture, %u
3498>10	ulelong&0x00FFFFFF	x		x %u
3499>13	ulelong&0x00FFFFFF	>1		x %u
3500
3501# Zebra Metafile graphic
3502# http://www.fileformat.info/format/zbr/egff.htm
35030	ubeshort	0x9a02	Zebra Metafile graphic
3504>2	uleshort 1	(version 1.x)
3505>2	uleshort	2	(version 1.1x or 1.2x)
3506>2	uleshort	3	(version 1.49)
3507>2	uleshort	4	(version 1.50)
3508>4	string	x	(comment = %s)
3509
3510# Microsoft Paint graphic
3511# http://www.fileformat.info/format/mspaint/egff.htm
35120	string	DanM 	icrosoft Paint image data (version 1.x)
3513>4	uleshort	x	(%d
3514>>6	uleshort	x	x %d)
35150	string	LinS 	Microsoft Paint image data (version 2.0)
3516>4	uleshort	x	(%d
3517>>6	uleshort	x	x %d)
3518
3519# reMarkable tablet internal file format (https://www.remarkable.com/)
3520# https://github.com/ax3l/lines-are-beautiful
3521# https://plasma.ninja/blog/devices/remarkable/binary/format/2017/12/26/\
3522#	reMarkable-lines-file-format.html#what-to-do-next
3523# from Axel Huebl
35240		string	reMarkable
3525>11		string	lines
3526>>17		string	with
3527>>>22		string	selections
3528>>>>33		string	and
3529>>>>>37		string	layers
3530>>>>>>43	ulelong	x	reMarkable tablet notebook lines, 1404 x 1872, %x page(s)
3531
3532# newer per-page files for the reMarkable
35330		string	reMarkable
3534>11		string	.lines
3535>>18		string	file,
3536>>>24		string	version=
3537>>>>32		ubyte	x	reMarkable tablet page (v%c), 1404 x 1872,
3538>>>>>43		ulelong	x	%d layer(s)
3539
3540# Type: PVR3 texture.
3541# From: David Korth <gerbilsoft@gerbilsoft.com>
3542# References:
3543# - http://cdn.imgtec.com/sdk-documentation/PVR+File+Format.Specification.pdf
3544
3545# PVR3 pixel formats.
35460	name		pvr3-pixel-format
3547>0	ulelong	0	PVRTC 2bpp RGB
3548>0	ulelong	1	PVRTC 2bpp RGBA
3549>0	ulelong	2	PVRTC 4bpp RGB
3550>0	ulelong	3	PVRTC 4bpp RGBA
3551>0	ulelong	4	PVRTC-II 2bpp
3552>0	ulelong	5	PVRTC-II 4bpp
3553>0	ulelong	6	ETC1
3554>0	ulelong	7	DXT1
3555>0	ulelong	8	DXT2
3556>0	ulelong	9	DXT3
3557>0	ulelong	10	DXT4
3558>0	ulelong	11	DXT5
3559>0	ulelong	12	BC4
3560>0	ulelong	13	BC5
3561>0	ulelong	14	BC6
3562>0	ulelong	15	BC7
3563>0	ulelong	16	UYVY
3564>0	ulelong	17	YUY2
3565>0	ulelong	18	BW1bpp
3566>0	ulelong	19	R9G9B9E5 Shared Exponent
3567>0	ulelong	20	RGBG8888
3568>0	ulelong	21	GRGB8888
3569>0	ulelong	22	ETC2 RGB
3570>0	ulelong	23	ETC2 RGBA
3571>0	ulelong	24	ETC2 RGB A1
3572>0	ulelong	25	EAC R11
3573>0	ulelong	26	EAC RG11
3574>0	ulelong	27	ASTC_4x4
3575>0	ulelong	28	ASTC_5x4
3576>0	ulelong	29	ASTC_5x5
3577>0	ulelong	30	ASTC_6x5
3578>0	ulelong	31	ASTC_6x6
3579>0	ulelong	32	ASTC_8x5
3580>0	ulelong	33	ASTC_8x6
3581>0	ulelong	34	ASTC_8x8
3582>0	ulelong	35	ASTC_10x5
3583>0	ulelong	36	ASTC_10x6
3584>0	ulelong	37	ASTC_10x8
3585>0	ulelong	38	ASTC_10x10
3586>0	ulelong	39	ASTC_12x10
3587>0	ulelong	40	ASTC_12x12
3588>0	ulelong	41	ASTC_3x3x3
3589>0	ulelong	42	ASTC_4x3x3
3590>0	ulelong	43	ASTC_4x4x3
3591>0	ulelong	44	ASTC_4x4x4
3592>0	ulelong	45	ASTC_5x4x4
3593>0	ulelong	46	ASTC_5x5x4
3594>0	ulelong	47	ASTC_5x5x5
3595>0	ulelong	48	ASTC_6x5x5
3596>0	ulelong	49	ASTC_6x6x5
3597>0	ulelong	50	ASTC_6x6x6
3598
35990	string		PVR\x03			PowerVR 3.0 texture:
3600>0x18	ulelong		x	%u x
3601>0x1C	ulelong		x	%u
3602>0x20	ulelong		>1	x %u
3603>0x08	ubyte		x	\b,
3604>0x0C	ulelong		0
3605>>0x08	use	pvr3-pixel-format
3606>0x0C	ulelong		!0
3607>>0x08	ubyte	!0	%c
3608>>>0x0C	ubyte	!0	\b%u
3609>>0x09	ubyte	!0	\b%c
3610>>>0x0D	ubyte	!0	\b%u
3611>>0x0A	ubyte	!0	\b%c
3612>>>0x0E	ubyte	!0	\b%u
3613>>0x0B	ubyte	!0	\b%c
3614>>>0x0F	ubyte	!0	\b%u
3615>0x10	ulelong		1	\b, sRGB
3616>0x04	ulelong&0x02	0x02	\b, premultiplied alpha
3617
36180	string		\x03RVP			PowerVR 3.0 texture: BE,
3619>0x18	ubelong		x	%u x
3620>0x1C	ubelong		x	%u
3621>0x20	ubelong		>1	x %u
3622>0x08	ubyte		x	\b,
3623>0x0C	ubelong		0
3624>>0x08	use	pvr3-pixel-format
3625>0x0C	ubelong		!0
3626>>0x0B	ubyte	!0	%c
3627>>>0x0F	ubyte	!0	\b%u
3628>>0x0A	ubyte	!0	\b%c
3629>>>0x0E	ubyte	!0	\b%u
3630>>0x09	ubyte	!0	\b%c
3631>>>0x0D	ubyte	!0	\b%u
3632>>0x08	ubyte	!0	\b%c
3633>>>0x0C	ubyte	!0	\b%u
3634>0x10	ubelong		1	\b, sRGB
3635>0x04	ubelong&0x02	0x02	\b, premultiplied alpha
3636
3637# Type: Microsoft Xbox XPR0 texture.
3638# From: David Korth <gerbilsoft@gerbilsoft.com>
3639# References:
3640# - https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/develop/src/core/hle/D3D8/XbD3D8Types.h
3641
3642# XPR pixel formats.
36430	name	xbox-xpr-pixel-format
3644>0	ubyte	0x00	L8
3645>0	ubyte	0x01	AL8
3646>0	ubyte	0x02	ARGB1555
3647>0	ubyte	0x03	RGB555
3648>0	ubyte	0x04	ARGB4444
3649>0	ubyte	0x05	RGB565
3650>0	ubyte	0x06	ARGB8888
3651>0	ubyte	0x07	xRGB8888
3652>0	ubyte	0x0B	P8
3653>0	ubyte	0x0C	DXT1
3654>0	ubyte	0x0E	DXT2
3655>0	ubyte	0x0F	DXT4
3656>0	ubyte	0x10	Linear ARGB1555
3657>0	ubyte	0x11	Linear RGB565
3658>0	ubyte	0x12	Linear ARGB8888
3659>0	ubyte	0x13	Linear L8
3660>0	ubyte	0x16	Linear R8B8
3661>0	ubyte	0x17	Linear G8B8
3662>0	ubyte	0x19	A8
3663>0	ubyte	0x1A	A8L8
3664>0	ubyte	0x1B	Linear AL8
3665>0	ubyte	0x1C	Linear RGB555
3666>0	ubyte	0x1D	Linear ARGB4444
3667>0	ubyte	0x1E	Linear xRGB8888
3668>0	ubyte	0x1F	Linear A8
3669>0	ubyte	0x20	Linear A8L8
3670>0	ubyte	0x24	YUY2
3671>0	ubyte	0x25	UYVY
3672>0	ubyte	0x27	L6V5U5
3673>0	ubyte	0x28	V8U8
3674>0	ubyte	0x29	R8B8
3675>0	ubyte	0x2A	D24S8
3676>0	ubyte	0x2B	F24S8
3677>0	ubyte	0x2C	D16
3678>0	ubyte	0x2D	F16
3679>0	ubyte	0x2E	Linear D24S8
3680>0	ubyte	0x2F	Linear F24S8
3681>0	ubyte	0x30	Linear D16
3682>0	ubyte	0x31	Linear F16
3683>0	ubyte	0x32	L16
3684>0	ubyte	0x33	V16U16
3685>0	ubyte	0x35	Linear L16
3686>0	ubyte	0x36	Linear V16U16
3687>0	ubyte	0x37	Linear L6V5U5
3688>0	ubyte	0x38	RGBA5551
3689>0	ubyte	0x39	RGBA4444
3690>0	ubyte	0x3A	QWVU8888
3691>0	ubyte	0x3B	BGRA8888
3692>0	ubyte	0x3C	RGBA8888
3693>0	ubyte	0x3D	Linear RGBA5551
3694>0	ubyte	0x3E	Linear RGBA4444
3695>0	ubyte	0x3F	Linear ABGR8888
3696>0	ubyte	0x40	Linear BGRA8888
3697>0	ubyte	0x41	Linear RGBA8888
3698>0	ubyte	0x64	Vertex Data
3699
37000	string		XPR0	Microsoft Xbox XPR0 texture
3701>0x19	ubyte	x	\b, format:
3702>>0x19	use	xbox-xpr-pixel-format
3703
3704# ILDA Image Data Transfer Format
3705# https://www.ilda.com/resources/StandardsDocs/ILDA_IDTF14_rev011.pdf
3706#
3707# Updated by Chuck Hein (laser@geekdude.com)
3708#
37090	string		ILDA	ILDA Image Data Transfer Format
3710>7	ubyte		0x00	3D Coordinates with Indexed Color
3711>7	ubyte		0x01	2D Coordinates with Indexed Color
3712>7	ubyte		0x02	Color Palette
3713>7	ubyte		0x04	3D Coordinates with True Color
3714>7	ubyte		0x05	2D Coordinates with True Color
3715>8	string		>0	\b, palette %s
3716>16	string		>0	\b, company %s
3717>24	ubeshort	>0	\b, number of records %d
3718>>26	ubeshort	x	\b, palette number %d
3719>>28	ubeshort	>0	\b, number of frames %d
3720>>30	ubyte		>0	\b, projector number %d
3721
3722# Dropbox "lepton" compressed jpeg format
3723# https://github.com/dropbox/lepton
37240	ubelong&0xfffff0ff	0xcf84005a	Lepton image file
3725>2	ubyte			x		(version %d)
3726
3727# Apple QuickTake camera raw images
3728# https://en.wikipedia.org/wiki/Apple_QuickTake
3729# dcraw can decode them
37300	name quicktake
3731>4	ubelong		8
3732>>544	ubeshort	x	\b, %dx
3733>>546	ubeshort	x	\b%d
3734>4	ubelong		4
3735>>546	ubeshort	x	\b, %dx
3736>>544	ubeshort	x	\b%d
3737
37380	string	qktk	Apple QuickTake 100 Raw Image
3739>0	use quicktake
3740
37410	string	qktn
3742>4	ubyte	0	Apple QuickTake 150 Raw Image
3743>4	ubyte	>0	Apple QuickTake 200 Raw Image
3744>0	use quicktake
3745
3746# From:		Joerg Jenderek
3747# URL:		http://fileformats.archiveteam.org/wiki/Corel_Photo-Paint_image
3748# Reference:	http://blog.argasinski.eu/wp-content/uploads/2011/08/cpt-specification-0.01.pdf
37490	string	CPT
3750>4	string	FILE		Corel Photo-Paint image, version
3751# version like 7, 9 or 8
3752>>3	ubyte	x		%c,
3753!:mime	image/x-corel-cpt
3754!:ext	cpt
3755# if blocks_array_offset available jump blockNumber*8 bytes
3756>>0x34	ulelong		>0
3757>>>(0x28.l*8)	ubyte	x
3758# jump additional stored blocks_array_offset bytes forward to object block
3759>>>>&(0x34.l-1) ulelong x	%u
3760# object height in pixels
3761>>>>>&0		ulelong	x	x %u
3762# if no blocks_array_offset available jump blockNumber*8 bytes
3763>>0x34	ulelong		=0
3764>>>(0x28.l*8)	ubyte	x
3765# jump additional 0x13C bytes forward to object block
3766>>>>&0x13B	ulelong x	%u
3767>>>>>&0	ulelong		x	x %u
3768# image color model used
3769>>0x8	ulelong	x
3770>>>0x8	ulelong	0x1		RGB 24 bits
3771>>>0x8	ulelong	0x3		CMYK 24 bits
3772>>>0x8	ulelong	0x5		greyscale 8 bits
3773>>>0x8	ulelong	0x6		black and white 1 bit
3774>>>0x8	ulelong	0xA		RGB 8 bits
3775# palette_length  number of colors * 3 in case of 8-bit RGB paletted image
3776# 0 otherwise. Allowed values: 0 or [1..256] * 3
3777#>>0xC	ulelong	>0		\b, palette length %u
3778>>>>0xC	ulelong/3	<256	\b, %u colors
3779>>>0x8	ulelong	0xB		LAB
3780>>>0x8	ulelong	0xC		RGB 48 bits
3781>>>0x8	ulelong	0xE		greyscale 16 bits
3782# this should not happen
3783>>>0x8	default	x		color model
3784>>>>0x8	ulelong	x		%#x
3785# bit 1 in CPT file flags: UCS-2 file comment present
3786>>0x31	ubyte		&0x02
3787# look for comment marker
3788>>>0x100	search/0xc9d	\4\2\0\0
3789# UCS-2 file comment
3790>>>>&0		lestring16	x	"%s"
3791# if no UCS-2 is present show ANSI file comment[112] if available
3792>>0x31	ubyte&0x02	=0
3793>>>0x3C string		>\0	"%-.112s"
3794# reserved seems to be always 0
3795#>>0x10	ulelong		>0	\b, reserved1 %u
3796# horizontal real dpi = dpi_h * 25.4 / 10**6
3797>>0x18	ulelong	x		\b, %u micro dots/mm
3798# image vertical DPI in CPT DPI unit
3799#>>0x1C	ulelong	x		\b, %u micro dots/mm
3800# reserved seems to be always 0
3801#>>0x20	ulelong		>0	\b, reserved2 %u
3802#>>0x24	ulelong		>0	\b, reserved3 %u
3803# blocks_count; number of CPT_Block blocks. Allowed values: > 0
3804>>0x28	ulelong		x	\b, %u block
3805# plural s
3806>>0x28	ulelong		!1	\bs
3807# CPT file flags
3808# lower byte of CPT file flags: 0x94~CPT9FILE 0x01~often CPT7FILE 0x8C~CPT8FILE
3809#>>0x30	ubyte		x	\b, lower flags %#x
3810# upper byte of CPT file flags:
3811#>>0x31	ubyte		>0	\b, upper flags %#x
3812# bit 2 in CPT file flags: unknown
3813#>>0x31	ubyte		&0x04	\b, with UNKNOWN
3814# bits 3-7 in CPT file flags: unknown, seem to be often 0
3815# show unusual flag combinations
3816>>0x31	ubyte&0xFC	>0
3817>>>0x30	uleshort	x	\b, flags %#4.4x
3818# reserved seems to be always 0
3819#>>0x32	uleshort	>0	\b, reserved4 %#x
3820# blocks_array_offset is always 0 for CPT7 and CPT8 files created by PP7-PP8
3821# typical values like: 13Ch 154h 43Ch 4F0h DA8h
3822>>0x34	ulelong	x		\b, array offset %#x
3823# reserved seems to be often 0
3824>>0x38	ulelong		>0	\b, reserved5 %#x
3825# possible next master block
3826#>>0x100	ubequad		!0	\b, next block=%#llx...
3827# bit 0: ICC profile block present
3828>>0x31	ubyte		&0x01	\b, with ICC profile
3829# check for characteristic string acsp of color profile for DEBUGGING
3830#>>>0x178	string	x	icc=%.4s
3831#	display ICC/ICM color profile by ./icc
3832#>>>0x154	use		color-profile
3833
3834# Type: Crunch compressed texture.
3835# From: David Korth <gerbilsoft@gerbilsoft.com>
3836# References:
3837# - https://github.com/BinomialLLC/crunch/blob/44c8402e24441c7524ca364941fd224ab3b971e9/inc/crn_decomp.h#L267
38380	ubelong		0x4878004A	Crunch compressed texture:
3839>0x0C	ubeshort	x	%u x
3840>0x0E	ubeshort	x	%u
3841>0x12	ubyte		0	\b, DXT1
3842>0x12	ubyte		1	\b, DXT3
3843>0x12	ubyte		2	\b, DXT5
3844>0x12	ubyte		3	\b, DXT5 CCxY
3845>0x12	ubyte		4	\b, DXT5 xGxR
3846>0x12	ubyte		5	\b, DXT5 xGBR
3847>0x12	ubyte		6	\b, DXT5 AGBR
3848>0x12	ubyte		7	\b, DXn XY
3849>0x12	ubyte		8	\b, DXn YX
3850>0x12	ubyte		9	\b, DXT5 Alpha
3851>0x12	ubyte		10	\b, ETC1
3852>0x10	ubyte		>1	\b, %u images
3853>0x11	ubyte		>1	\b, %u faces
3854# TODO: Flags at 0x13? (ubeshort)
3855
3856# Type: BasisLZ compressed texture.
3857# From: David Korth <gerbilsoft@gerbilsoft.com>
3858# References:
3859# - https://github.com/BinomialLLC/basis_universal/blob/master/spec/basis_spec.txt
38600	uleshort		0x4273
3861>0x04	uleshort		0x4D	BasisLZ
3862>>0x02	uleshort		x	v%x compressed texture:
3863>>0x14	ubyte			0	ETC1S
3864>>0x14	ubyte			1	UASTC 4x4
3865>>0x0E	ulelong&0xFFFFFF	>1	\b, %u slices
3866>>0x11	ulelong&0xFFFFFF	>1	\b, %u images
3867>>0x15	uleshort&0x02		2	\b, Y-flipped
3868
3869# MIME registration: https://www.iana.org/assignments/media-types/model/e57
3870# Sample files: http://www.libe57.org/data.html
3871# Reference implementation: http://www.libe57.org/
3872# https://www.ri.cmu.edu/pub_files/2011/1/2011-huber-e57-v3.pdf
38730	string		ASTM-E57	ASTM E57 three-dimensional model
3874!:mime model/e57
3875!:ext e57
3876
3877# QOI [Quite OK Image Format] images
3878# (Horia Mihai David, mihaidavid@posteo.net)
3879#
3880# QOI format by Dominic Szablewski <http://phoboslab.org/>
3881#           <https://qoiformat.org/>
3882#
3883# Based on spec v1.0 (2022.01.05) <https://qoiformat.org/qoi-specification.pdf>
3884
38850	string		qoif	QOI image data
3886!:ext qoi
3887!:mime image/x-qoi
3888# See <https://github.com/phoboslab/qoi/issues/167>
3889>4      ubelong		x       %ux
3890>8      ubelong		x       \b%u,
3891>>13	ubyte		0	s
3892>>>12	ubyte		3	\bRGB
3893>>>12	ubyte		4	\bRGBA
3894>>>12	default		x
3895>>>>12	ubyte		x	\b*bad channels %u*
3896>>>13	ubyte		0	(linear alpha)
3897>>13	ubyte		1
3898>>>12	ubyte		3	RGB
3899>>>12	ubyte		4	RGBA
3900>>>13	ubyte		1	(all channels linear)
3901>>13	default		x
3902>>>13	ubyte		x	*bad colorspace %u*
3903
3904
3905# Type: Godot 3, 4 texture (pixel format)
3906# From: David Korth <gerbilsoft@gerbilsoft.com>
39070	name	godot-pixel-format
3908>0	ulelong&0xFFFFF	0	L8
3909>0	ulelong&0xFFFFF	1	LA8
3910>0	ulelong&0xFFFFF	2	R8
3911>0	ulelong&0xFFFFF	3	RG8
3912>0	ulelong&0xFFFFF	4	RGB8
3913>0	ulelong&0xFFFFF	5	RGBA8
3914>0	ulelong&0xFFFFF	6	RGBA4444
3915>0	ulelong&0xFFFFF	7	RGB565
3916>0	ulelong&0xFFFFF	8	RF
3917>0	ulelong&0xFFFFF	9	RGF
3918>0	ulelong&0xFFFFF	10	RGBF
3919>0	ulelong&0xFFFFF	11	RGBAF
3920>0	ulelong&0xFFFFF	12	RH
3921>0	ulelong&0xFFFFF	13	RGH
3922>0	ulelong&0xFFFFF	14	RGBH
3923>0	ulelong&0xFFFFF	15	RGBAH
3924>0	ulelong&0xFFFFF	16	RGBE9995
3925>0	ulelong&0xFFFFF	17	DXT1
3926>0	ulelong&0xFFFFF	18	DXT3
3927>0	ulelong&0xFFFFF	19	DXT5
3928>0	ulelong&0xFFFFF	20	RGTC_R
3929>0	ulelong&0xFFFFF	21	RGTC_RG
3930>0	ulelong&0xFFFFF	22	BPTC_RGBA
3931>0	ulelong&0xFFFFF	23	BPTC_RGBF
3932>0	ulelong&0xFFFFF	24	BPTC_RGBFU
3933>0	ulelong&0xFFFFF	25	PVRTC1_2
3934>0	ulelong&0xFFFFF	26	PVRTC1_2A
3935>0	ulelong&0xFFFFF	27	PVRTC1_4
3936>0	ulelong&0xFFFFF	28	PVRTC1_4A
3937>0	ulelong&0xFFFFF	29	ETC
3938>0	ulelong&0xFFFFF	30	ETC2_R11
3939>0	ulelong&0xFFFFF	31	ETC2_R11S
3940>0	ulelong&0xFFFFF	32	ETC2_RG11
3941>0	ulelong&0xFFFFF	33	ETC2_RG11S
3942>0	ulelong&0xFFFFF	34	ETC2_RGB8
3943>0	ulelong&0xFFFFF	35	ETC2_RGBA8
3944>0	ulelong&0xFFFFF	36	ETC2_RGB8A1
3945>0	ulelong&0xFFFFF	37	ASTC_8x8
3946
3947# Type: Godot 3, 4 texture (rescale display, width)
3948# From: David Korth <gerbilsoft@gerbilsoft.com>
3949# Shows rescale value if it's not a power of 2.
39500	name	godot-rescale-display-w
3951>0	uleshort	0
3952>0	uleshort	1
3953>0	uleshort	2
3954>0	uleshort	4
3955>0	uleshort	8
3956>0	uleshort	16
3957>0	uleshort	32
3958>0	uleshort	64
3959>0	uleshort	128
3960>0	uleshort	256
3961>0	uleshort	512
3962>0	uleshort	1024
3963>0	uleshort	2048
3964>0	uleshort	4096
3965>0	uleshort	8192
3966>0	uleshort	16384
3967>0	uleshort	32768
3968>0	default		x
3969>>0	uleshort	x	(rescale to %u x
3970
3971# Type: Godot 3, 4 texture (rescale display, height)
3972# From: David Korth <gerbilsoft@gerbilsoft.com>
3973# Shows rescale value if it's not a power of 2.
39740	name	godot-rescale-display-h
3975>0	clear	x
3976>0	uleshort	0
3977>0	uleshort	1
3978>0	uleshort	2
3979>0	uleshort	4
3980>0	uleshort	8
3981>0	uleshort	16
3982>0	uleshort	32
3983>0	uleshort	64
3984>0	uleshort	128
3985>0	uleshort	256
3986>0	uleshort	512
3987>0	uleshort	1024
3988>0	uleshort	2048
3989>0	uleshort	4096
3990>0	uleshort	8192
3991>0	uleshort	16384
3992>0	uleshort	32768
3993>0	default		x
3994>>0	uleshort	x	%u)
3995
3996# Type: Godot 3 texture
3997# From: David Korth <gerbilsoft@gerbilsoft.com>
3998# References:
3999# - https://github.com/godotengine/godot/blob/3.3/core/image.h
4000# - https://github.com/godotengine/godot/blob/3.3/scene/resources/texture.cpp
4001# - https://github.com/godotengine/godot/blob/3.3/scene/resources/texture.h
4002# TODO: Don't show "rescale to" if it matches the image size.
40030	string	GDST	Godot 3 texture:
4004!:ext	stex
4005!:mime	image/x-godot-stex
4006>4	uleshort	x	%u x
4007>8	uleshort	x	%u
4008>6	uleshort	0	\b,
4009>6	uleshort	!0
4010>>6	use	godot-rescale-display-w
4011>>10	use	godot-rescale-display-h
4012>>10	uleshort	x	\b,
4013>16	ulelong&0x800000	!0		has mipmaps,
4014>16	ulelong&0x100000	0x100000	lossless encoding
4015>16	ulelong&0x200000	0x200000	lossy encoding
4016>16	ulelong&0x300000	0
4017>>16	use	godot-pixel-format
4018
4019# Type: Godot 4 texture
4020# From: David Korth <gerbilsoft@gerbilsoft.com>
4021# References:
4022# - https://github.com/godotengine/godot/blob/master/core/io/image.h
4023# - https://github.com/godotengine/godot/blob/master/scene/resources/texture.cpp
4024# - https://github.com/godotengine/godot/blob/master/scene/resources/texture.h
4025# TODO: Don't show "rescale to" if it matches the image size.
40260	string	GST2	Godot 4 texture
4027!:ext	stex
4028!:mime	image/x-godot-stex
4029>4	ulelong		x	v%u:
4030>0x28	uleshort	x	%u x
4031>0x2A	uleshort	x	%u
4032>8	use	godot-rescale-display-w
4033>12	use	godot-rescale-display-h
4034>12	uleshort	x	\b,
4035>0x2C	ulelong		>1	%u mipmaps,
4036>0x30	use	godot-pixel-format
4037>0x24	ulelong		1	\b, embedded PNG image
4038>0x24	ulelong		2	\b, embedded WebP image
4039>0x24	ulelong		3	\b, Basis Universal
4040
4041# Summary:	iCEDraw graphic *.IDF
4042# URL:		http://fileformats.archiveteam.org/wiki/ICEDraw
4043# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/i/idf-icedraw.trid.xml
4044# From:		Joerg Jenderek
4045# Note:		called "iCEDraw graphic" by TrID, "iCEDraw text" by FFmpeg and "iCE Draw" by Ansilove
4046#		verified by FFmpeg command `ffprobe ICE-9605.IDF` and `ansilove -s SQ-FORCE.IDF`
40470	string		\0041.4\0\0\0\0O\0	iCEDraw graphic
4048#!:mime	application/octet-stream
4049!:mime	image/x-idf
4050!:ext	idf
4051