xref: /freebsd/contrib/file/magic/Magdir/images (revision ae316d1d1cffd71ab7751f94e10118777a88e027)
1
2#------------------------------------------------------------------------------
3# $File: images,v 1.263 2024/11/10 20:44:30 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#      https://en.wikipedia.org/wiki/Truevision_TGA
17# Reference: http://www.dca.fee.unicamp.br/~martino/disciplinas/ea978/tgaffs.pdf
18# Update: Joerg Jenderek February 2024
19# Note:		called by DROID "Truevision TGA Bitmap" version 1.0 via PUID x-fmt/367
20# at 2, byte ImgType must be 1, 2, 3, 9, 10 or 11
21#	,32 or 33 (both not observed)
22# at 1, byte CoMapType must be 1 if ImgType is 1 or 9, 0 otherwise
23#	or theoretically 2-128 reserved for use by Truevision or 128-255 may be used for developer applications
24# at 3, leshort Index is 0 for povray, ppmtotga and xv outputs
25# `xv' recognizes only a subset of the following (RGB with pixelsize = 24)
26# `tgatoppm' recognizes a superset (Index may be anything)
27#
28# test of Color Map Type 0~no 1~color map
29# and Image Type 1 2 3 9 10 11 32 33
30# and Color Map Entry Size 0 15 16 24 32
310	ubequad&0x00FeC400000000C0	0
32# Targa image data (strength=70=110-40) before some Commodore disc image (strength=70=70+0 ./c64) like Cabal+2-MarioSoft(1).d64
33# and some MMDF mailbox (strength=70=70+0 ./mmdf) like uupc.input.1
34# Conflict with MPEG sequences.
35!:strength -40
36# Prevent conflicts with CRI ADX.
37#>(2.S-2) belong	!0x28632943
38# above line does not work for rgb32_top_left_rle.tga
39# skip some MPEG sequence *.vob and some CRI ADX audio with improbable interleave bits
40>17	ubyte&0xC0		!0xC0
41# skip more garbage like *.iso by looking for positive image type
42>>2	ubyte			>0
43# skip some compiled terminfo like xterm+tmux by looking for image type less equal 33
44>>>2	ubyte			<34
45# skip some MPEG sequence *.vob HV001T01.EVO winnicki.mpg with unacceptable alpha channel depth 11
46>>>>17	ubyte&0x0F		!11
47# skip arches.3200 , Finder.Root , Slp.1 by looking for low pixel depth 1 8 15 16 24 32
48>>>>>16	ubyte			1
49# skip few Commodore D64 disc image like "The Great Gianna Sisters.d64" and
50# few MMDF mailbox like uupc.input.1 with unlikely black&white, dimension 0101h x 0101h (257x257) and +0101h origin (+257 +257)
51>>>>>>8	quad			!0x0101010101010101
52>>>>>>>0	use		tga-image
53>>>>>16	ubyte			8
54>>>>>>0		use		tga-image
55>>>>>16	ubyte			15
56>>>>>>0		use		tga-image
57>>>>>16	ubyte			16
58>>>>>>0		use		tga-image
59>>>>>16	ubyte			24
60>>>>>>0		use		tga-image
61>>>>>16	ubyte			32
62>>>>>>0		use		tga-image
63#	display tga bitmap image information
640	name				tga-image
65>2	ubyte		<34		Targa image data
66!:mime	image/x-tga
67# Apple Uniform Type Identifier:	com.truevision.tga-image
68!:apple	????TPIC
69# normal extension .tga but some Truevision products used others:
70# tpic (Apple),icb (Image Capture Board),vda (Video Display Adapter),vst (NuVista),win (UNSURE about that)
71# afi bpx
72!:ext	tga/tpic/icb/vda/vst
73# image type 1 2 3 9 10 11 32 33
74>2	ubyte&0xF7	1		- Map
75>2	ubyte&0xF7	2		- RGB
76# alpha channel
77>>17	ubyte&0x0F	>0		\bA
78>2	ubyte&0xF7	3		- Mono
79# type not found, but by http://www.fileformat.info/format/tga/corion.htm
80# Compressed color-mapped data, using Huffman, Delta, and runlength encoding
81>2	ubyte		32		- Color
82# Compressed color-mapped data, using Huffman, Delta, and RLE. 4-pass quadtree- type process
83>2	ubyte		33		- Color
84# Color Map Type 0~no 1~color map
85>1	ubyte		1		(
86# first color map entry, 0 normal
87>>3	uleshort	>0		\b%d-
88# color map length 0 2 1dh 3bh d9h 100h
89>>5	uleshort	x		\b%d)
90# 8~run length encoding bit
91>2	ubyte&0x08	8		- RLE
92# gimp can create big pictures!
93>12	uleshort	>0		%d x
94>12	uleshort	=0		65536 x
95# image height. 0 interpreted as 65536
96>14	uleshort	>0		%d
97>14	uleshort	=0		65536
98# Image Pixel depth 1 8 15 16 24 32
99>16	ubyte		x		x %d
100# X origin of image. 0 normal
101>8	uleshort	>0		+%d
102# Y origin of image. 0 normal; positive for top
103>10	uleshort	>0		+%d
104# Image descriptor: bits 3-0 give the alpha channel depth, bits 5-4 give direction
105# alpha depth like: 1 8
106>17	ubyte&0x0F	>0		- %d-bit alpha
107# bits 5-4 give direction. normal bottom left
108>17	ubyte		&0x20		- top
109#>17	ubyte		^0x20		- bottom
110>17	ubyte		&0x10		- right
111#>17	ubyte		^0x10		- left
112# some info say other bits 6-7 should be zero
113# but data storage interleave by http://www.fileformat.info/format/tga/corion.htm
114# 00 - no interleave;01 - even/odd interleave; 10 - four way interleave; 11 - reserved
115#>17	ubyte&0xC0	0x00		- no interleave
116>17	ubyte&0xC0	0x40		- interleave
117>17	ubyte&0xC0	0x80		- four way interleave
118>17	ubyte&0xC0	0xC0		- reserved
119# positive length implies identification field
120>0	ubyte		>0
121>>18	string		x		"%s"
122# Note:		called by DROID "Truevision TGA Bitmap" version 2.0 via fmt/402
123# last 18 bytes of newer tga file footer signature
124>18	search/4261301/s	TRUEVISION-XFILE.\0
125# extension area offset if not 0
126>>&-8		ulelong			>0
127# length of the extension area. normal 495 for version 2.0
128>>>(&-4.l)	uleshort		0x01EF
129# AuthorName[41]
130>>>>&0		string			>\0		- author "%-.40s"
131# Comment[324]=4 * 80 null terminated
132>>>>&41		string			>\0		- comment "%-.80s"
133# date
134>>>>&365	ubequad&0xffffFFFFffff0000	!0
135# Day
136>>>>>&-6	uleshort		x		%d
137# Month
138>>>>>&-8	uleshort		x		\b-%d
139# Year
140>>>>>&-4	uleshort		x		\b-%d
141# time
142>>>>&371	ubequad&0xffffFFFFffff0000	!0
143# hour
144>>>>>&-8	uleshort		x		%d
145# minutes
146>>>>>&-6	uleshort		x		\b:%.2d
147# second
148>>>>>&-4	uleshort		x		\b:%.2d
149# JobName[41]
150>>>>&377	string			>\0		- job "%-.40s"
151# JobHour Jobminute Jobsecond
152>>>>&418	ubequad&0xffffFFFFffff0000	!0
153>>>>>&-8	uleshort		x		%d
154>>>>>&-6	uleshort		x		\b:%.2d
155>>>>>&-4	uleshort		x		\b:%.2d
156# SoftwareId[41]
157>>>>&424	string			>\0		- %-.40s
158# SoftwareVersionNumber
159>>>>&424	ubyte			>0
160>>>>>&40	uleshort/100		x		%d
161>>>>>&40	uleshort%100		x		\b.%d
162# VersionLetter
163>>>>>&42	ubyte			>0x20		\b%c
164# KeyColor
165>>>>&468	ulelong			>0		- keycolor %#8.8x
166# Denominator of Pixel ratio. 0~no pixel aspect
167>>>>&474	uleshort		>0
168# Numerator
169>>>>>&-4	uleshort		>0		- aspect %d
170>>>>>&-2	uleshort		x		\b/%d
171# Denominator of Gamma ratio. 0~no Gamma value
172>>>>&478	uleshort		>0
173# Numerator
174>>>>>&-4	uleshort		>0		- gamma %d
175>>>>>&-2	uleshort		x		\b/%d
176# ColorOffset
177#>>>>&480	ulelong			x		- col offset %#8.8x
178# StampOffset
179#>>>>&484	ulelong			x		- stamp offset %#8.8x
180# ScanOffset
181#>>>>&488	ulelong			x		- scan offset %#8.8x
182# AttributesType
183#>>>>&492	ubyte			x		- Attributes %#x
184## EndOfTGA
185
186# PBMPLUS images
187# URL: 		https://en.wikipedia.org/wiki/Netpbm
188# The next byte following the magic is always whitespace.
189# adding 65 to strength so that Netpbm images comes before "x86 boot sector" or
190# "DOS/MBR boot sector" identified by ./filesystems
1910	name		netpbm
192>3	regex/s		=\^[0-9]{1,50}[\040\t\f\r\n]+[0-9]{1,50}	Netpbm image data
193>>&0	regex		=[0-9]{1,50} 			\b, size = %s x
194>>>&0	regex		=[0-9]{1,50}			\b %s
195
1960	search/1	P1
197# test for whitespace after 2 byte magic
198>2	regex/2		[\040\t\f\r\n]
199# skip DROID x-fmt-164-signature-id-583.pbm with ten 0 digits
200>>3	string		!000000000
201>>>0	use		netpbm
202>>>0	string		x	\b, bitmap
203!:strength + 65
204!:mime	image/x-portable-bitmap
205!:ext	pbm
206# check for character # starting a comment line
207>>>3	ubyte		=0x23
208>>>>4	string		x	%s
209
2100	search/1	P2
211>0	regex/4		P2[\040\t\f\r\n]
212>>0	use		netpbm
213>>0	string		x	\b, greymap
214!:strength + 65
215# american spelling gray
216!:mime	image/x-portable-graymap
217!:ext	pgm
218
2190	search/1	P3
220>0	regex/4		P3[\040\t\f\r\n]
221>>0	use		netpbm
222>>0	string		x	\b, pixmap
223!:strength + 65
224!:mime	image/x-portable-pixmap
225!:ext	ppm
226
2270	string		P4
228>0	regex/4		P4[\040\t\f\r\n]
229>>0	use		netpbm
230>>0	string		x	\b, rawbits, bitmap
231!:strength + 65
232!:mime	image/x-portable-bitmap
233!:ext	pbm
234
2350	string		P5
236>0	regex/4		P5[\040\t\f\r\n]
237>>0	use		netpbm
238>>0	string		x	\b, rawbits, greymap
239!:strength + 65
240!:mime	image/x-portable-greymap
241!:ext	pgm
242
2430	string		P6
244>0	regex/4		P6[\040\t\f\r\n]
245>>0	use		netpbm
246>>0	string		x	\b, rawbits, pixmap
247!:strength + 65
248!:mime	image/x-portable-pixmap
249!:ext	ppm/pnm
250
251# URL: 		https://en.wikipedia.org/wiki/Netpbm#PAM_graphics_format
252# Reference:	http://fileformats.archiveteam.org/wiki/Portable_Arbitrary_Map
253# Update:	Joerg Jenderek
2540	string		P7
255# skip DROID fmt-405-signature-id-589.pam by looking for character like New Line
256>2	ubyte		!0xAB
257#>2	ubyte		=0x0A
258>>3	search/256/b	WIDTH		Netpbm PAM image file, size =
259!:mime	image/x-portable-arbitrarymap
260!:ext	pam
261!:strength + 65
262>>>&1	string		x		%s
263>>>3	search/256/b	HEIGHT		x
264>>>>&1	string		x		%s
265# at offset 2 a New Line character (0xA) should appear
266>>>2	ubyte		!0x0A		\b, %#x at offset 2 instead new line
267
268# From: bryanh@giraffe-data.com (Bryan Henderson)
2690	string		\117\072	Solitaire Image Recorder format
270>4	string		\013		MGI Type 11
271>4	string		\021		MGI Type 17
2720	string		.MDA		MicroDesign data
273>21	ubyte		48		version 2
274>21	ubyte		51		version 3
2750	string		.MDP		MicroDesign page data
276>21	ubyte		48		version 2
277>21	ubyte		51		version 3
278
279# NIFF (Navy Interchange File Format, a modification of TIFF) images
280# [GRR:  this *must* go before TIFF]
2810	string		IIN1		NIFF image data
282!:mime	image/x-niff
283
284# Canon RAW version 1 (CRW) files are a type of Canon Image File Format
285# (CIFF) file. These are apparently all little-endian.
286# From: Adam Buchbinder <adam.buchbinder@gmail.com>
287# URL: https://www.sno.phy.queensu.ca/~phil/exiftool/canon_raw.html
2880	string		II\x1a\0\0\0HEAPCCDR	Canon CIFF raw image data
289!:mime	image/x-canon-crw
290>16	uleshort	x	\b, version %d.
291>14	uleshort	x	\b%d
292
293# Canon RAW version 2 (CR2) files are a kind of TIFF with an extra magic
294# number. Put this above the TIFF test to make sure we detect them.
295# These are apparently all little-endian.
296# From: Adam Buchbinder <adam.buchbinder@gmail.com>
297# URL: https://libopenraw.freedesktop.org/wiki/Canon_CR2
2980	string		II\x2a\0\x10\0\0\0CR	Canon CR2 raw image data
299!:mime	image/x-canon-cr2
300!:strength +80
301>10	ubyte		x	\b, version %d.
302>11	ubyte		x	\b%d
303
304# Fujifilm RAF RAW image files with embedded JPEG data and compressed
305# or uncompressed CFA RAW data. Byte order: Big Endian.
306# URL: https://libopenraw.freedesktop.org/formats/raf/
307# Useful info from http://fileformats.archiveteam.org/wiki/Fujifilm_RAF.
308# File extension: RAF
309# Works for both the FinePix S2 Pro and the X-T3. Anybody have some more Fuji
310# raw samples available?
311# -- David Dyer-Bennet <dd-b@dd-b.net> 9-Sep-2021
3120	string		FUJIFILMCCD-RAW		Fujifilm RAF raw image data
313!:mime  image/x-fuji-raf
314!:ext	raf
315>0x10	string		x			\b, format version %4.4s
316>0x1C	string		x			\b, camera %s
317
318# Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
319# The second word of TIFF files is the TIFF version number, 42, which has
320# never changed.  The TIFF specification recommends testing for it.
3210	string		MM\x00\x2a	TIFF image data, big-endian
322!:strength +70
323!:mime	image/tiff
324!:ext	tif/tiff
325>(4.L)	use		\^tiff_ifd
3260	string		II\x2a\x00	TIFF image data, little-endian
327!:mime	image/tiff
328!:strength +70
329!:ext	tif/tiff
330>(4.l)	use		tiff_ifd
331
3320	name		tiff_ifd
333>0	uleshort	x		\b, direntries=%d
334>2	use		tiff_entry
335
3360	name		tiff_entry
337# NewSubFileType
338>0	uleshort	0xfe
339>>12	use		tiff_entry
340# Width
341>0	uleshort	0x100
342>>4	ulelong		1
343>>>8	uleshort	x		\b, width=%d
344>>>12	use		tiff_entry
345# Height
346>0	uleshort	0x101
347>>4	ulelong		1
348>>>8	uleshort	x		\b, height=%d
349>>>12	use		tiff_entry
350# BPS
351>0	uleshort	0x102
352>>8	uleshort	x		\b, bps=%d
353>>12	use		tiff_entry
354# Compression
355>0	uleshort	0x103
356>>4	ulelong		1		\b, compression=
357>>>8	uleshort	1		\bnone
358>>>8	uleshort	2		\bhuffman
359>>>8	uleshort	3		\bbi-level group 3
360>>>8	uleshort	4		\bbi-level group 4
361>>>8	uleshort	5		\bLZW
362>>>8	uleshort	6		\bJPEG (old)
363>>>8	uleshort	7		\bJPEG
364>>>8	uleshort	8		\bdeflate
365>>>8	uleshort	9		\bJBIG, ITU-T T.85
366>>>8	uleshort	0xa		\bJBIG, ITU-T T.43
367>>>8	uleshort	0x7ffe		\bNeXT RLE 2-bit
368>>>8	uleshort	0x8005		\bPackBits (Macintosh RLE)
369>>>8	uleshort	0x8029		\bThunderscan RLE
370>>>8	uleshort	0x807f		\bRasterPadding (CT or MP)
371>>>8	uleshort	0x8080		\bRLE (Line Work)
372>>>8	uleshort	0x8081		\bRLE (High-Res Cont-Tone)
373>>>8	uleshort	0x8082		\bRLE (Binary Line Work)
374>>>8	uleshort	0x80b2		\bDeflate (PKZIP)
375>>>8	uleshort	0x80b3		\bKodak DCS
376>>>8	uleshort	0x8765		\bJBIG
377>>>8	uleshort	0x8798		\bJPEG2000
378>>>8	uleshort	0x8799		\bNikon NEF Compressed
379>>>8	default		x
380>>>>8	uleshort	x		\b(unknown %#x)
381>>>12	use		tiff_entry
382# Photometric Interpretation
383>0	uleshort	0x106		\b, PhotometricInterpretation=
384>>8	clear		x
385>>8	uleshort	0		\bWhiteIsZero
386>>8	uleshort	1		\bBlackIsZero
387>>8	uleshort	2		\bRGB
388>>8	uleshort	3		\bRGB Palette
389>>8	uleshort	4		\bTransparency Mask
390>>8	uleshort	5		\bCMYK
391>>8	uleshort	6		\bYCbCr
392>>8	uleshort	8		\bCIELab
393>>8	default		x
394>>>8	uleshort	x		\b(unknown=%#x)
395>>12	use		tiff_entry
396# FillOrder
397>0	uleshort	0x10a
398>>4	ulelong		1
399>>>12	use		tiff_entry
400# DocumentName
401>0	uleshort	0x10d
402>>(8.l)	string		x		\b, name=%s
403>>>12	use		tiff_entry
404# ImageDescription
405>0	uleshort	0x10e
406>>(8.l)	string		x		\b, description=%s
407>>>12	use		tiff_entry
408# Make
409>0	uleshort	0x10f
410>>(8.l)	string		x		\b, manufacturer=%s
411>>>12	use		tiff_entry
412# Model
413>0	uleshort	0x110
414>>(8.l)	string		x		\b, model=%s
415>>>12	use		tiff_entry
416# StripOffsets
417>0	uleshort	0x111
418>>12	use		tiff_entry
419# Orientation
420>0	uleshort	0x112		\b, orientation=
421>>8	uleshort	1		\bupper-left
422>>8	uleshort	3		\blower-right
423>>8	uleshort	6		\bupper-right
424>>8	uleshort	8		\blower-left
425>>8	uleshort	9		\bundefined
426>>8	default		x
427>>>8	uleshort	x		\b[*%d*]
428>>12	use		tiff_entry
429# XResolution
430>0	uleshort	0x11a
431>>8	ulelong		x		\b, xresolution=%d
432>>12	use		tiff_entry
433# YResolution
434>0	uleshort	0x11b
435>>8	ulelong		x		\b, yresolution=%d
436>>12	use		tiff_entry
437# ResolutionUnit
438>0	uleshort	0x128
439>>8	uleshort	x		\b, resolutionunit=%d
440>>12	use		tiff_entry
441# Software
442>0	uleshort	0x131
443>>(8.l)	string		x		\b, software=%s
444>>12	use		tiff_entry
445# Datetime
446>0	uleshort	0x132
447>>(8.l)	string		x		\b, datetime=%s
448>>12	use		tiff_entry
449# HostComputer
450>0	uleshort	0x13c
451>>(8.l)	string		x		\b, hostcomputer=%s
452>>12	use		tiff_entry
453# WhitePoint
454>0	uleshort	0x13e
455>>12	use		tiff_entry
456# PrimaryChromaticities
457>0	uleshort	0x13f
458>>12	use		tiff_entry
459# YCbCrCoefficients
460>0	uleshort	0x211
461>>12	use		tiff_entry
462# YCbCrPositioning
463>0	uleshort	0x213
464>>12	use		tiff_entry
465# ReferenceBlackWhite
466>0	uleshort	0x214
467>>12	use		tiff_entry
468# Copyright
469>0	uleshort	0x8298
470>>(8.l)	string		x		\b, copyright=%s
471>>12	use		tiff_entry
472# ExifOffset
473>0	uleshort	0x8769
474>>12	use		tiff_entry
475# GPS IFD
476>0	uleshort	0x8825		\b, GPS-Data
477>>12	use		tiff_entry
478#>0	uleshort	x		\b, unknown=%#x
479#>>12	use		tiff_entry
4800	string		MM\x00\x2b	Big TIFF image data, big-endian
481!:mime	image/tiff
4820	string		II\x2b\x00	Big TIFF image data, little-endian
483!:mime	image/tiff
484
485# PNG [Portable Network Graphics, or "PNG's Not GIF"] images
486# (Greg Roelofs, newt@uchicago.edu)
487# (Albert Cahalan, acahalan@cs.uml.edu)
488#
489# 137 P N G \r \n ^Z \n [4-byte length] I H D R [HEAD data] [HEAD crc] ...
490#
491
492# IHDR parser
4930	name		png-ihdr
494>0	ubelong		x		\b, %d x
495>4	ubelong		x		%d,
496>8	ubyte		x		%d-bit
497>9	ubyte		0		grayscale,
498>9	ubyte		2		\b/color RGB,
499>9	ubyte		3		colormap,
500>9	ubyte		4		gray+alpha,
501>9	ubyte		6		\b/color RGBA,
502#>10	ubyte		0		deflate/32K,
503>12	ubyte		0		non-interlaced
504>12	ubyte		1		interlaced
505
506# Standard PNG image.
5070	string		\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0DIHDR	PNG image data
508!:mime	image/png
509!:ext   png
510!:strength +10
511>16	use		png-ihdr
512>33	string		\x00\x00\x00\x08acTL	\b, animated
513>>41	ubelong		1			(%d frame
514>>41	ubelong		>1			(%d frames
515>>45	ubelong		0			\b, infinite repetitions)
516>>45	ubelong		1			\b, %d repetition)
517>>45	ubelong		>1			\b, %d repetitions)
518
519# Apple CgBI PNG image.
5200	string		\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x04CgBI
521>24	string  	\x00\x00\x00\x0DIHDR	PNG image data (CgBI)
522!:mime	image/png
523!:ext   png
524!:strength +10
525>>32	use		png-ihdr
526
527# possible GIF replacements; none yet released!
528# (Greg Roelofs, newt@uchicago.edu)
529#
530# GRR 950115:  this was mine ("Zip GIF"):
5310	string		GIF94z		ZIF image (GIF+deflate alpha)
532!:mime	image/x-unknown
533#
534# GRR 950115:  this is Jeremy Wohl's Free Graphics Format (better):
535#
5360	string		FGF95a		FGF image (GIF+deflate beta)
537!:mime	image/x-unknown
538#
539# GRR 950115:  this is Thomas Boutell's Portable Bitmap Format proposal
540# (best; not yet implemented):
541#
5420	string		PBF		PBF image (deflate compression)
543!:mime	image/x-unknown
544
545# GIF
546# Strength set up to beat 0x55AA DOS/MBR signature word lookups (+65)
5470	string		GIF8		GIF image data
548!:strength +80
549!:mime	image/gif
550!:apple	8BIMGIFf
551!:ext	gif
552>4	string		7a		\b, version 8%s,
553>4	string		9a		\b, version 8%s,
554>6	uleshort	>0		%d x
555>8	uleshort	>0		%d
556#>10	ubyte		&0x80		color mapped,
557#>10	ubyte&0x07	=0x00		2 colors
558#>10	ubyte&0x07	=0x01		4 colors
559#>10	ubyte&0x07	=0x02		8 colors
560#>10	ubyte&0x07	=0x03		16 colors
561#>10	ubyte&0x07	=0x04		32 colors
562#>10	ubyte&0x07	=0x05		64 colors
563#>10	ubyte&0x07	=0x06		128 colors
564#>10	ubyte&0x07	=0x07		256 colors
565
566# URL:		http://fileformats.archiveteam.org/wiki/Jeff%27s_Image_Format
567#		http://web.archive.org/web/20010603113404/http://jeff.cafe.net/jif
568# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-jif.trid.xml
569#		https://www.nationalarchives.gov.uk/PRONOM/fmt/994
570# From:		Joerg Jenderek
571# Note:		nearly identical to GIF, except that it uses zlib compression instead of LZW
572#		called by TrID "Jeff's Image Format bitmap" and "Jeffs Image Format" by DROID via fmt/994
573#		verfied by XnView `nconvert -fullinfo *.jif` as "Jeff's Image Format"
5740	string		JIF99a		Jeffs Image Format data
575!:mime	image/x-jif
576# http://extension.nirsoft.net/jif
577#!:mime	image/jif
578!:apple	????JIFf
579!:ext	jif
580>6	uleshort	x		%u x
581>8	uleshort	x		%u
582
583# ITC (CMU WM) raster files.  It is essentially a byte-reversed Sun raster,
584# 1 plane, no encoding.
5850	string		\361\0\100\273	CMU window manager raster image data
586>4	ulelong		>0		%d x
587>8	ulelong		>0		%d,
588>12	ulelong		>0		%d-bit
589
590# Magick Image File Format
591# URL:		https://imagemagick.org/script/miff.php
592# Reference:	http://fileformats.archiveteam.org/wiki/MIFF
593# Update:	Joerg Jenderek
594# http://www.nationalarchives.gov.uk/pronom/fmt/930
5950	search/256/bc	id=imagemagick
596# skip bad ASCII text by following new line~0x0A or space~0x20 character
597#>&0	ubyte		x		\b, next character %#x
598# called by TriD ImageMagick Machine independent File Format bitmap
599>&0	ubyte&0xD5	0		MIFF image data
600# https://reposcope.com/mimetype/image/miff
601#!:mime	image/miff
602!:mime	image/x-miff
603!:ext	miff/mif
604# examples with standard file(1) magic
605#>>0	string		=id=ImageMagick	with standard magic
606# examples with unusual file(1) magic like
607>>0	string		!id=ImageMagick	starting with
608# start with comment (brace) like http://samples.fileformat.info/.../AQUARIUM.MIF
609>>>0	ubyte		=0x7b		comment
610# skip second character which is often a newline and show comment
611>>>>2	string		x		"%s"
612# does not start with comment, probably letters with other case like Id=ImageMagick
613# ImageMagick-7.0.9-2/Magick++/demo/smile_anim.miff
614>>>0	ubyte		!0x7b
615>>>>0	string		>\0		'%-.14s'
616# URL:		https://imagemagick.org/
617# Reference:	https://imagemagick.org/script/magick-vector-graphics.php
618# From:		Joerg Jenderek
619# Note:		all white-spaces between commands are ignored
6200	string		push
621# skip some white spaces
622>5	search/3	graphic-context	ImageMagick Vector Graphic
623# TODO: look for dangerous commands like CVE-2016-3715
624#!:mime	text/plain
625!:mime	image/x-mvg
626!:ext	mvg
627
628# Artisan
6290	long		1123028772	Artisan image data
630>4	long		1		\b, rectangular 24-bit
631>4	long		2		\b, rectangular 8-bit with colormap
632>4	long		3		\b, rectangular 32-bit (24-bit with matte)
633
634# FIG (Facility for Interactive Generation of figures), an object-based format
635# URL: 		http://fileformats.archiveteam.org/wiki/Fig
636#		https://en.wikipedia.org/wiki/Xfig
637# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/f/fig.trid.xml
638# https://web.archive.org/web/20070920204655/http://epb.lbl.gov/xfig/fig-format.html
639# Update:	Joerg Jenderek
640# Note:		called "FIG vector drawing" by TrID,
641#		4 byte magic is assumed to be always at offset 0 and
642#		verified by `fig2mpdf -v bootloader.fig && file bootloader.pdf`
643#0	search/1/tb	#FIG		FIG image text
644# GRR: with --keep-going option the line above gives duplicate messages
6450	search/1/ts	#FIG
646>&0	use		image-xfig
647# binary data variant with non ASCII text characters like Control-A or �C in thermostat.fig
6480	search/1/bs	#FIG
649>&0	use		image-xfig
650#	display XFIG image describing text, mime type, file name extension and version
6510	name		image-xfig
652>8	ubyte		x		FIG image text
653#!:mime	text/plain
654# https://reposcope.com/mimetype/image/x-xfig
655!:mime	image/x-xfig
656!:ext	fig
657# version string like: 1.4 2.1 3.1 3.2
658>5	string		x		\b, version %.3s
659# some times after version text like: "Produced by xfig version 3.2.5-alpha5"
660>8	ubyte		>0x0D
661>>8	string		x		"%s"
662# should be point character (2Eh) of version string according to TrID
663#>6	ubyte		!0x2E		\b, at 6 %#x
664# caret character (23h) at the beginning in most or probably all examples
665#>0	ubyte		!0x23		\b, starting with character %#x
666# URL: 		http://fileformats.archiveteam.org/wiki/DeskMate_Draw
667#		http://en.wikipedia.org/wiki/Deskmate
668# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/d/dm-fig.trid.xml
669# From:		Joerg Jenderek
670# Note:		called "DeskMate Draw drawing" by TrID
6710	string		\x14FIG		DeskMate Drawing
672#!:mime	application/octet-stream
673!:mime	image/x-deskmate-fig
674!:ext	fig
675# TODO:
676#	"Cabri 3D Figure"	by TrID fig-cabri.trid.xml
677#	"Playmation Figure"	by TrID fig-playmation.trid.xml
678
679# PHIGS
6800	string		ARF_BEGARF		PHIGS clear text archive
6810	string		@(#)SunPHIGS		SunPHIGS
682# version number follows, in the form m.n
683>40	string		SunBin			binary
684>32	string		archive			archive
685
686# GKS (Graphics Kernel System)
6870	string		GKSM		GKS Metafile
688>24	string		SunGKS		\b, SunGKS
689
690# CGM image files
691# Update:	Joerg Jenderek
692# URL: 		http://fileformats.archiveteam.org/wiki/CGM
693#		https://en.wikipedia.org/wiki/Computer_Graphics_Metafile
694# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/c/cgm-ct.trid.xml
695#		http://standards.iso.org/ittf/PubliclyAvailableStandards/c032381_ISO_IEC_8632-4_1999(E).zip
696# Note:		called "Computer Graphics Metafile (Clear Text)" by TrID and
697#		"Computer Graphics Metafile ASCII" by DROID or CGM by XnView
698#		verified by LibreOffice and partly by XnView `nconvert -info *.CGM`
699# According to TrID only letter B and M are always upcased and by DROID often only B is upcased for command BEGIN METAFILE
7000	string/c	begmf
701# skip SOME DROID fmt-301-signature-id-359.cgm fmt-301-signature-id-361.cgm fmt-302-signature-id-364.cgm
702# fmt-302-signature-id-365.cgm x-fmt-142-signature-id-350.cgm x-fmt-142-signature-id-351.cgm
703>5	short		!0
704# skip other versions of DROID fmt-301-signature-id-359.cgm fmt-301-signature-id-361.cgm fmt-302-signature-id-364.cgm
705# fmt-302-signature-id-365.cgm x-fmt-142-signature-id-350.cgm x-fmt-142-signature-id-351.cgm
706>>5	short		!0xABab		clear text Computer Graphics Metafile
707# https://reposcope.com/mimetype/image/cgm
708!:mime	image/cgm
709!:ext	cgm
710# SF:NAME like: 'metafile example';
711>>>5	string		x		%s
712# look for command METAFILE VERSION (MFVERSION <SOFTSEP> <I:VERSION>)
713>>>2	search/128/c	mfversion
714#>>>>&0	ubyte		x		SOFTSEP=%#x
715# version like: 1 3 4
716>>>>&1	ubyte		>0x31		\b, version %c
717# Summary:	Computer Graphics Metafile (binary)
718# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/c/cgm-bin.trid.xml
719#		https://standards.iso.org/ittf/PubliclyAvailableStandards/c032380_ISO_IEC_8632-3_1999(E).zip
720# Note:		called "Computer Graphics Metafile (binary)" by TrID and DROID or CGM by XnView
721#		verified by LibreOffice and partly by XnView `nconvert -info *.CGM`
722# look for BEGIN METAFILE (element Class 0 and ID 1 and "random" Parameter) that is binary C C C C 0 0 0 0 0 0 1 P P P P P
7230	ubeshort&0xFFe0		0x0020
724# skip SOME DROID fmt-303-signature-id-368.cgm fmt-304-signature-id-369.cgm fmt-305-signature-id-370.cgm fmt-306-signature-id-371.cgm
725# with containing only 28 bytes
726>28	ubyte			x
727# look for METAFILE VERSION (element class 1 and id 1 and parameter P1 with length 2) that is binary 0 0 0 1 i i i i i i 1 P P P 1 P
728# with "low" version; 2nd worst case argentin.cgm with parameter length 56
729# worst MS.CGM
730#>>2	search/73/b		\x10\x22\0	binary Computer Graphics Metafile
731>>2	search/128/b		\x10\x22\0	binary Computer Graphics Metafile
732!:mime	image/cgm
733!:ext	cgm
734# metafile 2 byte version number like: 1 (most) 2 3 4
735>>>&-1	ubeshort		>1		\b, version %u
736# length number of 1st parameter octets in range 0 to 30 implies short command
737>>>0	ubeshort&0x001F		<31		\b, parameter length %u
738# length of string like: 8 9 10 11 12 29
739#>>>>2		ubyte		x		\b, %u BYTES (SHORT)
740# string like: 'HiJaak 2' 'Example 1' 'sahara.cgm' 'MASTERCLIPS--Art Of Business '
741>>>>2		pstring		>\0		'%s'
742# after 1st short command with even parameter length comes 2nd command like: 1022h 0010h (EAF00010.CGM 'HiJaak 2' FLOPPY2.CGM TIGER.CGM 'B:\TIGER.CGM')
743>>>>0  		ubeshort&0x0001	=0
744>>>>>(2.b+3)	ubeshort	!0x1022		\b, 2nd command %#4.4x (short even)
745# after 1st short command with odd parameter length comes nil padding byte followed 2nd command like: 1022h
746>>>>0  		ubeshort&0x0001	=1
747#>>>>>(2.b+3)	ubyte		!0		\b, PADDING %#x
748>>>>>(2.b+4)	ubeshort	!0x1022		\b, 2nd command %#4.4x (short odd)
749# 11111 binary (decimal 31) in the parameter field indicates that the command is in long-form
750>>>0	ubeshort&0x001F		=0x1F
751# bit 15 is partition flag with 1 for 'not-last' partition and 0 for 'last' partition
752>>>>2  		ubeshort&0x8000	!0		\b, partition flag %#4.4x
753# bits 0 to 14 is parameter list length; the number of following parameter octets; range 0 to 32767
754# length of 1st long command parameter like: 53
755>>>>2  		ubeshort&0x7Fff	x		\b, parameter length %u (long)
756# The two header words are then followed by lenghth of 1st string like: 52
757#>>>>4		ubyte		x		\b, %u BYTES
758# string like: 'K:\PROJECTS\GRAPHICS\DWKS3.5\CLIPART\FLAGS\Italy.cgm'
759>>>>4		pstring/B	x		'%s'
760# odd long parameter length implies single null padding octet to start command on word boundary
761>>>>2  		ubeshort&0x0001	=1
762# after 1st long command with odd parameter length comes nil padding byte followed by 2nd command like: 1022h
763#>>>>>(4.b+5)		ubyte	!0		\b, PADDING %#x
764>>>>>(4.b+6)		ubeshort !0x1022	\b, 2nd command %#4.4x (long odd)
765# even long parameter length implies next command directly is following
766>>>>2  		ubeshort&0x0001	=0
767# after 1st long command with even parameter length comes 2nd command like: 1022h 0x1054 (MS.CGM)
768>>>>>(4.b+5)	ubeshort	!0x1022		\b, 2nd command %#4.4x (long even)
769# look for END METAFILE (element class 0 and id 2 and 0 parameter) that is binary 0 0 0 0 i i i i i 1 i P P P P P
770>>>-2	ubeshort		!0x0040		\b, NOT_FOUND_END_METAFILE
771
772# MGR bitmaps  (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
7730	string	yz	MGR bitmap, modern format, 8-bit aligned
7740	string	zz	MGR bitmap, old format, 1-bit deep, 16-bit aligned
7750	string	xz	MGR bitmap, old format, 1-bit deep, 32-bit aligned
7760	string	yx	MGR bitmap, modern format, squeezed
777
778# Fuzzy Bitmap (FBM) images
7790	string		%bitmap\0	FBM image data
780>30	long		0x31		\b, mono
781>30	long		0x33		\b, color
782
783# facsimile data
7841	string		PC\ Research,\ Inc	group 3 fax data
785>29	ubyte		0		\b, normal resolution (204x98 DPI)
786>29	ubyte		1		\b, fine resolution (204x196 DPI)
787# From: Herbert Rosmanith <herp@wildsau.idv.uni.linz.at>
7880	string		Sfff		structured fax file
789
790# From: Joerg Jenderek <joerg.jen.der.ek@gmx.net>
791# URL:	http://fileformats.archiveteam.org/wiki/Award_BIOS_logo
792# Note:	verified by XnView command `nconvert -fullinfo *.EPA`
7930	string		\x11\x06	Award BIOS Logo, 136 x 84
794!:mime	image/x-award-bioslogo
795!:ext	epa
7960	string		\x11\x09	Award BIOS Logo, 136 x 126
797!:mime	image/x-award-bioslogo
798!:ext	epa
799# https://telparia.com/fileFormatSamples/image/epa/IO.EPA
800# Note:	by bitmap-awbm-v1x1009.trid.xml called "Award BIOS logo bitmap (128x126) (v1)"
801#	verified by RECOIL `recoil2png -o tmp.png IO.EPA; file tmp.png`
8020	string		\x10\x09	Award BIOS Logo, 128 x 126
803!:mime	image/x-award-bioslogo
804!:ext	epa
805#0	string		\x07\x1f	BIOS Logo corrupted?
806# http://www.blackfiveservices.co.uk/awbmtools.shtml
807# http://biosgfx.narod.ru/v3/
808# http://biosgfx.narod.ru/abr-2/
8090	string		AWBM
810# Note:    by bitmap-awbm.trid.xml called "Award BIOS logo bitmap (v2)"
811>4	uleshort	<1981		Award BIOS Logo, version 2
812#>4	uleshort	<1981		Award BIOS bitmap
813!:mime	image/x-award-bioslogo2
814#!:mime	image/x-award-bmp
815!:ext	epa/bmp
816# image width is a multiple of 4
817>>4	uleshort&0x0003	0
818>>>4	uleshort	x		\b, %d
819>>>6	uleshort	x		x %d
820>>4	uleshort&0x0003	>0		\b,
821>>>4	uleshort&0x0003	=1
822>>>>4	uleshort	x		%d+3
823>>>4	uleshort&0x0003	=2
824>>>>4	uleshort	x		%d+2
825>>>4	uleshort&0x0003	=3
826>>>>4	uleshort	x		%d+1
827>>>6	uleshort	x		x %d
828# at offset 8 starts imagedata followed by "RGB " marker
829
830# PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
831# https://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.\
832# 28bitmap_information_header.29
833# Note:	variant starting direct with DIB header see
834#	http://fileformats.archiveteam.org/wiki/BMP
835#	verified by ImageMagick version 6.8.9-8 command `identify *.dib`
8360	uleshort		40
837# skip bad samples like GAME by looking for valid number of color planes
838>12	uleshort	1		Device independent bitmap graphic
839!:mime	image/x-ms-bmp
840!:apple	????BMPp
841!:ext	dib
842>>4	ulelong		x		\b, %d x
843>>8	ulelong		x		%d x
844>>14	uleshort	x		%d
845# number of color planes (must be 1)
846#>>12	uleshort	>1		\b, %u color planes
847# compression method: 0~no 1~RLE 8-bit/pixel 3~Huffman 1D
848#>>16	ulelong		3		\b, Huffman 1D compression
849>>16	ulelong		>0		\b, %u compression
850# image size is the size of raw bitmap; a dummy 0 can be given for BI_RGB bitmaps
851>>20	ulelong		x		\b, image size %u
852# horizontal and vertical resolution of the image (pixel per metre, signed integer)
853>>24	ulelong		>0		\b, resolution %d x
854>>>28	ulelong		x		%d px/m
855# number of colors in palette, or 0 to default to 2**n
856#>>32	ulelong		>0		\b, %u colors
857# number of important colors used, or 0 when every color is important
858>>36	ulelong		>0		\b, %u important colors
859# From:		Joerg Jenderek
860# URL:		http://fileformats.archiveteam.org/wiki/VBM_(VDC_BitMap)
861# Reference:	http://csbruce.com/cbm/postings/csc19950906-1.txt
862#		http://mark0.net/download/triddefs_xml.7z
863#		defs/b/bitmap-vbm.trid.xml
864#		defs/b/bitmap-vbm-v3.trid.xml
865# Note:		called "VDC BitMap" by TrID
866#		verified by RECOIL `recoil2png -o tmp.png coke_can.vbm; file tmp.png`
867# begin with a signature of 'B' 'M' 0xCB, followed by a version byte 2 or 3
868# Similar to the unrelated Windows BMP format
869#	check for VDC bitmap and then display image dimension and version
8700	name		bitmap-vbm
871>2	ubyte		0xCB		VDC bitmap
872!:mime	image/x-commodore-vbm
873# http://recoil.sourceforge.net/formats.html
874!:ext	bm/vbm
875# the VBM format version number: 2 or 3
876>>3	ubyte		x		\b, version %u
877# width of the image in Hi/Lo format
878>>4	ubeshort	x		\b, %u
879# height of the image
880>>6	ubeshort	x		x %u
881# version 3 images have the following additional header information
882>>3	ubyte		=3
883# data-encoding type: 0~uncompressed 1~RLE-compressed
884>>>8	ubyte		0		\b, uncompressed
885>>>8	ubyte		1		\b, RLE-compressed
886# byte code for general RLE repetitions
887#>>>9	ubyte		x		\b, RLE repetition code 0x%x
888# reserved := 0
889#>>>14	short		>0		\b, reserved 0x%x
890# length of comment text; 0~no comment text
891#>>>16	ubeshort	>0		\b, comment length %u
892>>>16	pstring/H	>0		\b, comment "%s"
893#
8940	string		BM
895# check for magic and version 2 of VDC bitmap or BMP with cbSize=715=CB02
896>2	ubeshort		0xCB02
897>>6	short		=0
898>>>0	use     	bitmap-bmp
899# VDC bitmap height or maybe a few OS/2 BMP with nonzero "hotspot coordinates"
900>>6	short		!0
901>>>0	use     	bitmap-vbm
902# check for magic and version 3 of VDC bitmap or BMP with cbSize=971=CB03
903>2	ubeshort		0xCB03
904# check for reserved value (=0) of VDC bitmap
905>>14	short		=0
906>>>0	use     	bitmap-vbm
907# BMP with cbSize=????03CBh and dib header size != 0
908>>14	short		!0
909>>>0	use     	bitmap-bmp
910# cbSize is size of header or file size of Windows BMP bitmap
911>2	default		x
912>>0	use     	bitmap-bmp
9130	name		bitmap-bmp
914>14	ulelong		12		PC bitmap, OS/2 1.x format
915!:mime	image/bmp
916!:ext	bmp
917>>18	uleshort	x		\b, %d x
918>>20	uleshort	x		%d
919# number of color planes (must be 1)
920#>>22	uleshort	!1		\b, %u color planes
921# number of bits per pixel (color depth); found 4 8
922>>24	uleshort	x		x %d
923# x, y coordinates of the hotspot
924>>6	uleshort	>0		\b, hotspot %ux
925>>>8	uleshort	x		\b%u
926# cbSize; size of file or header like 1Ah 228C8h
927>>2	ulelong		x		\b, cbSize %u
928#>>2	ulelong		x		\b, cbSize 0x%8.8x
929# offBits; offset to bitmap data like:
930>>10	ulelong		x	\b, bits offset %u
931# http://fileformats.archiveteam.org/wiki/BMP#OS.2F2_BMP_2.0 no examples found
932>14	ulelong		48		PC bitmap, OS/2 2.x format (DIB header size=48)
933>14	ulelong		24		PC bitmap, OS/2 2.x format (DIB header size=24)
934# http://entropymine.com/jason/bmpsuite/bmpsuite/q/pal8os2v2-16.bmp
935# Note:    by bitmap-bmp-v2o.trid.xml called "Windows Bitmap (v2o)"
936>14	ulelong		16		PC bitmap, OS/2 2.x format (DIB header size=16)
937!:mime	image/bmp
938!:apple	????BMPp
939!:ext	bmp
940# image width and height fields are unsigned integers for OS/2
941>>18	ulelong		x		\b, %u x
942>>22	ulelong		x		%u
943# number of bits per pixel (color depth); found 8
944>>28	uleshort	>1		x %u
945# x, y coordinates of the hotspot
946>>6	uleshort	>0		\b, hotspot %ux
947>>>8	uleshort	x		\b%u
948# number of color planes (must be 1)
949#>>26	uleshort	>1		\b, %u color planes
950# cbSize; size of file like: 241E
951>>2	ulelong		x		\b, cbSize %u
952#>>2	ulelong		x		\b, cbSize 0x%x
953# offBits; offset to bitmap data like: 41E
954>>10	ulelong		x	\b, bits offset %u
955#>>10	ulelong		x	\b, bits offset 0x%x
956>14	ulelong		64		PC bitmap, OS/2 2.x format
957!:mime	image/bmp
958!:apple	????BMPp
959!:ext	bmp
960# image width and height fields are unsigned integers for OS/2
961>>18	ulelong		x		\b, %u x
962>>22	ulelong		x		%u
963# number of bits per pixel (color depth); found 1 4 8
964>>28	uleshort	>1		x %u
965# x, y coordinates of the hotspot
966>>6	uleshort	>0		\b, hotspot %ux
967>>>8	uleshort	x		\b%u
968>>26	uleshort	>1		\b, %u color planes
969# cbSize; size of file or headers
970>>2	ulelong		x		\b, cbSize %u
971# BMP with cbSize 000002CBh=715 or 000003CBh=971 maybe misinterpreted as VDC bitmap
972#>>2	ulelong		x		\b, cbSize %#x
973# offBits; offset to bitmap data like 56h 5Eh 8Eh 43Eh
974>>10	ulelong		x	\b, bits offset %u
975#>>10	ulelong		x	\b, bits offset %#x
976#>>(10.l) ubequad	!0	\b, bits %#16.16llx
977# BITMAPV2INFOHEADER	adds RGB bit masks
978>14	ulelong		52		PC bitmap, Adobe Photoshop
979!:mime	image/bmp
980!:apple	????BMPp
981!:ext	bmp
982>>18	ulelong		x		\b, %d x
983>>22	ulelong		x		%d x
984# number of bits per pixel (color depth); found 16 32
985>>28	uleshort	x		%d
986# x, y coordinates of the hotspot; should be zero for Windows variant
987>>6	uleshort	>0		\b, hotspot %ux
988>>>8	uleshort	x		\b%u
989# cbSize; size of file like: 14A 7F42
990>>2	ulelong		x		\b, cbSize %u
991#>>2	ulelong		x		\b, cbSize 0x%x
992# offBits; offset to bitmap data like: 42h
993>>10	ulelong		x	\b, bits offset %u
994#>>10	ulelong		x	\b, bits offset 0x%x
995# BITMAPV3INFOHEADER	adds alpha channel bit mask
996>14	ulelong		56		PC bitmap, Adobe Photoshop with alpha channel mask
997!:mime	image/bmp
998!:apple	????BMPp
999!:ext	bmp
1000>>18	ulelong		x		\b, %d x
1001>>22	ulelong		x		%d x
1002# number of bits per pixel (color depth); found 16 32
1003>>28	uleshort		x		%d
1004# x, y coordinates of the hotspot; should be zero for Windows variant
1005>>6	uleshort	>0		\b, hotspot %ux
1006>>>8	uleshort	x		\b%u
1007# cbSize; size of file like: 4E 7F46 131DE 14046h
1008>>2	ulelong		x		\b, cbSize %u
1009#>>2	ulelong		x		\b, cbSize 0x%x
1010# offBits; offset to bitmap data like: 46h
1011>>10	ulelong			x	\b, bits offset %u
1012#>>10	ulelong			x	\b, bits offset 0x%x
1013>14	ulelong		40
1014# jump 4 bytes before end of file/header to skip fmt-116-signature-id-118.dib
1015# broken for large bitmaps
1016#>>(2.l-4)	ulong	x		PC bitmap, Windows 3.x format
1017>>14	ulelong		40		PC bitmap, Windows 3.x format
1018!:mime	image/bmp
1019!:apple	????BMPp
1020>>>18	ulelong		x		\b, %d x
1021>>>22	ulelong		x		%d
1022# 320 x 400		https://en.wikipedia.org/wiki/LOGO.SYS
1023>>>18	ulequad		=0x0000019000000140	x
1024!:ext	bmp/sys
1025>>>18	ulequad		!0x0000019000000140
1026# compression method 2~RLE 4-bit/pixel implies also extension rle
1027>>>>30	ulelong		2		x
1028!:ext	bmp/rle
1029# not RLE compressed and not 320x400 dimension
1030>>>>30	default		x
1031# "small" dimensions like: 14x15 15x16 16x14 16x16 32x32
1032#	https://en.wikipedia.org/wiki/Favicon
1033>>>>>18	ulequad&0xffFFffC0ffFFffC0 =0	x
1034# https://www.politi-kdigital.de/favicon.ico
1035# http://forum.rpc1.org/favicon.ico
1036!:ext	bmp/ico
1037# "big" dimensions > 63
1038>>>>>18	default		x		x
1039!:ext	bmp
1040# number of bits per pixel (color depth); found 1 2 4 8 16 24 32
1041>>>28	uleshort	x		%d
1042# x, y coordinates of the hotspot; there is no hotspot in bitmaps, so values 0
1043#>>>6	uleshort	>0		\b, hotspot %ux
1044#>>>>8	uleshort	x		\b%u
1045# number of color planes (must be 1), except badplanes.bmp for testing
1046#>>>26	uleshort	>1		\b, %u color planes
1047# compression method: 0~no 1~RLE 8-bit/pixel 2~RLE 4-bit/pixel 3~Huffman 1D 6~RGBA bit field masks
1048#>>>30	ulelong		3		\b, Huffman 1D compression
1049>>>30	ulelong		>0		\b, %u compression
1050# image size is the size of raw bitmap; a dummy 0 can be given for BI_RGB bitmaps
1051>>>34	ulelong		>0		\b, image size %u
1052# horizontal and vertical resolution of the image (pixel per metre, signed integer)
1053>>>38	ulelong		>0		\b, resolution %d x
1054>>>>42	ulelong		x		%d px/m
1055# number of colors in palette 16 256, or 0 to default to 2**n
1056#>>>46	ulelong		>0		\b, %u colors
1057# number of important colors used, or 0 when every color is important
1058>>>50	ulelong		>0		\b, %u important colors
1059# cbSize; often size of file
1060>>>2	ulelong		x		\b, cbSize %u
1061#>>>2	ulelong		x		\b, cbSize %#x
1062# offBits; offset to bitmap data like 36h 76h BEh 236h 406h 436h 4E6h
1063>>>10	ulelong		x	\b, bits offset %u
1064#>>>10	ulelong		x	\b, bits offset %#x
1065#>>>(10.l) ubequad	!0	\b, bits %#16.16llxd
1066>14	ulelong		124		PC bitmap, Windows 98/2000 and newer format
1067!:mime	image/bmp
1068!:ext	bmp
1069>>18	ulelong		x		\b, %d x
1070>>22	ulelong		x		%d x
1071# color planes; must be 1
1072#>>>26	uleshort	>1		\b, %u color planes
1073# 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)
1074>>28	uleshort	x		%d
1075# x, y coordinates of the hotspot; should be zero for Windows variant
1076>>6	uleshort	>0		\b, hotspot %ux
1077>>>8	uleshort	x		\b%u
1078# cbSize; size of file like: 8E AA 48A 999 247A 4F02 7F8A 3F88E B216E 1D4C8A 100008A
1079>>2	ulelong		x		\b, cbSize %u
1080#>>2	ulelong		x		\b, cbSize 0x%x
1081# offBits; offset to bitmap data like: 8A 47A ABABABAB (fmt-119-signature-id-121.bmp)
1082>>10	ulelong		x	\b, bits offset %u
1083#>>10	ulelong		x	\b, bits offset 0x%x
1084>14	ulelong		108		PC bitmap, Windows 95/NT4 and newer format
1085!:mime	image/bmp
1086!:ext	bmp
1087>>18	ulelong		x		\b, %d x
1088>>22	ulelong		x		%d x
1089# number of bits per pixel (color depth); found 8 24 32
1090>>28	uleshort	x		%d
1091# x, y coordinates of the hotspot; should be zero for Windows variant
1092>>6	uleshort	>0		\b, hotspot %ux
1093>>>8	uleshort	x		\b%u
1094# cbSize; size of file like: 82 8A 9A 9F86 1E07A 3007A 88B7A C007A
1095>>2	ulelong		x		\b, cbSize %u
1096#>>2	ulelong		x		\b, cbSize 0x%x
1097# offBits; offset to bitmap data like: 7A 7E 46A
1098>>10	ulelong		x	\b, bits offset %u
1099#>>10	ulelong		x	\b, bits offset 0x%x
1100# Update:	Joerg Jenderek
1101# URL:		http://fileformats.archiveteam.org/wiki/OS/2_Icon
1102# Reference:	http://www.fileformat.info
1103#		/format/os2bmp/spec/902d5c253f2a43ada39c2b81034f27fd/view.htm
1104# Note: verified by command like `deark -l -d3 OS2MEMU.ICO`
11050	string		IC
1106# skip Lotus smart icon *.smi by looking for valid hotspot coordinates
1107>6	ulelong&0xFF00FF00	=0	OS/2 icon
1108# jump 4 bytes before end of header/file and test for accessibility
1109#>>(2.l-4) ubelong	x	End of header is OK!
1110!:mime	image/x-os2-ico
1111!:ext	ico
1112# cbSize; size of header or file in bytes like 1ah 120h 420h
1113>>2	ulelong		x	\b, cbSize %u
1114# xHotspot, yHotspot; coordinates of the hotspot for icons like 16 32
1115>>6	uleshort	x	\b, hotspot %ux
1116>>8	uleshort	x	\b%u
1117# offBits; offset in bytes to the beginning of the bit-map pel data like 20h
1118>>10	ulelong		x	\b, bits offset %u
1119#>>(10.l) ubequad	x	\b, bits %#16.16llx
1120#0	string		PI		PC pointer image data
1121#0	string		CI		PC color icon data
11220	string		CI
1123# test also for valid dib header sizes 12 or 64
1124>14	ulelong		<65		OS/2
1125# test also for valid hotspot coordinates
1126#>>6	ulelong&0xFE00FE00	=0	OS/2
1127!:mime	image/x-os2-ico
1128!:ext	ico
1129>>14	ulelong		12		1.x color icon
1130# image width and height fields are unsigned integers for OS/2
1131>>>18	uleshort	x		%u x
1132# stored height = 2 * real height
1133>>>20	uleshort/2	x		%u
1134# number of bits per pixel (color depth). Typical 32 24 16 8 4 but only 1 found
1135>>>24	uleshort	>1		x %u
1136# color planes; must be 1
1137#>>>22	uleshort	>1		\b, %u color planes
1138>>14	ulelong		64		2.x color icon
1139# image width and height
1140>>>18	ulelong		x		%u x
1141# stored height = 2 * real height
1142>>>22	ulelong/2	x		%u
1143# number of bits per pixel (color depth). only 1 found
1144>>>28	uleshort	>1		x %u
1145#>>>26	uleshort	>1		\b, %u color planes
1146# compression method: 0~no 3~Huffman 1D
1147>>>30	ulelong		3		\b, Huffman 1D compression
1148#>>>30	ulelong		>0		\b, %u compression
1149# xHotspot, yHotspot; coordinates of the hotspot like 0 1 16 20 32 33 63 64
1150>>6	uleshort	x	\b, hotspot %ux
1151>>8	uleshort	x	\b%u
1152# cbSize; size of header or maybe file in bytes like 1Ah 4Eh 84Eh
1153>>2	ulelong		x	\b, cbSize %u
1154#>>2	ulelong		x	\b, cbSize %x
1155# offBits; offset to bitmap data (pixel array) like E4h 3Ah 66h 6Ah 33Ah 4A4h
1156>>10	ulelong		x	\b, bits offset %u
1157#>>10	ulelong		x	\b, bits offset %#x
1158#>>(10.l) ubequad	!0	\b, bits %#16.16llx
1159# dib header size: 12~Ch~OS/2 1.x 64~40h~OS/2 2.x
1160#>>14	ulelong		x		\b, dib header size %u
1161#0	string		CP		PC color pointer image data
1162# URL:		http://fileformats.archiveteam.org/wiki/OS/2_Pointer
1163# Reference:	http://www.fileformat.info/format/os2bmp/egff.htm
11640	string		CP
1165# skip many Corel Photo-Paint image "CPT9FILE" by checking for positive bits offset
1166>10	ulelong		>0
1167# skip CPU-Z Report by checking for valid dib header sizes 12 or 64
1168>>14	ulelong		=12
1169>>>0		use		os2-ptr
1170>>14	ulelong		=64
1171>>>0		use		os2-ptr
1172#	display information of OS/2 pointer bitmaps
11730	name		os2-ptr
1174>14	ulelong		x		OS/2
1175# http://extension.nirsoft.net/PTR
1176!:mime	image/x-ibm-pointer
1177!:ext	ptr
1178>>14	ulelong		12		1.x color pointer
1179# image width and height fields are unsigned integers for OS/2
1180>>>18	uleshort	x		%u x
1181# stored height = 2 * real height
1182>>>20	uleshort/2	x		%u
1183# number of bits per pixel (color depth). Typical 32 24 16 8 4 but only 1 found
1184>>>24	uleshort	>1		x %u
1185# color planes; must be 1
1186#>>>22	uleshort	>1		\b, %u color planes
1187>>14	ulelong		64		2.x color pointer
1188# image width and height
1189>>>18	ulelong		x		%u x
1190# stored height = 2 * real height
1191>>>22	ulelong/2	x		%u
1192# number of bits per pixel (color depth). only 1 found
1193>>>28	uleshort	>1		x %u
1194#>>>26	uleshort	>1		\b, %u color planes
1195# compression method: 0~no 3~Huffman 1D
1196>>>30	ulelong		3		\b, Huffman 1D compression
1197#>>>30	ulelong		>0		\b, %u compression
1198# xHotspot, yHotspot; coordinates of the hotspot like 0 3 4 8 15 16 23 27 31
1199>>6	uleshort	x	\b, hotspot %ux
1200>>8	uleshort	x	\b%u
1201# cbSize; size of header or maybe file in bytes like 1Ah 4Eh
1202>>2	ulelong		x	\b, cbSize %u
1203#>>2	ulelong		x	\b, cbSize %x
1204# offBits; offset to bitmap data (pixel array) like 6Ah A4h E4h 4A4h
1205>>10	ulelong		x	\b, bits offset %u
1206#>>10	ulelong		x	\b, bits offset %#x
1207#>>(10.l) ubequad	!0	\b, bits %#16.16llx
1208# dib header size: 12~Ch~OS/2 1.x 64~40h~OS/2 2.x
1209#>>14	ulelong		x		\b, dib header size %u
1210# Type: Vision Research Phantom CINE Format
1211# URL: https://www.phantomhighspeed.com/
1212# URL2: http://phantomhighspeed.force.com/vriknowledge/servlet/fileField?id=0BEU0000000Cfyk
1213# From: Harry Mallon <hjmallon at gmail.com>
1214#
1215# This has a short "CI" code but the 44 is the size of the struct which is
1216# stable
1217>2	uleshort 44		Vision Research CINE Video,
1218>>4	uleshort	0		Grayscale,
1219>>4	uleshort 1		JPEG Compressed,
1220>>4	uleshort 2		RAW,
1221>>6	uleshort x		version %d,
1222>>20	ulelong	x		%d frames,
1223>>48	ulelong	x		%dx
1224>>52	ulelong	x		\b%d
1225
1226# Conflicts with other entries [BABYL]
1227# URL:	http://fileformats.archiveteam.org/wiki/BMP#OS.2F2_Bitmap_Array
1228# Note:	container for OS/2 icon "IC", color icon "CI", color pointer "CP" or bitmap "BM"
1229#0	string		BA		PC bitmap array data
12300	string		BA
1231# skip old Emacs RMAIL BABYL ./mail.news by checking for low header size
1232>2	ulelong		<0x004c5942	OS/2 graphic array
1233!:mime	image/x-os2-graphics
1234#!:apple	????BMPf
1235# cbSize; size of header like 28h 5Ch
1236>>2	ulelong		x	\b, cbSize %u
1237#>>2	ulelong		x	\b, cbSize %#x
1238# offNext; offset to data like 0 48h F2h 4Eh 64h C6h D2h D6h DAh E6h EAh 348h
1239>>6	ulelong		>0	\b, data offset %u
1240#>>6	ulelong		>0	\b, data offset %#x
1241#>>(6.l) ubequad	!0	\b, data %#16.16llx
1242# dimensions of the intended device like 640 x 480 for VGA or 1024 x 768
1243>>10	uleshort	>0		\b, display %u
1244>>>12	uleshort	>0		x %u
1245# usType of first array element
1246#>>14	string		x		\b, usType %2.2s
1247# 1 space char after "1st"
1248# no *.bga examples found https://www.openwith.org/file-extensions/bga/1342
1249>>14	string		BM	\b; 1st
1250!:ext	bmp/bga
1251>>14	string		CI	\b; 1st
1252!:ext	ico
1253>>14	string		CP	\b; 1st
1254!:ext	ico
1255>>14	string		IC	\b; 1st
1256!:ext	ico
1257# no white-black pointer found
1258#>>14	string		PT	\b; 1st
1259#!:ext
1260>>14	indirect	x
1261
1262# XPM icons (Greg Roelofs, newt@uchicago.edu)
1263# Update:	Joerg Jenderek
1264# URL:		http://fileformats.archiveteam.org/wiki/XPM
1265# Reference:	http://www.x.org/docs/XPM/xpm.pdf
1266#		http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-xpm.trid.xml
1267# Note:		called "X PixMap bitmap" by TrID and "X-Windows Pixmap Image" by DROID via PUID x-fmt/208
1268# starting with c comment like: logo.xpm
12690	string			/*\040
1270# 9 byte c-comment "/* XPM */" not at the beginning like: mozicon16.xpm mozicon50.xpm (thunderbird)
1271>0	search/0xCE		/*\ XPM\ */
1272# skip DROID x-fmt-208-signature-id-620.xpm by looking for char array without explict length
1273# and match mh-logo.xpm (emacs)
1274>>&0		search/1249	[]
1275>>>0		use		xpm-image
1276# non standard because no 9 byte c-comment "/* XPM */" like: logo.xpm in qemu package
1277>0	default			x
1278# words are separated by a white space which can be composed of space and tabulation characters
1279>>0		search/0x52	static\040char\040
1280# skip debug.c testmlc.c by looking for char array without explict length
1281# https://www.clamav.net/downloads/production/clamav-0.104.2.tar.gz
1282# clamav-0.104.2\libclammspack\mspack\debug.c
1283>>>&0		search/64	[]
1284>>>>0		use		xpm-image
1285#	display X pixmap image information
12860	name			xpm-image
1287>0	string		x	X pixmap image text
1288#!:mime	text/plain
1289# https://reposcope.com/mimetype/image/x-xpixmap
1290# alias
1291#!:mime	image/x-xpm
1292!:mime	image/x-xpixmap
1293!:ext	xpm
1294# NO pm example found!
1295#!:ext	xpm/pm
1296# look for start of character array at beginning of a line like: psetupl.xpm (OpenOffice 4.1.7)
1297>0	search/0x406	\n"
1298# DEBUG VALUES string
1299#>>&0	string		x		'%s'
1300# width with optional white space before like: 16 24 32 48 1280
1301>>&0	regex/8		[0-9]{1,5}	\b, %s
1302# height with white space like: 15 16 17 24 32 48 1024
1303>>>&0	regex/8		[0-9]{1,5}	x %s
1304# number of colors with white space like: 1 2 3 4 5 8 11 14 162 255 but unrelistic 4294967295 by hardcopy tool
1305>>>>&0	regex/12	[0-9]{1,9}	x %s
1306# chars_per_pixel with white space like: 1 2
1307>>>>>&0	regex/14	[0-9]{1,2}	\b, %s chars/pixel
1308# non standard because not starting with 9 byte c-comment "/* XPM */"
1309>0	string		!/*\ XPM\ */
1310>>0	string		x	\b, 1st line "%s"
1311
1312# Utah Raster Toolkit RLE images (janl@ifi.uio.no)
13130	uleshort	0xcc52		RLE image data,
1314>6	uleshort	x		%d x
1315>8	uleshort	x		%d
1316>2	uleshort	>0		\b, lower left corner: %d
1317>4	uleshort	>0		\b, lower right corner: %d
1318>10	ubyte&0x1	=0x1		\b, clear first
1319>10	ubyte&0x2	=0x2		\b, no background
1320>10	ubyte&0x4	=0x4		\b, alpha channel
1321>10	ubyte&0x8	=0x8		\b, comment
1322>11	ubyte		>0		\b, %d color channels
1323>12	ubyte		>0		\b, %d bits per pixel
1324>13	ubyte		>0		\b, %d color map channels
1325
1326# image file format (Robert Potter, potter@cs.rochester.edu)
13270	string		Imagefile\ version-	iff image data
1328# this adds the whole header (inc. version number), informative but longish
1329>10	string		>\0		%s
1330
1331# Sun raster images, from Daniel Quinlan (quinlan@yggdrasil.com)
13320	ubelong		0x59a66a95	Sun raster image data
1333>4	ubelong		>0		\b, %d x
1334>8	ubelong		>0		%d,
1335>12	ubelong		>0		%d-bit,
1336#>16	ubelong		>0		%d bytes long,
1337>20	ubelong		0		old format,
1338#>20	ubelong		1		standard,
1339>20	ubelong		2		compressed,
1340>20	ubelong		3		RGB,
1341>20	ubelong		4		TIFF,
1342>20	ubelong		5		IFF,
1343>20	ubelong		0xffff		reserved for testing,
1344>24	ubelong		0		no colormap
1345>24	ubelong		1		RGB colormap
1346>24	ubelong		2		raw colormap
1347#>28	ubelong		>0		colormap is %d bytes long
1348
1349# SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
1350#
1351# Update:	Joerg Jenderek
1352# URL:		http://fileformats.archiveteam.org/wiki/SGI_(image_file_format)
1353#		https://en.wikipedia.org/wiki/Silicon_Graphics_Image
1354# Reference:	https://paulbourke.net/dataformats/sgirgb/sgiversion.html
1355#		http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-sgi.trid.xml
1356# Note:		called "Silicon Graphics bitmap (generic)" by TrID,
1357#		"Silicon Graphics Image" by DROID via PUID x-fmt/140 and shared MIME-info database from freedesktop.org,
1358#		verfied by ImageMagick `identify -verbose *.sgi` as SGI (Irix RGB image) and
1359#		verfied by XnView `nconvert -in sgi -info *.sgi` as SGI RGB
1360# look for magic number (integer 474=0x01DA) + storage format (0 or 1) + number of bytes per pixel channel (1 or 2)
1361# to skip few TeX font metric data (like pxmi.tfm pxmi1.tfm eksfi8a.tfm ./tex) with invalid "high" bytes/pixel (11 12)
13620	ubelong&0xFFffFEfc	0x01da0000
1363# skip DROID x-fmt-140-signature-id-623.bw with invalid "low" dimensions "0 x 0"
1364>6	long			!0		SGI image data
1365#!:mime	image/sgi
1366!:mime	image/x-sgi
1367!:apple	????.SGI
1368# STORAGE format; allowed values 0~VERBATIM 1~RLE
1369#>>2	ubyte		0		\b, verbatim
1370>>2	ubyte		1		\b, RLE
1371#>>2	ubyte		>1		STORAGE=%#x
1372# BPC; number of bytes per pixel component; allowed values 1 2
1373#>>3	ubyte		1		\b, normal precision
1374>>3	ubyte		2		\b, high precision
1375#>>3	ubyte		x		BPC=%#x
1376# DIMENSION; allowed values are 1~scanline 2~XSIZExYSIZE 3~XSIZExYSIZExZSIZE
1377>>4	ubeshort	x		\b, %d-D
1378# XSIZE; width of image in pixels
1379>>6	ubeshort	x		\b, %d x
1380# YSIZE; height of image in pixels
1381>>8	ubeshort	x		%d
1382# ZSIZE; number of channels in image; 1~B/W (greyscale) 3~RGB 4~RGB+ALPHA channel
1383>>10	ubeshort	x		\b, %d
1384# GRR: avoid
1385# Magdir\images, 1347: Warning: Current entry does not yet have a description for adding a EXTENSION type
1386>>>10	ubeshort	1		channel
1387# GRR: exception https://sembiance.com/fileFormatSamples/image/sgi/greytest.rgb
1388!:ext	bw
1389# no examples found with .int suffix
1390#!:ext	bw/int
1391# no examples found with .inta suffix for black/white+ALPHA channel
1392# no examples found with 2 channels
1393#>>>10	ubeshort	2		channels
1394#!:ext	sgi
1395>>>10	ubeshort	3		channels
1396!:ext	rgb/sgi
1397>>>10	ubeshort	4		channels
1398!:ext	rgba/sgi
1399>>>10	default		x		channels
1400# no examples found with 5 and more channels
1401!:ext	sgi
1402# IMAGENAME; null terminated ascii string of up to 79 characters
1403>>24	string		>\0		\b, "%0.80s"
1404# PINMIN; minimum pixel value in the image; often 0
1405>>12	ubelong		!0		\b, %u PINMIN
1406# PINMAX; maximum pixel value in the image; often 255
1407>>16	ubelong		!255		\b, %u PINMAX
1408# DUMMY; 4 bytes of data should be set to 0
1409>>20	ubelong		!0		\b, at 20 %#x
1410# COLORMAP; 0~normal 1~DITHEREDobsolete 2~SCREENobsolete 3~COLORMAP
1411>>104	ubelong		!0		\b, %u COLORMAP
1412# DUMMY; 404 bytes should be set to 0 but not always true; makes header exactly 512 bytes
1413>>111	ubyte		!0		\b, at 111 %#x
1414>>113	ubyte		!0		\b, at 113 %#x
1415>>118	ubeshort	!0		\b, at 118 %#4.4x
1416>>121	ubyte		!0		\b, at 121 %#x
1417>>132	ubelong		!0		\b, at 132 %#8.8x
1418>>135	ubyte		!0		\b, at 135 %#x
1419>>137	ubequad		!0		\b, at 137 %#16.16llx
1420
14210	string		IT01		FIT image data
1422>4	ubelong		x		\b, %d x
1423>8	ubelong		x		%d x
1424>12	ubelong		x		%d
1425#
14260	string		IT02		FIT image data
1427>4	ubelong		x		\b, %d x
1428>8	ubelong		x		%d x
1429>12	ubelong		x		%d
1430#
14312048	string		PCD_IPI		Kodak Photo CD image pack file
1432>0xe02	ubyte&0x03	0x00		, landscape mode
1433>0xe02	ubyte&0x03	0x01		, portrait mode
1434>0xe02	ubyte&0x03	0x02		, landscape mode
1435>0xe02	ubyte&0x03	0x03		, portrait mode
14360	string		PCD_OPA		Kodak Photo CD overview pack file
1437
1438# FITS format.  Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
1439# Update:	Joerg Jenderek
1440# URL:		http://fileformats.archiveteam.org/wiki/Flexible_Image_Transport_System
1441#		https://en.wikipedia.org/wiki/FITS
1442# Reference:	https://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-fts.trid.xml
1443# Note:		called "Flexible Image Transport System bitmap" by TrID, GIMP and DROID via PUID x-fmt/383
1444#		"FITS document" with expanded acronym "Flexible Image Transport System" by shared MIME-info database from freedesktop.org
1445#		verified as "Flexible Image Transport System" by XnView `nconvert -fullinfo M57.FIT MOON.FTS` ,
1446#		as "FTS (Flexible Image Transport System)" by ImageMagick command `identify MOON.FTS` ,
1447#		by NetPBM `fitstopnm M57.FIT | file` ,
1448#		falsified by `fitsverify M57.FIT MOON.FTS`
1449# FITS is the Flexible Image Transport System, the de facto standard for
1450# data and image transfer, storage, etc., for the astronomical community.
1451# (FITS floating point formats are big-endian.)
1452# keyword is a 1- to 8-character, left-justified ASCII string; columns that do not contain data are filled with spaces
1453# The assignment indicator (=) always occupies columns nine and ten in the card
14540	string	SIMPLE\ \ =
1455# skip DROID x-fmt-383-signature-id-57.fits by check for left padding spaces of 2nd card value
1456>89	ubeshort	=0x2020	FITS image
1457# URL:		https://heasarc.gsfc.nasa.gov/fitsio/fpack/
1458# Reference:	https://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-fz.trid.xml
1459#		https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/docs/fpackguide.pdf
1460# Note:		called "Flexible Image Transport System bitmap (compressed)" by TrID
1461>>240	search/0x4790/b	ZCMPTYPE=	data, compression type
1462# fz suffix for compressed fits
1463!:ext	fz
1464# Flexible Image Transport System compression value (followed by optional FITS comment) like: NOCOMPRESS GZIP_1 GZIP_2 HCOMPRESS_1 PLIO_1 RICE_1
1465#>>>&0	string		x		COMPRESSION=%0.13s
1466>>>&0	regex		[A-Z_1-2]{4,11}	%s
1467# not compressed Flexible Image Transport System with other filename suffix
1468>>240	default		x		data
1469!:ext	fits/fit/fts
1470# five keywords that are required in every FITS file: SIMPLE, BITPIX, NAXIS, NAXISn, and END. EXTEND is also a required keyword if extensions are present in the file
1471# required keyword in standard on 3rd card contains integer number of bits used to represent each data value but in 2nd card for M57.FIT
1472>>80	search/81/b	BITPIX\040\040=
1473#>>>&11	string	x		BIT=%-0.18s
1474# this is the number of bits per pixel for image data
1475>>>&20	string	8		\b, 8-bit, character or unsigned binary integer
1476# few samples with more right positioned values like: M57.FIT
1477# GRR: avoid warning: Magdir\images, 1380: Warning: description `, 8-bit, character or unsigned binary integer (too right positioned)' truncated
1478>>>&28	string	8		\b, 8-bit, character or unsigned binary integer
1479>>>>0	string	x		(too right positioned)
1480# few samples not right justified positioned like: MOON.FTS
1481>>>&11	string	8		\b, 8-bit, character or unsigned binary integer
1482>>>>0	string	x		(too left positioned)
1483# according to DROID but no examples found
1484#>>>&19	string	08		\b, 8-bit, character or unsigned binary integer
1485#>>>&19	string	+8		\b, 8-bit, character or unsigned binary integer
1486>>>&19	string	16		\b, 16-bit, two's complement binary integer
1487>>>&18	string	\04032		\b, 32-bit, two's complement binary integer
1488>>>&18	string	-32		\b, 32-bit, floating point, single precision
1489>>>&18	string	-64		\b, 64-bit, floating point, double precision
1490# second 64-bit variant like: blank.fits
1491>>>&18	string	\04064		\b, 64-bit, two's complement binary integer
1492# in standard number of dimensions by keyword NAXIS on 3rd card image but in few cases on 2nd card like: M57.FIT
1493>>80	search/81/b	NAXIS\040\040\040=		\b,
1494# before optional comment 31 ASCII charactes left padded with spaces for integer (0-999) of data axis like: 0 (extension no data) 1 (spectrum) 2 (conventional bitmap) 3 (animated bitmap example.fit test.fits) 6 (DDTSUVDATA.fits)
1495#>>>>&0	string		x		NAXIS=%-0.31s
1496# single digit 0 implies no data or similar
1497>>>&0	search/31/b	\0400\040	0 axes
1498!:mime	application/fits
1499# single digit 1 implies one-dimensional entity such as a spectrum or a time series (no example found)
1500>>>&-1	search/31/b	\0401\040	1 axis
1501!:mime	application/fits
1502#!:mime	image/fits
1503# single digit 2 implies conventional bitmap
1504>>>&0	search/31/b	\0402\040	2 axes
1505!:mime	image/fits
1506# single digit 3 implies data cubes of three dimensions (animated bitmap or similar)
1507>>>&0	search/31/b	\0403\040	3 axes
1508!:mime	image/fits
1509# data cubes more dimensions like: 5 (group.fits) 6 (DDTSUVDATA.fits)
1510>>>&0	default		x
1511>>>>&0	regex/31/s	=[0-9]{1,3} 	%s axis
1512!:mime	application/fits
1513# often NAXIS1 as 4th card but sometimes at higher offset like: 29400 (IUElwp25637mxlo.fits) 20400 (NICMOSn4hk12010_mos.fits)
1514>>240	search/29400/bs	NAXIS1\040\040=		\b,
1515# before optional comment 31 ASCII charactes left padded with spaces for first axis like: 192 512 1024 1200 2000 2064 3600 ...
1516>>>&9	regex	=[0-9]{1,31} 	%s
1517# often NAXIS2 as 5th card but sometimes not existent or at higher offset like: 29120 (IUElwp25637mxlo.fits) 20480 (NICMOSn4hk12010_mos.fits)
1518>>>320	search/29120/bs	NAXIS2\040\040=		x
1519# before optional comment 31 ASCII charactes left padded with spaces for second axis like: 2 4 165 512 800 1024 3600 ...
1520>>>>&9	regex	=[0-9]{1,31} 	%s
1521# not standard cards
1522>>80	string	!BITPIX\040\040= \b, at 80
1523# in M57.FIT like: "NAXIS   ="
1524>>>80	string	x		"%-0.9s"
1525>>160	string	!NAXIS\040\040\040= \b, at 160
1526# in M57.FIT like: "BITPIX  ="
1527>>>160	string	x		"%-0.9s"
1528
1529# other images
15300	string	This\ is\ a\ BitMap\ file	Lisp Machine bit-array-file
1531
1532# From SunOS 5.5.1 "/etc/magic" - appeared right before Sun raster image
1533# stuff.
1534#
15350	ubeshort		0x1010		PEX Binary Archive
1536
1537# DICOM medical imaging data
1538# URL:		https://en.wikipedia.org/wiki/DICOM#Data_format
1539# Note:		"dcm" is the official file name extension
1540# 		XnView mention also "dc3" and "acr" as file name extension
1541128	string	DICM			DICOM medical imaging data
1542!:mime	application/dicom
1543!:ext dcm/dicom/dic
1544
1545# XWD - X Window Dump file.
1546# URL:		http://fileformats.archiveteam.org/wiki/XWD
1547# Reference:	https://wiki.multimedia.cx/index.php?title=XWD
1548#		http://mark0.net/download/triddefs_xml.7z/defs/x/xdm-x11.trid.xml
1549# Note:		called "X-Windows Screen Dump (X11)" by TrID and
1550#		"X-Windows Screen Dump" version X11 by DROID via PUID fmt/483
1551#		verfied by XnView `nconvert -in xwd -info *`
1552#		and ImageMagick 6.9.11 `identify -verbose *` as XWD X Windows system window dump
1553#		and `xwud -in fig41.wxd -dumpheader`
1554#   As described in /usr/X11R6/include/X11/XWDFile.h
1555#   used by the xwd program.
1556#   Bradford Castalia, idaeim, 1/01
1557#   updated by Adam Buchbinder, 2/09 and Joerg Jenderek, May 2022
1558# The following assumes version 7 of the format; the first long is the length
1559# of the header, which is at least 25 4-byte longs, and the one at offset 8
1560# is a constant which is always either 1 or 2. Offset 12 is the pixmap depth,
1561# which is a maximum of 32.
1562# Size of the entire file header (bytes) like: 100 104 105 106 107 109 110 113 114 115 118 172
15630	ubelong	>99
1564# pixmap_format; Pixmap format; 0~1-bit (XYBitmap) format 1~single-plane (XYPixmap) 2~bitmap with two or more planes (ZPixmap)
1565>8	ubelong	<3
1566# pixmap_depth; Pixmap depth; value 1 - 32
1567>>12	ubelong	<33
1568# file_version; XWD_FILE_VERSION=7
1569>>>4	ubelong	7
1570# skip DROID fmt-401-signature-id-618.xwd by test for existing border field
1571>>>>96	ubelong	x			X-Window screen dump image data, version X11
1572# ./images (version 1.205) labeled the above entry as "XWD X Window Dump image data"
1573# https://reposcope.com/mimetype/image/x-xwindowdump
1574!:mime	image/x-xwindowdump
1575#!:ext	xwd
1576!:ext	xwd/dmp
1577# https://www.xnview.com/en/image_formats/ NO example with x11 suffix FOUND!
1578#!:ext	xwd/dmp/x11
1579# https://www.nationalarchives.gov.uk/PRONOM/fmt/401 NO example with xdm suffix FOUND!
1580#!:ext	xwd/dmp/x11/xmd
1581# file comment if header > 100; so not in MARBLES.XWD and hardcopy-x-window-v11.xwd
1582>>>>>0	ubelong	>100
1583# comment or windows name
1584>>>>>>100 string	>\0			\b, "%s"
1585# pixmap_width;	pixmap width like: 576 800 1014 1280 1419 NOT -1414812757=abABabABh
1586>>>>>16	ubelong	x			\b, %dx
1587# pixmap_height; pixmap height like: 449 454 600 704 720 1001 1024 NOT -1414812757=abABabABh
1588>>>>>20	ubelong	x			\b%dx
1589# pixmap_depth;	pixmap depth
1590>>>>>12	ubelong	x			\b%d
1591# XOffset; Bitmap X offset; pixel numbers to ignore at the beginning of each scan-line
1592#>>>>>24	ubelong	x			\b, %u ignore
1593# ByteOrder; byte order of image data: 0~least significant byte first 1~most significant byte first
1594>>>>>28	ubelong	>0			\b, order %u
1595# BitmapUnit; bitmap base data size unit in each scan line like: 8 16 32
1596#>>>>>32	ubelong	x			\b, unit %u
1597# BitmapBitOrder; bit-order of image data; apparently same as ByteOrder
1598#>>>>>36	ubelong	x			\b, bit order %u
1599# BitmapPad; number of padding bits added to each scan line like: 8 16 32
1600#>>>>>40	ubelong	x			\b, pad %u
1601# BitsPerPixel; Bits per pixel: 1~StaticGray and GrayScale 2-15~StaticColor and PseudoColor 16,24,32~TrueColor and DirectColor
1602#>>>>>44	ubelong	x			\b, %u bits/pixel
1603# BytesPerLine; size of each scan line in bytes
1604#>>>>>48	ubelong	x			\b, %u bytes/line
1605# VisualClass; class of the image: 0~StaticGray 1~GrayScale 2~StaticColor 3~PseudoColor 4~TrueColor 5~DirectColor
1606#>>>>>52	ubelong	x			\b, %u Class
1607# RedMask; red RGB mask values used by ZPixmaps like: 0 0xff0000
1608#>>>>>56	ubelong	!0			\b, %#x red
1609# GreenMask; green mask like: 0
1610#>>>>>60	ubelong	!0			\b, %#x green
1611# BlueMask; blue mask like: 0 0xff
1612#>>>>>64	ubelong	!0			\b, %#x blue
1613# BitsPerRgb; Size of each color mask in bits like: 0 1 8 24
1614#>>>>>68	ubelong	x			\b, %u bits/RGB
1615# NumberOfColors; number of colors in image like: 256 4 2 0 (WHAT DOES THIS MEAN?)
1616>>>>>72	ubelong	x			\b, %u colors
1617# ColorMapEntries; number of entries in color map like: 256 16 2 0~no color map
1618>>>>>76	ubelong	x			%u entries
1619# WindowWidth; window width
1620#>>>>>80	ubelong	x			\b, %u width
1621# WindowHeight; window height
1622#>>>>>84	ubelong	x			\b, %u height
1623# WindowX; Window upper left X coordinate like: 0 24 32 80 237 290 422 466 568 (lenna.dmp)
1624>>>>>88	ubelong	!0			\b, x=%d
1625# WindowY; Window upper left Y coordinate like: 0 8 18 26 60 73 107 (fig41.xwd) 128
1626>>>>>92	ubelong	!0			\b, y=%d
1627# WindowBorderWidth; Window border width; apparently pixmap_width=WindowWidth+2*WindowBorderWidth
1628# like: 1 (fig41.xwd) 2 (maze.dmp) 3 (lenna.dmp mandrill.dmp)
1629>>>>>96	ubelong	>0			\b, %u border
1630# From:		Joerg Jenderek
1631# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/x/xdm-x10.trid.xml
1632# Note:		called "X-Windows Screen Dump (X10)" by TrID and
1633#		"X-Windows Screen Dump" version X10 by DROID via PUID x-fmt/300
1634#		verfied by XnView `nconvert -in xwd -info *`
1635# HeaderSize is the size of the header in bytes; always 40 for X10 variant
16360	ubelong		=0x000000028
1637# FileVersion; always 6 for X10 variant
1638>4	ubelong		=6
1639# skip DROID x-fmt-300-signature-id-619.xdm by test existing border field
1640>>36	ubeshort	x		X-Window screen dump image data, version X10
1641!:mime	image/x-xwindowdump
1642!:ext	xwd
1643# http://www.nationalarchives.gov.uk/pronom/fmt/401 NO example with xdm suffix FOUND!
1644#!:ext	xwd/xdm
1645# PixmapWidth; pixmap width like: 127 1280
1646>>>20	ubelong		x		\b, %d
1647# PixmapHeight; pixmap height like: 64 1024
1648>>>24	ubelong		x		\bx%d
1649# DisplayPlanes; number of display planes like: 1 4 8
1650>>>12	ubelong		x		\bx%u
1651# DisplayType; display type like: 1 3
1652#>>>8	ubelong		x		\b, type %u
1653# PixmapFormat; pixmap format like: 1~bitmap with two or more planes (ZPixmap) 0~single-plane bitmap (XYBitmap)
1654#>>>16	ubelong	x			\b, %u format
1655# WindowWidth; window width; probably PixmapWidth=WindowWidth+2*WindowBorderWidth
1656#>>>28	ubeshort	x		\b, width %u
1657# WindowHeight;  window height; probably PixmapWidth=PixmapHeight+2*WindowBorderWidth
1658#>>>30	ubeshort	x		\b, height %u
1659# WindowX; window upper left X coordinate like: 0
1660>>>32	ubeshort		!0	\b, x=%d
1661# WindowY; window upper left Y coordinate like: 0
1662>>>34	ubeshort		!0	\b, y=%d
1663# WindowBorderWidth; window border width like: 0
1664>>>36	ubeshort	!0		\b, %u border
1665# WindowNumColors; Number of color entries in window like: 2 16 256
1666#>>>38	ubeshort	x		\b, %u colors
1667# if the image is a PseudoColor image, a color map immediately follows the header. X10COLORMAP[WindowNumColors];
1668# EntryNumber; number of the color-map entry like: 0
1669#>>>40	ubeshort	x		\b, colors #%u
1670# Red; red-channel value
1671#>>>42	ubeshort	!0		\b, red %#x
1672# Green; green-channel value
1673#>>>44	ubeshort	!0		\b, green %#x
1674# Blue; blue-channel value
1675#>>>46	ubeshort	!0		\b, blue %#x
1676# 2ND Entry like: 2
1677#>>>48	ubeshort	x		\b, colors #%u
1678
1679# PDS - Planetary Data System
1680#   These files use Parameter Value Language in the header section.
1681#   Unfortunately, there is no certain magic, but the following
1682#   strings have been found to be most likely.
16830	string	NJPL1I00		PDS (JPL) image data
16842	string	NJPL1I			PDS (JPL) image data
16850	string	CCSD3ZF			PDS (CCSD) image data
16862	string	CCSD3Z			PDS (CCSD) image data
16870	string	PDS_			PDS image data
16880	string	LBLSIZE=		PDS (VICAR) image data
1689
1690# pM8x: ATARI STAD compressed bitmap format
1691#
1692# from Oskar Schirmer <schirmer@scara.com> Feb 2, 2001
1693# p M 8 5/6 xx yy zz data...
1694# Atari ST STAD bitmap is always 640x400, bytewise runlength compressed.
1695# bytes either run horizontally (pM85) or vertically (pM86). yy is the
1696# most frequent byte, xx and zz are runlength escape codes, where xx is
1697# used for runs of yy.
1698#
16990	string	pM85		Atari ST STAD bitmap image data (hor)
1700>5	ubyte	0x00		(white background)
1701>5	ubyte	0xFF		(black background)
17020	string	pM86		Atari ST STAD bitmap image data (vert)
1703>5	ubyte	0x00		(white background)
1704>5	ubyte	0xFF		(black background)
1705
1706# From: Alex Myczko <alex@aiei.ch>
1707# https://www.atarimax.com/jindroush.atari.org/afmtatr.html
17080	uleshort	0x0296		Atari ATR image
1709
1710# URL:		http://fileformats.archiveteam.org/wiki/DEGAS_image
1711# Reference:	https://wiki.multimedia.cx/index.php?title=Degas
1712# From:		Joerg Jenderek
1713#		http://mark0.net/download/triddefs_xml.7z/defs/b
1714#		bitmap-pi2-degas.trid.xml bitmap-pi3-degas.trid.xml
1715#		bitmap-pc1-degas.trid.xml bitmap-pc2-degas.trid.xml bitmap-pc3-degas.trid.xml
1716# Note:		verified by NetPBM `pi3topbm sigirl1.pi3 | file`
1717# 		`deark -m degas -l -d2 ataribak.pi1`
1718#		XnView `nconvert -fullinfo *.p??`
1719# DEGAS low-res uncompressed bitmap *.pi1
17200		beshort		0x0000
1721# skip some ISO 9660 CD-ROM filesystems like plpbt.iso by test for 4 non black colors in palette entries
1722>2		quad		!0
1723# skip g3test.g3 by test for unused bits of 2nd color entry
1724>>4		ubeshort&0xF000	0
1725#>>>0		beshort	x	1ST_VALUE=%x
1726#>>>-0		offset	x	FILE_SIZE=%lld
1727# standard DEGAS low-res uncompressed bitmap *.pi1 with file size 32034
1728>>>-0		offset	=32034
1729#>>>>0		beshort	x	1st_VALUE=%x
1730# like: 8ball.pi1 teddy.pi1 sonic01.pi1
1731>>>>0		use		degas-bitmap
1732# about 61 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 32066
1733>>>-0		offset	=32066
1734# like: spider.pi1 pinkgirl.pi1 frog3.pi1
1735>>>>0		use		degas-bitmap
1736# about 55 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 32128
1737>>>-0		offset	=32128
1738# like: mountain.pi1 bigspid.pi1 alf33.pi1
1739>>>>0		use		degas-bitmap
1740# 1 DEGAS Elite low-res uncompressed bitmap *.pi1 with file size 44834
1741>>>-0		offset	=44834
1742# like: kenshin.pi1
1743>>>>0		use		degas-bitmap
1744# DEGAS mid-res uncompressed bitmap *.pi2 (strength=50) after GEM Images like:
1745# BEETHVEN.IMG CHURCH.IMG GAMEOVR4.IMG TURKEY.IMG clinton.img
17460		beshort		0x0001
1747#!:strength +0
1748# skip many control files like gnucash-4.8.setup.exe.aria2 by test for non black in 4 palette entries
1749>2		quad		!0
1750# skip control file load-v0001.aria2 and many GEM Image data like
1751# GAMEOVR4.IMG BEETHVEN.IMG CHURCH.IMG TURKEY.IMG clinton.img
1752# by test for valid file sizes
1753# standard DEGAS mid-res uncompressed bitmap *.pi2 with file size 32034
1754>>-0		offset	=32034
1755# (39/41) like: GEMINI03.PI2 ST_TOOLS.PI2 TBX_DEMO.PI2
1756>>>0		use		degas-bitmap
1757# few DEGAS Elite mid-res uncompressed bitmap *.pi2 with file size 32066
1758>>-0		offset	=32066
1759# (2/41) like: medres.pi2
1760>>>0		use		degas-bitmap
1761# GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
1762# Format variations from: Bernd Nuernberger <bernd.nuernberger@web.de>
1763# Update: Joerg Jenderek
1764# See http://fileformats.archiveteam.org/wiki/GEM_Raster
1765# For variations, also see:
1766#    https://www.seasip.info/Gem/ff_img.html (Ventura)
1767#    http://www.atari-wiki.com/?title=IMG_file (XIMG, STTT)
1768#    http://www.fileformat.info/format/gemraster/spec/index.htm (XIMG, STTT)
1769#    http://sylvana.net/1stguide/1STGUIDE.ENG (TIMG)
1770# header_size
1771>2      beshort     0x0008
1772>>0     use gem_info
1773>2      beshort     0x0009
1774>>0     use gem_info
1775# no example for NOSIG
1776>2      beshort     24
1777>>0     use gem_info
1778# no example for HYPERPAINT
1779>2      beshort     25
1780>>0     use gem_info
178116      string      XIMG\0
1782>0      use gem_info
1783# no example
178416      string      STTT\0\x10
1785>0      use gem_info
1786# no example or description
178716      string      TIMG\0
1788>0      use gem_info
1789
1790# DEGAS high-res uncompressed bitmap *.pi3
17910	beshort		0x0002
1792# skip Intel ia64 COFF msvcrt.lib by test for unused bits of 1st atari color palette entry
1793>2		ubeshort&0xF000	0
1794# skip few Adobe PhotoShop Brushes like Faux-Spitzen.abr by check
1795# for invalid Adobe PhotoShop Brush UTF16-LE string length
1796>>19		ubyte			=0
1797# many like: 4th_ofj2.pi3 GEMINI03.PI3 PEOPLE18.PI3 POWERFIX.PI3 abydos.pi3 highres.pi3 sigirl1.pi3 vanna5.pi3
1798>>>0		use		degas-bitmap
1799# Adobe PhotoShop Brush UTF16-LE string length 15 "Gitter - klein " 8 "Kreis 1 "
1800>>19		ubyte			!0
1801#>>19		ubyte			!0	\b, NOTE LENGTH %u
1802#>>>21		lestring16		x	\b, BRUSH NOTE "%s"
1803>>>(19.b*2)	ubequad			x
1804# maybe last character of Adobe PhotoShop Brush UTF16-LE string and terminating nul char like
1805# 006e0000 for n in "Faux-Spitzen.abr" 00310000 for 1 in "Verschiedene Spitzen.abr"
1806# 00000000 "LEREDACT.PI3" 03730773 "TBX_DEMO.PI3"
1807#>>>>&8		ubelong			x	\b, LAST CHAR+NIL %8.8x
1808>>>>&8		ubelong&0xff00ffFF	!0
1809# skip many Adobe Photoshop Color swatch (ANPA-Farben.aco TOYO-Farbsystem.aco) with invalid 3rd color entry (1319 2201 2206 21f5 2480 24db 25fd)
1810>>>>>6		ubeshort&0xF000	0
1811# skip few Adobe Photoshop Color swatch (FOCOLTONE-Farben.aco "PANTONE process coated.aco") with invalid 4th color entry  (ffff)
1812>>>>>>8		ubeshort&0xF000	0
1813# 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
1814>>>>>>>0	use		degas-bitmap
1815# test for last character of Adobe PhotoShop Brush UTF16-LE string and terminating nul char
1816>>>>&8		ubelong&0xff00ffFF	=0
1817# select last DEGAS bitmaps by invalid last char of brush note like BASICNES.PI3 DB_HELP.PI3 DB_WRITR.PI3 LEREDACT.PI3
1818>>>>>&-4	ubelong&0x00FF0000	<0x00200000
1819>>>>>>0		use		degas-bitmap
1820# last character of Adobe PhotoShop Brush UTF16-LE note
1821#>>>>>&-4	ubelong&0x00FF0000	>0x001F0000	\b, THAT IS ABR
1822# DEGAS low-res compressed bitmap *.pc1 like: BATTLSHP.PC1 GNUCHESS.PC1 MEDUSABL.PC1 MOONLORD.PC1 WILDROSE.PC1
18230		beshort			0x8000
1824# skip lif files handled via ./lif by test for unused bits of 1st palette entry
1825>2		ubeshort&0xF000		0
1826# skip CRI ADX ADPCM audio (R04HT.adx R03T-15552.adx) with 44100 Hz misinterpreted as 5th color entry value AC44h
1827>>10		ubeshort&0xF000		0
1828# skip few (fmt-840-signature-id-1195.adx fmt-840-signature-id-1199.adx) by test for 4 first non black colors in palette entries
1829>>>2		quad			!0
1830>>>>0		use		degas-bitmap
1831# DEGAS mid-res compressed bitmap *.pc2 like: abydos.pc2 ARTIS3.PC2 SMTHDRAW.PC2 STAR_2K.PC2 TX2_DEMO.PC2
18320		beshort			0x8001
1833# skip many (1274/1369) PostScript Type 1 font (DarkGardenMK.pfb coupbi.pfb MONOBOLD.PFB) with invalid 1st atari color palette entry 5506 5b06 6906 7906 7e06 fb15
1834>2		ubeshort&0xF000		0
1835# skip some (95/1369) PostScript Type 1 font (fmt-525-signature-id-816.pfb LUXEMBRG.PFB) with invalid 3rd atari color palette entry 2521
1836>>6		ubeshort&0xF000		0
1837>>>0		use		degas-bitmap
1838# DEGAS high-res compressed bitmap *.pc3 like: abydos.pc3 COYOTE.PC3 ELEPHANT.PC3 TX2_DEMO.PC3 SMTHDRAW.PC3
18390		beshort			0x8002
1840# skip some (36/212) Python Pickle (factor_cache.pickle environment.pickle) with invalid 1st atari color entry (2863 6363 7d71)
1841>2		ubeshort&0xF000		0
1842>>0		use		degas-bitmap
1843# display information of Atari DEGAS and DEGAS Elite bitmap images
18440	name		degas-bitmap
1845>0	ubyte		x		Atari DEGAS
1846#!:mime	application/octet-stream
1847!:mime	image/x-atari-degas
1848# compressed
1849>0	ubyte		=0x80		Elite compressed
1850# uncompressed
1851#>0	ubyte		=0x00		uncompressed
1852#>0	ubyte		=0x00		un.
1853>0	ubyte		=0x00
1854# check for existence of footer for DEGAS Elite images
1855>>32042	ubequad		x		Elite
1856>0	beshort		0x0000		bitmap
1857!:ext	pi1
1858>0	beshort		0x0001		bitmap
1859!:ext	pi2
1860>0	beshort		0x0002		bitmap
1861# no example with SUH extension found
1862#!:ext	pi3/suh
1863!:ext	pi3
1864>0	beshort		0x8000		bitmap
1865!:ext	pc1
1866>0	beshort		0x8001		bitmap
1867!:ext	pc2
1868>0	beshort		0x8002		bitmap
1869!:ext	pc3
1870# low resolution; 320x200, 16 colors
1871>1	ubyte		=0		320 x 200 x 16
1872# medium resolution; 640x200, 4 colors
1873>1	ubyte		=1		640 x 200 x 4
1874# high resolution; 640x400, 2 colors
1875>1	ubyte		=2		640 x 400 x 2
1876# http://fileformats.archiveteam.org/wiki/Atari_ST_color_palette
1877# hardware_palette[16]; 9 bit ?????RRR?GGG?BBB; 12 bit ????RRRRGGGGBBBB for Atari STE
1878# for Atari DEGAS apparently no Spectrum 512 Enhanced 15 bit palette RGB?RRRRGGGGBBBB
1879# Red Green Blue unused bit ? often 0 but not bilboule.pi1; color_value (examples or numbers)
1880# 1st color palette entry like: 0777 (61) 0fff (LEREDACT.PI3) 0fcf (devgem7.pi3) 0001 (9)
1881>2	ubeshort	x		\b, color palette %4.4x
1882# 2nd palette entry like: 0000 (32) 0700 (38) 0f00 (LEREDACT.PI3 devgem7.pi3)
1883>4	ubeshort	x		%4.4x
1884# 3rd palette entry
1885>6	ubeshort	x		%4.4x
1886# 4th palette entry like: 0000 (72)
1887>8	ubeshort	x		%4.4x
1888# 5th palette entry
1889>10	ubeshort	x		%4.4x
1890>2	ubeshort	x		...
1891# 6th palette entry
1892#>12	ubeshort	x		%4.4x
1893# 7th palette entry like: 0000 (16) 0001 (ELMRSESN.PI3 elmrsesn.pi3) 0070 (51) 00f0 (BASICNES.PI3 LEREDACT.PI3) 00f8 (devgem7.pi3)
1894#>14	ubeshort	x		%4.4x
1895# 8th palette entry
1896#>16	ubeshort	x		%4.4x
1897# 9 palette entry
1898#>18	ubeshort	x		%4.4x
1899# 10 palette entry
1900#>20	ubeshort	x		%4.4x
1901# 11 palette entry
1902#>22	ubeshort	x		%4.4x
1903# 12 palette entry
1904#>24	ubeshort	x		%4.4x
1905# 13 palette entry
1906#>26	ubeshort	x		%4.4x
1907# 14th palette entry
1908#>28	ubeshort	x		%4.4x
1909# 15th palette entry
1910#>30	ubeshort	x		%4.4x
1911# 16th palette entry
1912#>32	ubeshort	x		%4.4x
1913# data[16000] for uncompressed images; pixel data
1914#>34	ubequad		x		\b, DATA %#16.16llx...
1915# footer for Elite variant images
1916# https://www.fileformat.info/format/atari/egff.htm
1917# https://pulkomandy.tk/projects/GrafX2/wiki/Develop/FileFormats/Atari
1918# left_color_animation[4]; like: 0000000000000000 0000000100020003 fffafff000000030 (bigspid.pi1)
1919#>32034  ubequad		!0		\b, color animations %16.16llx (left)
1920# right_color_animation[4]; like: 0000000000000000 0000000100020003
1921#>>32042  ubequad	!0		%16.16llx (right)
1922# channel_direction[4]; 0~left 1~none 2~right like: 0001000100010001 0002000000010001 (cycle2.pi1)
1923# sometimes unexpected like: feaafc0000000000 (bigspid.pi1)
1924#>32050  ubequad		!0		\b, channel directions %16.16llx
1925# channel_delay[4]; 128 - channel delay, timebase 1/60 s
1926#>32058  ubequad		!0		\b, channel delays %16.16llx
1927
1928# From:		Joerg Jenderek
1929# URL:		http://fileformats.archiveteam.org/wiki/GED
1930#		https://recoil.sourceforge.net/formats.html#Atari-8-bit
1931# Reference:	https://sourceforge.net/projects/recoil/files/recoil/6.3.4/recoil-6.3.4.tar.gz
1932#		recoil-6.3.4/recoil.c
1933#		http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-ged.trid.xml
1934# Note:		called "Atari GED bitmap" by TrID; file size 11302
1935#		and verified by RECOIL graphic tool
19360	string		\xFF\xFF0SO\x7F		Atari GED bitmap, 160x200
1937#!:mime	application/octet-stream
1938!:mime	image/x-atari-ged
1939!:ext	ged
1940
1941# From:		Joerg Jenderek
1942# URL:		http://fileformats.archiveteam.org/wiki/ImageLab/PrintTechnic
1943# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-b_w.trid.xml
1944# Note:		called "ImageLab bitmap" by TrID
1945#		verfied by XnView `nconvert -fullinfo "MAEDCHEN.B&W"`
19460	string		B&W256	ImageLab bitmap
1947!:mime	image/x-ilab
1948#	https://www.xnview.com/de/image_formats/
1949# GRR: add char & inside parse_ext in ../../src/apprentice.c to avoid in file version 5.40 error like:
1950# Magdir\images, 1090: Warning: EXTENSION type `        b_w/b&w' has bad char '&'
1951!:ext	b_w/b&w
1952# Width
1953>6	ubeshort	x	\b, %u
1954# Height
1955>8	ubeshort	x	x %u
1956
1957# XXX:
1958# This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
1959# magic.
1960# SGI RICE image file <mpruett@sgi.com>
1961#0	ubeshort	0x5249		RICE image
1962#>2	ubeshort	x		v%d
1963#>4	ubeshort	x		(%d x
1964#>6	ubeshort	x		%d)
1965#>8	ubeshort	0		8 bit
1966#>8	ubeshort	1		10 bit
1967#>8	ubeshort	2		12 bit
1968#>8	ubeshort	3		13 bit
1969#>10	ubeshort	0		4:2:2
1970#>10	ubeshort	1		4:2:2:4
1971#>10	ubeshort	2		4:4:4
1972#>10	ubeshort	3		4:4:4:4
1973#>12	ubeshort	1		RGB
1974#>12	ubeshort	2		CCIR601
1975#>12	ubeshort	3		RP175
1976#>12	ubeshort	4		YUV
1977
1978# PCX image files
1979# From: Dan Fandrich <dan@coneharvesters.com>
1980# updated by Joerg Jenderek at Feb 2013, Nov 2023 by https://en.wikipedia.org/wiki/PCX
1981# https://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
1982# URL:		http://fileformats.archiveteam.org/wiki/PCX
1983# Note:		called "PCX image" with acronym "PiCture eXchange" by shared MIME-info database from freedesktop.org
1984#		verfied partly as pcx "Zsoft Paintbrush" format by XnView `nconvert -in pcx -fullinfo *.pcx` and
1985#		by ImageMagick version 7.1.1-21 command `identify *.pcx`
1986# GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
1987# 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
19880	ubelong&0xffF8fe00	0x0a000000
1989# for PCX bit depth > 0
1990>3	ubyte		>0
1991# test for valid versions
1992>>1	ubyte		<6
1993>>>1	ubyte		!1
1994# skip DROID fmt-89-signature-id-62.pcx fmt-88-signature-id-63.pcx fmt-87-signature-id-64.pcx fmt-86-signature-id-65.pcx with invalid dimensions
1995>>>>8	long		!0	PCX
1996!:mime	image/vnd.zbrush.pcx
1997# deprecated
1998#!:mime	image/x-pcx
1999!:ext	pcx/pcc
2000# also examples like: abydos.st E-DIODE.ST MUSIC-13.ST ROSE.ST
2001#!:ext	pcx/pcc/st
2002# Note:		called as "PCX bitmap (v2.5)" by TrID via bitmap-pcx.trid.xml and "PCX" version 0 by DROID via PUID fmt/86
2003>>>>>1	ubyte		0	ver. 2.5 image data
2004# Note:		called as "PCX bitmap (v2.8, palette)" by TrID via bitmap-pcx-v28p.trid.xml and "PCX" version 2 by DROID via PUID fmt/87
2005>>>>>1	ubyte		2	ver. 2.8 image data, with palette
2006# Note:		called as "PCX bitmap (v2.8)" by TrID via bitmap-pcx-v28.trid.xml and "PCX" version 3 by DROID via PUID fmt/88
2007>>>>>1	ubyte		3	ver. 2.8 image data, without palette
2008# Note:		called as "PCX bitmap (Win)" by TrID via bitmap-pcx-win.trid.xml and "PCX" version 4 by DROID via PUID fmt/89
2009>>>>>1	ubyte		4	for Windows image data
2010# Note:		called as "PCX bitmap (v3.0) by TrID via bitmap-pcx-v30.trid.xml and "PCX" version 5 by DROID via PUID fmt/90
2011>>>>>1	ubyte		5	ver. 3.0 image data
2012>>>>>4	uleshort	x	bounding box [%d,
2013>>>>>6	uleshort	x	%d] -
2014>>>>>8	uleshort	x	[%d,
2015>>>>>10	uleshort	x	%d],
2016>>>>>65	ubyte		>1	%d planes each of
2017>>>>>3	ubyte		x	%d-bit
2018>>>>>68	ubyte		1	colour,
2019>>>>>68	ubyte		2	grayscale,
2020# this should not happen
2021>>>>>68	default		x	image,
2022>>>>>12	uleshort	>0	%d x
2023>>>>>>14 uleshort	x	%d dpi,
2024>>>>>2	ubyte		0	uncompressed
2025>>>>>2	ubyte		1	RLE compressed
2026
2027# Adobe Photoshop
2028# From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
2029# URL: 		http://fileformats.archiveteam.org/wiki/PSD
2030# Reference:	https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
2031# Note:		verfied by XnView `nconvert -fullinfo *.psd *.psb *.pdd`
2032#		and ImageMagick `identify -verbose *.pdd`
20330	string		8BPS
2034# skip DROID x-fmt-92-signature-id-277.psd by checking valid width
2035>18	ubelong		>0	Adobe Photoshop
2036!:mime	image/vnd.adobe.photoshop
2037!:apple	????8BPS
2038# version: always equal to 1, but 2 for PSB
2039>>4   beshort 1
2040# URL: 		http://fileformats.archiveteam.org/wiki/PhotoDeluxe
2041# EXTRAS/PHOTOS/DEMOPIX/ORIGINAL.PDD
2042>>>34	search/0xC0d7	PHUT	Image (PhotoDeluxe)
2043!:ext	pdd
2044>>>34	default		x	Image
2045!:ext	psd
2046# URL: 		http://fileformats.archiveteam.org/wiki/PSB
2047>>4   beshort 2 Image (PSB)
2048!:ext	psb
2049# width in pixels: 1-30000 1-300000 for PSB
2050>>18  belong  x \b, %d x
2051>>14  belong  x %d,
2052# The color mode; 0~Bitmap 1~Grayscale 2~Indexed 3~RGB 4~CMYK 7~Multichannel 9~Duotone 9~Lab
2053>>24  beshort 0 bitmap
2054>>24  beshort 1 grayscale
2055# the number of channels; range is 1 to 56
2056>>>12 beshort 2 with alpha
2057>>24  beshort 2 indexed
2058>>24  beshort 3 RGB
2059>>>12 beshort 4 \bA
2060>>24  beshort 4 CMYK
2061>>>12 beshort 5 \bA
2062>>24  beshort 7 multichannel
2063>>24  beshort 8 duotone
2064>>24  beshort 9 lab
2065>>12  beshort > 1
2066>>>12 beshort x \b, %dx
2067>>12  beshort 1 \b,
2068>>22  beshort x %d-bit channel
2069>>12  beshort > 1 \bs
2070# 6 reserved bytes; must be zero, but spaces inside ImageMagick input.psd
2071# https://download.imagemagick.org/ImageMagick/download/ImageMagick-7.0.11-11.zip
2072# ImageMagick-7.0.11-11\PerlMagick\t\input.psd
2073>>6   bequad&0xFFffFFffFFff0000 !0 \b, at offset 6
2074>>>6  belong  x	 0x%8.8x
2075>>>6  beshort x   \b%4.4x
2076
2077# From:		Joerg Jenderek
2078# URL:		https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
2079#		http://fileformats.archiveteam.org/wiki/Photoshop
2080# Reference:	http://www.nomodes.com/aco.html
2081# Note:		registers as Photoshop.SwatchesFile for Photoshop.exe on Windows
2082# check for valid versions like: 2 (newest) 1 (old) 0 (oldest no examples)
20830		ubeshort				<3
2084# skip few Atari DEGAS med-res bitmap (DIAGRAM1.PI2) and many ISO 9660 CD-ROM by check for invalid low color numbers (0)
2085>2		ubeshort				>0
2086# skip few Targa (bmpsuite-15col.tga rgb24_top_left_colormap.tga) by check for invalid high color space ID (F0 1D)
2087>>4		ubeshort				<16
2088# skip many (69/327) Targa image *.TGA by check of accessing near the ending of first color space section (size=nc*5*2)
2089>>>(2.S*10)	ubelong					x
2090# RGB branch for Adobe Photoshop Color swatch
2091>>>>4		ubeshort				=0
2092# 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)
2093>>>>>12			ubeshort			=0
2094# RGB branch for Adobe Photoshop Color swatch for older versions
2095>>>>>>0				ubeshort		<2
2096>>>>>>>0				use		adobe-aco
2097# RGB branch for Adobe Photoshop Color swatch for newer version 2
2098>>>>>>0				ubeshort		=2
2099# skip many (74/176) Atari DEGAS hi-res bitmap (*.PI3) by check for invalid low color name length (0)
2100>>>>>>>16				ubeshort	>0
2101>>>>>>>>0					use	adobe-aco
2102# non RGB branch for Adobe Photoshop Color swatch
2103>>>>4		ubeshort				!0
2104# non RGB branch for Adobe Photoshop Color swatch for older versions
2105>>>>>0			ubeshort			<2
2106# skip many GEM Image (CHURCH.IMG TIGER.IMG) by check for invalid second high color space ID (55 114 143 157 256 288 450)
2107>>>>>>14			ubeshort		<16
2108>>>>>>>0				use		adobe-aco
2109# non RGB branch for Adobe Photoshop Color swatch for newer version 2
2110>>>>>0			ubeshort			=2
2111# 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
2112>>>>>>14			ubeshort		=0
2113>>>>>>>0				use		adobe-aco
2114#	display Adobe Photoshop Color swatch file information (version, number of colors, color spaces, coordinates, names)
21150	name		adobe-aco
2116>0		ubeshort				x		Adobe Photoshop Color swatch, version %u
2117#!:mime		application/octet-stream
2118!:mime		application/x-adobe-aco
2119!:apple		????8BCO
2120!:ext		aco
2121>0		ubeshort				<2
2122>>(2.S*10)	ubelong					x
2123# version 2 section after version 1 section
2124>>>&0		ubeshort				2		and 2
2125# nc; number of colors like: 20 50 86 88 126 204 300 1050 1137 1280 2092 3010 4096
2126>2		ubeshort				x		\b, %u colors
2127# maybe last 4 bytes of first section (probably y z color value) like: 0 0x66660000 0xfe700000 0xffff0000
2128#>(2.S*10)	ubelong					x		1ST_SECTION_END=%#8.8x
2129>0		ubeshort				<2		\b; 1st
2130# first older Adobe Photoshop Color entry
2131>>4			use				aco-color
2132>>>2				ubeshort		>1		\b; 2nd
2133# second older Adobe Photoshop Color entry
2134>>>>14					use		aco-color
2135>0		ubeshort				=2		\b; 1st
2136# first new Adobe Photoshop Color entry
2137>>4			use				aco-color-v2
2138>>>2				ubeshort		>1		\b; 2nd
2139# jump first color name length words
2140>>>>(16.S*2)				ubequad		x
2141# second new Adobe Photoshop Color entry
2142>>>>>&10					use	aco-color-v2
2143#	display Adobe Photoshop Color entry (color space, color coordinates)
21440	name		aco-color
2145# each color spec entry occupies five words
2146# color space: 0~RGB 1~HSB 2~CMYK 3~Pantone 4~Focoltone 5~Trumatch 6~Toyo 7~Lab 8~Grayscale 9?~wideCMYK 10~HKS ...
2147#>0		ubeshort				x		COLOR_ENTRY
2148>0		ubeshort				0		RGB
2149>0		ubeshort				1		HSB
2150>0		ubeshort				2		CMYK
2151>0		ubeshort				3		Pantone
2152>0		ubeshort				4		Focoltone
2153>0		ubeshort				5		Trumatch
2154>0		ubeshort				6		Toyo
2155>0		ubeshort				7		Lab
2156>0		ubeshort				8		Grayscale
2157>0		ubeshort				9		wide CMYK
2158>0		ubeshort				10		HKS
2159# unofficial
2160# >0		ubeshort				12		foo
2161# >0		ubeshort				13		bar
2162# >0		ubeshort				14		FOO
2163# >0		ubeshort				15		BAR
2164>0		ubeshort				x		space (%u)
2165# color coordinate w
2166>2		ubeshort				x		\b, w %#x
2167# color coordinate x
2168>4		ubeshort				x		\b, x %#x
2169# color coordinate y
2170>6		ubeshort				x		\b, y %#x
2171# color coordinate z; zero for RGB space
2172>8		ubeshort				x		\b, z %#x
2173#	display Adobe Photoshop Color entry version 2 (color space, color coordinates names)
21740	name		aco-color-v2
2175>0		use					aco-color
2176#>10		ubeshort				x		\b, NUL_BYTES %#x
2177# color name length plus one (len+1) like: 7 8 9 13 14 15 16 17 22 26
2178#>>12		ubeshort			 	x		\b, LENGTH %u
2179>>12		ubeshort-1				x		\b, %u chars
2180# len words; UTF-16 representation of the color name like: "DIC 1s" "PANTONE Process Yellow PC"
2181>>14		bestring16				x		"%s"
2182# followed by nil word
2183
2184# XV thumbnail indicator (ThMO)
2185# URL:		https://en.wikipedia.org/wiki/Xv_(software)
2186# Reference:	http://fileformats.archiveteam.org/wiki/XV_thumbnail
2187# Update:	Joerg Jenderek
21880	string		P7\ 332		XV thumbnail image data
2189#0	string		P7\ 332		XV "thumbnail file" (icon) data
2190!:mime	image/x-xv-thumbnail
2191# thumbnail .xvpic/foo.bar for graphic foo.bar
2192!:ext	p7/gif/tif/xpm/jpg
2193
2194# NITF is defined by United States MIL-STD-2500A
21950	string	NITF	National Imagery Transmission Format
2196>25	string	>\0	dated %.14s
2197
2198
21990   name        gem_info
2200# version is 2 for some XIMG and 1 for all others
2201>0	ubeshort		<0x0003		GEM
2202# https://www.snowstone.org.uk/riscos/mimeman/mimemap.txt
2203!:mime	image/x-gem
2204# header_size 24 25 27 59 779 words for colored bitmaps
2205>>2	ubeshort	>9
2206>>>16	string		STTT\0\x10	STTT
2207>>>16	string		TIMG\0		TIMG
2208# HYPERPAINT or NOSIG variant
2209>>>16	string		\0\x80
2210>>>>2	ubeshort	=24		NOSIG
2211>>>>2	ubeshort	!24		HYPERPAINT
2212# NOSIG or XIMG variant
2213>>>16	default		x
2214>>>>16	string		!XIMG\0		NOSIG
2215>>16	string		=XIMG\0		XIMG Image data
2216!:ext	img/ximg
2217# to avoid Warning: Current entry does not yet have a description for adding a EXTENSION type
2218>>16	string		!XIMG\0		Image data
2219!:ext	img
2220# header_size is 9 for Ventura files and 8 for other GEM Paint files
2221>>2	ubeshort	9		(Ventura)
2222#>>2	ubeshort	8		(Paint)
2223>>12	ubeshort	x		%d x
2224>>14	ubeshort	x		%d,
2225# 1 4 8
2226>>4	ubeshort	x		%d planes,
2227# in tenths of a millimetre
2228>>8	ubeshort	x		%d x
2229>>10	ubeshort	x		%d pixelsize
2230# pattern_size 1-8. 2 for GEM Paint
2231>>6	ubeshort	!2		\b, pattern size %d
2232
2233# GEM Metafile (Wolfram Kleff)
22340	ulelong		0x0018FFFF	GEM Metafile data
2235>4	uleshort	x		version %d
2236
2237#
2238# SMJPEG. A custom Motion JPEG format used by Loki Entertainment
2239# Software Torbjorn Andersson <d91tan@Update.UU.SE>.
2240#
22410	string	\0\nSMJPEG	SMJPEG
2242>8	ubelong	x		%d.x data
2243# According to the specification you could find any number of _TXT
2244# headers here, but I can't think of any way of handling that. None of
2245# the SMJPEG files I tried it on used this feature. Even if such a
2246# file is encountered the output should still be reasonable.
2247>16	string		_SND		\b,
2248>>24	ubeshort	>0		%d Hz
2249>>26	ubyte		8		8-bit
2250>>26	ubyte		16		16-bit
2251>>28	string		NONE		uncompressed
2252# >>28	string		APCM		ADPCM compressed
2253>>27	ubyte		1		mono
2254>>28	ubyte		2		stereo
2255# Help! Isn't there any way to avoid writing this part twice?
2256# Yes, use a name/use
2257>>32	string		_VID		\b,
2258# >>>48	string		JFIF		JPEG
2259>>>40	ubelong		>0		%d frames
2260>>>44	ubeshort	>0		(%d x
2261>>>46	ubeshort	>0		%d)
2262>16	string		_VID		\b,
2263# >>32	string		JFIF		JPEG
2264>>24	ubelong		>0		%d frames
2265>>28	ubeshort	>0		(%d x
2266>>30	ubeshort	>0		%d)
2267
22680	string	Paint\ Shop\ Pro\ Image\ File	Paint Shop Pro Image File
2269
2270# taken from fkiss: (<yav@mte.biglobe.ne.jp> ?)
22710	string		KiSS		KISS/GS
2272>4	ubyte		16		color
2273>>5	ubyte		x		%d bit
2274>>8	uleshort	x		%d colors
2275>>10	uleshort	x		%d groups
2276>4	ubyte		32		cell
2277>>5	ubyte		x		%d bit
2278>>8	uleshort	x		%d x
2279>>10	uleshort	x		%d
2280>>12	uleshort	x		+%d
2281>>14	uleshort	x		+%d
2282
2283# Webshots (www.webshots.com), by John Harrison
22840       string          C\253\221g\230\0\0\0 Webshots Desktop .wbz file
2285
2286# Hercules DASD image files
2287# From Jan Jaeger <jj@septa.nl> and Jay Maynard <jaymaynard@gmail.com>
2288
2289# Common Hercules CKD image files
22900       name    HercCKD
2291>0      lelong  x               \b, %d heads per cylinder
2292>4      lelong  x               \b, track size %d bytes
2293>8      ubyte   >0x2F
2294>>8     ubyte   0x45            \b, device type 9345
2295>>8     ubyte   !0x45           \b, device type 33%2.2X
2296>8      ubyte   <0x30           \b, device type 23%2.2X
2297
22980       string  CKD_P370        Hercules CKD DASD image file
2299>8      use     HercCKD
2300
23010       string  CKD_C370        Hercules compressed CKD DASD image file
2302>8      use     HercCKD
2303>552    lelong  x               \b, %d total cylinders
2304>>557   byte    0               \b, no compression
2305>>557   byte    1               \b, ZLIB compression
2306>>557   byte    2               \b, BZ2 compression
2307
23080       string  CKD_S370        Hercules CKD DASD shadow file
2309>8      use     HercCKD
2310
23110       string  CKD_P064        Hercules CKD64 DASD image file
2312>8      use     HercCKD
2313
23140       string  CKD_C064        Hercules compressed CKD64 DASD image file
2315>8      use     HercCKD
2316>524    lelong  x               \b, %d total cylinders
2317>>585   byte    0               \b, no compression
2318>>585   byte    1               \b, ZLIB compression
2319>>585   byte    2               \b, BZ2 compression
2320
23210       string  CKD_S064        Hercules CKD64 DASD shadow file
2322>8      use     HercCKD
2323
2324# Squeak images and programs - etoffi@softhome.net
23250	string		\146\031\0\0	Squeak image data
23260	search/1	'From\040Squeak	Squeak program text
2327
2328# partimage: file(1) magic for PartImage files (experimental, incomplete)
2329# Author: Hans-Joachim Baader <hjb@pro-linux.de>
23300		string	PaRtImAgE-VoLuMe	PartImage
2331>0x0020		string	0.6.1		file version %s
2332>>0x0060	ulelong	>-1		volume %d
2333#>>0x0064 8 byte identifier
2334#>>0x007c reserved
2335>>0x0200	string	>\0		type %s
2336>>0x1400	string	>\0		device %s,
2337>>0x1600	string	>\0		original filename %s,
2338# Some fields omitted
2339>>0x2744	ulelong	0		not compressed
2340>>0x2744	ulelong	1		gzip compressed
2341>>0x2744	ulelong	2		bzip2 compressed
2342>>0x2744	ulelong	>2		compressed with unknown algorithm
2343>0x0020		string	>0.6.1		file version %s
2344>0x0020		string	<0.6.1		file version %s
2345
2346# DCX is multi-page PCX, using a simple header of up to 1024
2347# offsets for the respective PCX components.
2348# From: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
2349# Update:	Joerg Jenderek
2350# URL:		http://fileformats.archiveteam.org/wiki/DCX
23510	ulelong	987654321	DCX multi-page
2352# http://www.nationalarchives.gov.uk/pronom/x-fmt/348
2353!:mime	image/x-dcx
2354!:ext	dcx
2355# The first file offset usually starts at file offset 0x1004
2356# print 1 space after 0x100? offset and then handles PCX images by ./images
2357>4	ulelong	x		\b, at %#x
2358>(4.l)	indirect		x
2359# possible 2nd PCX image
2360#>8	ulelong	!0		\b, at %#x
2361#>>(8.l)	indirect		x
2362# possible 3rd PCX image
2363#>12	ulelong	!0		\b, at %#x
2364#>>(12.l)	indirect		x
2365
2366# Simon Walton <simonw@matteworld.com>
2367# Kodak Cineon format for scanned negatives
2368# http://www.kodak.com/US/en/motion/support/dlad/
23690	ulelong  0xd75f2a80	Cineon image data
2370>200	ubelong  >0		\b, %d x
2371>204	ubelong  >0		%d
2372
2373
2374# Bio-Rad .PIC is an image format used by microscope control systems
2375# and related image processing software used by biologists.
2376# From: Vebjorn Ljosa <vebjorn@ljosa.com>
2377# BOOL values are two-byte integers; use them to rule out false positives.
2378# https://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
2379# Samples: https://www.loci.wisc.edu/software/sample-data
238014	uleshort	<2
2381>62	uleshort	<2
2382>>54	uleshort	12345		Bio-Rad .PIC Image File
2383>>>0	uleshort	>0		%d x
2384>>>2	uleshort	>0		%d,
2385>>>4	uleshort	=1		1 image in file
2386>>>4	uleshort	>1		%d images in file
2387
2388# From Jan "Yenya" Kasprzak <kas@fi.muni.cz>
2389# The description of *.mrw format can be found at
2390# http://www.dalibor.cz/minolta/raw_file_format.htm
23910	string	\000MRM			Minolta Dimage camera raw image data
2392
2393# Summary: DjVu image / document
2394# Extension: .djvu
2395# Reference: http://djvu.org/docs/DjVu3Spec.djvu
2396# Submitted by: Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
2397# Modified by (1): Abel Cheung <abelcheung@gmail.com>
23980	string	AT&TFORM
2399>12	string	DJVM		DjVu multiple page document
2400!:mime	image/vnd.djvu
2401>12	string	DJVU		DjVu image or single page document
2402!:mime	image/vnd.djvu
2403>12	string	DJVI		DjVu shared document
2404!:mime	image/vnd.djvu
2405>12	string	THUM		DjVu page thumbnails
2406!:mime	image/vnd.djvu
2407
2408# Originally by Marc Espie
2409# Modified by Robert Minsk <robertminsk at yahoo.com>
2410# https://www.openexr.com/openexrfilelayout.pdf
24110	ulelong		20000630	OpenEXR image data,
2412!:mime image/x-exr
2413>4	ulelong&0x000000ff x		version %d,
2414>4	ulelong		^0x00000200	storage: scanline
2415>4	ulelong		&0x00000200	storage: tiled
2416>8	search/0x1000	compression\0	\b, compression:
2417>>&16	ubyte		0		none
2418>>&16	ubyte		1		rle
2419>>&16	ubyte		2		zips
2420>>&16	ubyte		3		zip
2421>>&16	ubyte		4		piz
2422>>&16	ubyte		5		pxr24
2423>>&16	ubyte		6		b44
2424>>&16	ubyte		7		b44a
2425>>&16	ubyte		8		dwaa
2426>>&16	ubyte		9		dwab
2427>>&16	ubyte		>9		unknown
2428>8	 search/0x1000	dataWindow\0	\b, dataWindow:
2429>>&10	ulelong		x		(%d
2430>>&14	ulelong		x		%d)-
2431>>&18	ulelong		x		\b(%d
2432>>&22	ulelong		x		%d)
2433>8	search/0x1000	displayWindow\0	\b, displayWindow:
2434>>&10	ulelong		x		(%d
2435>>&14	ulelong		x		%d)-
2436>>&18	ulelong		x		\b(%d
2437>>&22	ulelong		x		%d)
2438>8	search/0x1000	lineOrder\0	 \b, lineOrder:
2439>>&14	ubyte		0		increasing y
2440>>&14	ubyte		1		decreasing y
2441>>&14	ubyte		2		random y
2442>>&14	ubyte		>2		unknown
2443
2444# SMPTE Digital Picture Exchange Format, SMPTE DPX
2445#
2446# ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
2447# Moving-Picture Exchange (DPX), v1.0, 18 February 1994
2448# Robert Minsk <robertminsk at yahoo.com>
2449# Modified by Harry Mallon <hjmallon at gmail.com>
24500	string		SDPX	DPX image data, big-endian,
2451!:mime image/x-dpx
2452>0	use		dpx_info
24530	string		XPDS	DPX image data, little-endian,
2454!:mime image/x-dpx
2455>0	use		\^dpx_info
2456
24570	name		dpx_info
2458>768	ubeshort	<4
2459>>772	ubelong		x	%dx
2460>>776	ubelong		x	\b%d,
2461>768	ubeshort	>3
2462>>776	ubelong		x	%dx
2463>>772	ubelong		x	\b%d,
2464>768	ubeshort	0	left to right/top to bottom
2465>768	ubeshort	1	right to left/top to bottom
2466>768	ubeshort	2	left to right/bottom to top
2467>768	ubeshort	3	right to left/bottom to top
2468>768	ubeshort	4	top to bottom/left to right
2469>768	ubeshort	5	top to bottom/right to left
2470>768	ubeshort	6	bottom to top/left to right
2471>768	ubeshort	7	bottom to top/right to left
2472
2473# From: Tom Hilinski <tom.hilinski@comcast.net>
2474# Update:	Joerg Jenderek
2475# URL: 		https://en.wikipedia.org/wiki/NetCDF
2476#		http://fileformats.archiveteam.org/wiki/NetCDF
2477# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/n/netcdf.trid.xml
2478#		https://www.loc.gov/preservation/digital/formats/fdd/fdd000330.shtml
2479# Note:		called "NetCDF Network Common Data Form" by TrID and
2480#		"netCDF-3 Classic" by DROID via PUID fmt/282
2481# https://www.unidata.ucar.edu/packages/netcdf/
24820	string	CDF\001
2483# skip DROID fmt-282-signature-id-298.nc by test for more content bytes
2484>3	uleshort	>0		NetCDF Data Format data
2485#!:mime	application/netcdf
2486# https://reposcope.com/mimetype/application/x-netcdf
2487!:mime	application/x-netcdf
2488!:ext	nc
2489# https://fileinfo.com/extension/cdf
2490# https://www.file-extensions.org/cdf-file-extension-unidata-network-common-data-form
2491# in 1994 changed from CDF to NC file extension avoid a clash with other file formats
2492#!:ext	nc/cdf
2493# 64-bit offset netcdf Classic https://www.unidata.ucar.edu/software/netcdf/docs/file_format_specifications
2494# Note:		called "netCDF-3 64-bit" by DROID via PUID fmt/283
24950	string	CDF\002
2496# skip DROID fmt-283-signature-id-299.nc by test for more content bytes
2497>3	uleshort	>0		NetCDF Data Format data (64-bit offset)
2498#!:mime	application/netcdf
2499!:mime	application/x-netcdf
2500!:ext	nc
2501
2502# From: Michael Liu
2503# https://en.wikipedia.org/wiki/Common_Data_Format
25040	ubelong	0xCDF30001	Common Data Format (Version 3 or later) data
2505!:mime  application/x-cdf
2506
25070	ubelong	0xCDF26002	Common Data Format (Version 2.6 or 2.7) data
2508!:mime  application/x-cdf
2509
25100	ubelong	0x0000FFFF	Common Data Format (Version 2.5 or earlier) data
2511!:mime  application/x-cdf
2512
2513# Hierarchical Data Format, used to facilitate scientific data exchange
2514# specifications at http://hdf.ncsa.uiuc.edu/
2515# URL: 		http://fileformats.archiveteam.org/wiki/HDF
2516#		https://en.wikipedia.org/wiki/Hierarchical_Data_Format
2517# Reference:	https://portal.hdfgroup.org/download/attachments/52627880/HDF5_File_Format_Specification_Version-3.0.pdf
25180	ubelong	0x0e031301	Hierarchical Data Format (version 4) data
2519!:mime	application/x-hdf
2520!:ext	hdf/hdf4/h4
25210	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) data
2522#!:mime	application/x-hdf
2523!:mime	application/x-hdf5
2524!:ext	h5/hdf5/hdf/he5
2525512	string	\211HDF\r\n\032\n
2526# skip Matlab v5 mat-file testhdf5_7.4_GLNX86.mat handled by ./mathematica
2527>0	string	!MATLAB			Hierarchical Data Format (version 5) with 512 bytes user block
2528#!:mime	application/x-hdf
2529!:mime	application/x-hdf5
2530!:ext	h5/hdf5/hdf/he5
25311024	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 1k user block
2532#!:mime	application/x-hdf
2533!:mime	application/x-hdf5
2534!:ext	h5/hdf5/hdf/he5
25352048	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 2k user block
2536#!:mime	application/x-hdf
2537!:mime	application/x-hdf5
2538!:ext	h5/hdf5/hdf/he5
25394096	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 4k user block
2540#!:mime	application/x-hdf
2541!:mime	application/x-hdf5
2542!:ext	h5/hdf5/hdf/he5
2543
2544# From: Tobias Burnus <burnus@net-b.de>
2545# Xara (for a while: Corel Xara) is a graphic package, see
2546# http://www.xara.com/ for Windows and as GPL application for Linux
25470	string	XARA\243\243	Xara graphics file
2548
2549# From:		Joerg Jenderek
2550# URL:		http://fileformats.archiveteam.org/wiki/Corel_Gallery
2551# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bmf-corel.trid.xml
2552# Note:		called "Corel Binary Material Format" by TrID and
2553# 		"Corel Flow" by XnView
25540	string	@CorelBMF\n\rCorel\040Corporation 	Corel GALLERY Clipart
2555!:mime	image/x-corel-bmf
2556!:ext	bmf
2557
2558# https://www.cartesianinc.com/Tech/
2559# Reference:	http://fileformats.archiveteam.org/wiki/Cartesian_Perceptual_Compression
25600	string	CPC\262		Cartesian Perceptual Compression image
2561!:mime	image/x-cpi
2562!:ext	cpi/cpc
2563
2564# From Albert Cahalan <acahalan@gmail.com>
2565# puredigital used it for the CVS disposable camcorder
2566#8       lelong		4       ZBM bitmap image data
2567#>4      uleshort	x       %u x
2568#>6      uleshort	x       %u
2569
2570# From Albert Cahalan <acahalan@gmail.com>
2571# uncompressed 5:6:5 HighColor image for OLPC XO firmware icons
25720       string		C565     OLPC firmware icon image data
2573>4      uleshort	x       %u x
2574>6      uleshort	x       %u
2575
2576# Applied Images - Image files from Cytovision
2577# Gustavo Junior Alves <gjalves@gjalves.com.br>
25780	string	\xce\xda\xde\xfa	Cytovision Metaphases file
25790	string	\xed\xad\xef\xac	Cytovision Karyotype file
25800	string	\x0b\x00\x03\x00	Cytovision FISH Probe file
25810	string	\xed\xfe\xda\xbe	Cytovision FLEX file
25820	string	\xed\xab\xed\xfe	Cytovision FLEX file
25830	string	\xad\xfd\xea\xad	Cytovision RATS file
2584
2585# Wavelet Scalar Quantization format used in gray-scale fingerprint images
2586# From Tano M Fotang <mfotang@quanteq.com>
25870	string	\xff\xa0\xff\xa8\x00	Wavelet Scalar Quantization image data
2588
2589# Type:		PCO B16 image files
2590# URL:		http://www.pco.de/fileadmin/user_upload/db/download/MA_CWDCOPIE_0412b.pdf
2591# From:		Florian Philipp <florian.philipp@binarywings.net>
2592# Extension:	.b16
2593# Description:	Pixel image format produced by PCO Camware, typically used
2594#		together with PCO cameras.
2595# Note:		Different versions exist for e.g. 8 bit and 16 bit images.
2596#		Documentation is incomplete.
25970	string/b	PCO-	PCO B16 image data
2598>12	ulelong		x	\b, %dx
2599>16	ulelong		x	\b%d
2600>20	ulelong		0	\b, short header
2601>20	ulelong		-1	\b, extended header
2602>>24	ulelong		0	\b, grayscale
2603>>>36	ulelong		0	linear LUT
2604>>>36	ulelong		1	logarithmic LUT
2605>>>28	ulelong		x	[%d
2606>>>32	ulelong		x	\b,%d]
2607>>24	ulelong		1	\b, color
2608>>>64	ulelong		0	linear LUT
2609>>>64	ulelong		1	logarithmic LUT
2610>>>40	ulelong		x	r[%d
2611>>>44	ulelong		x	\b,%d]
2612>>>48	ulelong		x	g[%d
2613>>>52	ulelong		x	\b,%d]
2614>>>56	ulelong		x	b[%d
2615>>>60	ulelong		x	\b,%d]
2616
2617# Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
2618# From: Markus Heidelberg <markus.heidelberg at web.de>
26190	string/t	[BitmapInfo2]	Polar Monitor Bitmap text
2620!:mime	image/x-polar-monitor-bitmap
2621
2622# From: Rick Richardson <rickrich@gmail.com>
2623# updated by: Joerg Jenderek
2624# URL: http://techmods.net/nuvi/
26250	string	GARMIN\ BITMAP\ 01	Garmin Bitmap file
2626# extension is also used for
2627# Sony SRF raw image (image/x-sony-srf)
2628# SRF map
2629# Terragen Surface Map (https://www.planetside.co.uk/terragen)
2630# FileLocator Pro search criteria file (https://www.mythicsoft.com/filelocatorpro)
2631!:ext srf
2632#!:mime	image/x-garmin-srf
2633# version 1.00,2.00,2.10,2.40,2.50
2634>0x2f	string		>0		\b, version %4.4s
2635# width (2880,2881,3240)
2636>0x55	uleshort	>0		\b, %dx
2637# height (80,90)
2638>>0x53	uleshort	x		\b%d
2639
2640# From:		Joerg Jenderek
2641# URL:		http://fileformats.archiveteam.org/wiki/Imageiio/imaginfo_(Ulead)
2642# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pe3.trid.xml
2643# Note:		called "Ulead Imageiio/Imaginfo thumbnail" by TrID
26440	string	IIO1$			Ulead Photo Explorer 3
2645#!:mime	application/octet-stream
2646!:mime	image/x-ulead-pe3
2647# IMAGEIIO.PE3
2648!:ext	pe3
2649# look for DOS/Windows drive letter
2650>5	search/192/s	:\\
2651# directory or full name of corresponding imaginfo.pe3 like: "T:\SAMPLES\TEXTURES\SKY_SNOW\IIOE371.TMP "S:\PI3\PIMPACT3\PROGRAMS\PATTERNS\imaginfo.pe3"
2652>>&-1	string	x			"%s"
2653# look for DOS/Windows network path if no drive letter part
2654>5	default		x
2655>>5	search/192/s	\x5c\x5c
2656# full name of corresponding imaginfo.pe3 like: "\\Lionking\upi\SAMPLES\IMAGES\ANIMALS\imaginfo.pe3"
2657>>>&0	string	x			"%s"
2658# Type:	Ulead Photo Explorer5 (.pe5)
2659# URL:		http://fileformats.archiveteam.org/wiki/Imageiio/imaginfo_(Ulead)
2660# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pe4.trid.xml
2661# From:	Simon Horman <horms@debian.org>
2662# Update:	Joerg Jenderek
2663# Note:		some called "Ulead Imageiio/Imaginfo thumbnail" by TrID
2664#		and used in various Ulead applications
26650	string	IIO2H			Ulead Photo Explorer 4 or 5
2666#!:mime	application/octet-stream
2667!:mime	image/x-ulead-pe4
2668# IMAGEIIO.PE4
2669!:ext	pe4/pe5
2670# look in most samples for JPEG signature like: SAMPLES/IMAGES/SCENES/IMAGINFO.PE4
2671>0x4c2	search/0xE02/s	JFIF		with JPEG image data
2672>>&-6	use			jpeg
2673# near the end list of image names like: Img0001.pcd 1116012L.JPG NCARD4.TPL
2674#
2675# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pe3-imaginfo.trid.xml
267611	string	\001\0\0\0\0
2677# check for version 3 part
2678>19	string	\0\001\0\003\0
2679>>0	use	ulead-imaginfo
2680# From:		Joerg Jenderek
2681# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pe4-imaginfo.trid.xml
2682# check for version 4 part
2683>19	string	\0\0\0\004\0
2684>>0	use	ulead-imaginfo
2685# display information about Ulead Imaginfo thumbnail (version, directory, image extension)
26860	name	ulead-imaginfo
2687>22	ubyte	x			Ulead Imaginfo thumbnail
2688#!:mime	application/octet-stream
2689!:mime	image/x-ulead-imaginfo
2690>22	ubyte	=3			\b, version 3
2691# IMAGINFO.PE3
2692!:ext	pe3
2693>22	ubyte	=4			\b, version 4
2694# IMAGINFO.PE4
2695!:ext	pe4
2696# MAYBE ALSO VERSION 5 ?
2697#>22	ubyte	=5			\b, version 5
2698#!:ext	pe5
2699>22	ubyte	x
2700# look for DOS/Windows driver letter
2701>>4	search/192/s	:\x5c
2702# skip f:\Programme\iPhoto Plus 4\Template\Business Cards\IMAGINFO.PE4
2703# by looking for driver letter in range A-Z
2704>>>&-1	ubyte	>0x40
2705# directory path like: "E:\iPE\CDSample\Images\Scenes" "D:\XmasCard\Samples" "C:\TEMP\PLANTS"
2706>>>>&-5	pstring/l	>0		\b, "%s"
2707# look for DOS/Windows network path if no valid drive letter part
2708>>>&-1	default		x
2709>>>>4	search/192/s	\x5c\x5c
2710# directory path like: "\\FSX\SYS\OPPS\IPE.ENG\TEMPLATE\BUSINESS" "\\Lionking\upi\SAMPLES\IMAGES\ANIMALS"
2711>>>>>&-4 pstring/l	>0		\b, "%s"
2712# look for DOS/Windows network path if no drive letter part
2713>>4	default		x
2714>>>4	search/192/s	\x5c\x5c
2715# directory path like: "\\FSX\SYS\opps\ipe.eng\samples" "\\DANIEL\IPE_CD\IPE.ITA"
2716>>>>&-4 pstring/l	>0		\b, "%s"
2717# look for point character inside image names
2718>56	search/38/s	.
2719# image name extension like: bmp jpg pcd tpl
2720>>&1	string	x			with %-.3s images
2721# Summary:	Ulead Pattern image (Corel Corporation)
2722# URL:		https://en.wikipedia.org/wiki/Ulead_Systems
2723#		https://www.file-extensions.org/pst-file-extension-ulead-pattern-image-format
2724# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pst-ulead.trid.xml
2725# From:		Joerg Jenderek
2726# Note:		used also by CorelDraw Essentials 3 version 13.0.0.800
2727#		there seems to exist other versions
27280	ubelong		0xFFFF0100
2729>8	search/21	PresetInfo	Ulead pattern image
2730#!:mime	application/octet-stream
2731!:mime	image/x-ulead-pst
2732!:ext	pst
2733# string length like: 16 18 19 21 24
2734#>>4	uleshort	x		n=%u
2735# like: BlendPresetInfo DropShadowPresetInfo FileNewPresetInfo VectorExtrudePresetInfo EnvelopePresetInfo ContourPresetInfo DistortionPresetInfo
2736>>4	pstring/h	x		"%s"
2737
2738# Type:	X11 cursor
2739# URL:	http://webcvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?view=markup
2740# From:	Mathias Brodala <info@noctus.net>
27410	string	Xcur			X11 cursor
2742
2743# Type:	Olympus ORF raw images.
2744# URL:	https://libopenraw.freedesktop.org/wiki/Olympus_ORF
2745# From:	Adam Buchbinder <adam.buchbinder@gmail.com>
27460	string		MMOR		Olympus ORF raw image data, big-endian
2747!:mime	image/x-olympus-orf
27480	string		IIRO		Olympus ORF raw image data, little-endian
2749!:mime	image/x-olympus-orf
27500	string		IIRS		Olympus ORF raw image data, little-endian
2751!:mime	image/x-olympus-orf
2752
2753# Type: files used in modern AVCHD camcoders to store clip information
2754# Extension: .cpi
2755# From: Alexander Danilov <alexander.a.danilov@gmail.com>
27560	string	HDMV0100	AVCHD Clip Information
2757
2758# From: Adam Buchbinder <adam.buchbinder@gmail.com>
2759# URL: http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
2760# Radiance HDR; usually has .pic or .hdr extension.
27610	string	#?RADIANCE\n	Radiance HDR image data
2762!:mime	image/vnd.radiance
2763
2764# From: Adam Buchbinder <adam.buchbinder@gmail.com>
2765# URL: https://www.mpi-inf.mpg.de/resources/pfstools/pfs_format_spec.pdf
2766# Used by the pfstools packages. The regex matches for the image size could
2767# probably use some work. The MIME type is made up; if there's one in
2768# actual common use, it should replace the one below.
27690	string	PFS1\x0a	PFS HDR image data
2770#!mime	image/x-pfs
2771>1	regex	[0-9]*\ 	\b, %s
2772>>1	regex	\ [0-9]{4}	\bx%s
2773
2774# Type: Foveon X3F
2775# URL:  https://www.photofo.com/downloads/x3f-raw-format.pdf
2776# From: Adam Buchbinder <adam.buchbinder@gmail.com>
2777# Note that the MIME type isn't defined anywhere that I can find; if
2778# there's a canonical type for this format, it should replace this one.
27790	string	FOVb	Foveon X3F raw image data
2780!:mime	image/x-x3f
2781>6	uleshort	x	\b, version %d.
2782>4	uleshort	x	\b%d
2783>28	ulelong		x	\b, %dx
2784>32	ulelong		x	\b%d
2785
2786# Paint.NET file
2787# From Adam Buchbinder <adam.buchbinder@gmail.com>
27880	string	PDN3	Paint.NET image data
2789!:mime	image/x-paintnet
2790
2791# Not really an image.
2792# From: "Tano M. Fotang" <mfotang@quanteq.com>
27930	string	\x46\x4d\x52\x00	ISO/IEC 19794-2 Format Minutiae Record (FMR)
2794
2795# doc: https://www.shikino.co.jp/eng/products/images/FLOWER.jpg.zip
2796# example: https://www.shikino.co.jp/eng/products/images/FLOWER.wdp.zip
279790	ubequad		0x574D50484F544F00	JPEG-XR Image
2798>98	ubyte&0x08	=0x08			\b, hard tiling
2799>99	ubyte&0x80	=0x80			\b, tiling present
2800>99	ubyte&0x40	=0x40			\b, codestream present
2801>99	ubyte&0x38	x			\b, spatial xform=
2802>99	ubyte&0x38	0x00			\bTL
2803>99	ubyte&0x38	0x08			\bBL
2804>99	ubyte&0x38	0x10			\bTR
2805>99	ubyte&0x38	0x18			\bBR
2806>99	ubyte&0x38	0x20			\bBT
2807>99	ubyte&0x38	0x28			\bRB
2808>99	ubyte&0x38	0x30			\bLT
2809>99	ubyte&0x38	0x38			\bLB
2810>100	ubyte&0x80	=0x80			\b, short header
2811>>102	ubeshort+1	x			\b, %d
2812>>104	ubeshort+1	x			\bx%d
2813>100	ubyte&0x80	=0x00			\b, long header
2814>>102	ubelong+1	x			\b, %x
2815>>106	ubelong+1	x			\bx%x
2816>101	ubeshort&0xf	x			\b, bitdepth=
2817>>101	ubeshort&0xf	0x0			\b1-WHITE=1
2818>>101	ubeshort&0xf	0x1			\b8
2819>>101	ubeshort&0xf	0x2			\b16
2820>>101	ubeshort&0xf	0x3			\b16-SIGNED
2821>>101	ubeshort&0xf	0x4			\b16-FLOAT
2822>>101	ubeshort&0xf	0x5			\b(reserved 5)
2823>>101	ubeshort&0xf	0x6			\b32-SIGNED
2824>>101	ubeshort&0xf	0x7			\b32-FLOAT
2825>>101	ubeshort&0xf	0x8			\b5
2826>>101	ubeshort&0xf	0x9			\b10
2827>>101	ubeshort&0xf	0xa			\b5-6-5
2828>>101	ubeshort&0xf	0xb			\b(reserved %d)
2829>>101	ubeshort&0xf	0xc			\b(reserved %d)
2830>>101	ubeshort&0xf	0xd			\b(reserved %d)
2831>>101	ubeshort&0xf	0xe			\b(reserved %d)
2832>>101	ubeshort&0xf	0xf			\b1-BLACK=1
2833>101	ubeshort&0xf0	x			\b, colorfmt=
2834>>101	ubeshort&0xf0	0x00			\bYONLY
2835>>101	ubeshort&0xf0	0x10			\bYUV240
2836>>101	ubeshort&0xf0	0x20			\bYWV422
2837>>101	ubeshort&0xf0	0x30			\bYWV444
2838>>101	ubeshort&0xf0	0x40			\bCMYK
2839>>101	ubeshort&0xf0	0x50			\bCMYKDIRECT
2840>>101	ubeshort&0xf0	0x60			\bNCOMPONENT
2841>>101	ubeshort&0xf0	0x70			\bRGB
2842>>101	ubeshort&0xf0	0x80			\bRGBE
2843>>101	ubeshort&0xf0	>0x80			\b(reserved %#x)
2844
2845# From: Johan van der Knijff <johan.vanderknijff@kb.nl>
2846#
2847# BPG (Better Portable Graphics) format
2848# https://bellard.org/bpg/
2849# http://fileformats.archiveteam.org/wiki/BPG
2850#
28510	string	\x42\x50\x47\xFB	BPG (Better Portable Graphics)
2852!:mime  image/bpg
2853
2854# From: Joerg Jenderek
2855# URL: https://en.wikipedia.org/wiki/Apple_Icon_Image_format
28560	string		icns		Mac OS X icon
2857!:mime	image/x-icns
2858!:apple	????icns
2859!:ext icns
2860>4	ubelong		>0
2861# file size
2862>>4	ubelong		x		\b, %d bytes
2863# icon type
2864>>8	string		x		\b, "%4.4s" type
2865
2866# TIM images
2867# URL:		http://fileformats.archiveteam.org/wiki/TIM_(PlayStation_graphics)
2868# Reference:	https://mrclick.zophar.net/TilEd/download/timgfx.txt
2869# Update:	Joerg Jenderek
2870# Note:		called as "PSX TIM *bpp bitmap" by bitmap-tim-*.trid.xml
2871#		verified as "TIM PSX" by XnView `nconvert -fullinfo *.tim` and
2872#		by RECOIL `recoil2png -o TMP.PNG input.tim; file TMP.PNG` and often
2873#		as "PSX TIM" by ImageMagick version 7.1.0-10 command `identify *.tim`
2874#		here signed integers are used but according to Kaitai unsigned
28750		ulelong		0x00000010
2876# 32 Flag bits *cttt; c~CLUT flag t~type 000~4BPP 001~8BPP 010~16BPP 011~24BPP 100~Mixed
2877#>4		ulelong  	x		FLAGS=%#x
2878# 12+Size of CLUT (2Ch for 4BPP; 20Ch 40Ch 60Ch 80Ch C0Ch for 8BPP) or
2879# +image data size (800Ch 2000Ch 2580C for 16BPP) (02000003h for dBase memo test.dbt)
2880#>8		ulelong		x		\b, 12+CLUT or data size=%#8.8x
2881# CLUT or data size remainder is 12 (Ch), but 03 for dBase memo test.dbt
2882#>8		ubyte&0x0F	=0x0C		\b, SIZE REMAINDER IS 12
2883# skip dBase III memo test.dbt with invalid flags 22D10189h
2884>4		ulelong&0xffFFffF0	=0	Sony PlayStation PSX image,
2885# file (version 5.40) labeled the above entry as "TIM image"
2886!:mime	image/x-sony-tim
2887!:ext	tim
2888#>>4		ulelong&0x00000007	x	\b, BPP~%u
2889# 4BPP and 8BPP examples exist with CLUT or without CLUT
2890>>4		ulelong&0x07	0x0		4-Bit,
2891>>4		ulelong&0x07	0x1		8-Bit,
2892# 16BPP and 24BPP examples have no CLUT
2893>>4		ulelong  	0x2		15-Bit,
2894>>4		ulelong  	0x3		24-Bit,
2895# no example
2896>>4		ulelong&0x07  	0x4		Mixed-Bit,
2897# CLUT flag set
2898>>4		ulelong 	&8
2899# 12 + size of CLUT like: 1000Ch 800Ch 400Ch 40Ch and 2FEh (KAGE.TIM)
2900#>>>(8.l+8)	ulelong		x		\b, 12+CLUT SIZE=%#8.8x
2901>>>(8.l+12)	uleshort	x		Pixel at (%d,
2902>>>(8.l+14)	uleshort	x		\b%d) Size=
2903# image width (to get actual width multiply by 4 for 4BPP and by 2 for 8BPP)
2904>>>>4		ulelong  	0x8
2905>>>>>(8.l+16)	uleshort*4	x		\b%d
2906>>>>4		ulelong  	0x9
2907>>>>>(8.l+16)	uleshort*2	x		\b%d
2908# image height like: 32 64 128 144 160 208 256
2909>>>(8.l+18)	uleshort	x		\bx%d,
2910>>>4		ulelong 	0x8		16 CLUT Entries at
2911>>>4		ulelong 	0x9		256 CLUT Entries at
2912>>>12		uleshort	x		(%d,
2913>>>14		uleshort	x		\b%d)
2914# no Color LookUp Table (CLUT)
2915>>4		ulelong		^8
2916# image origin X Y
2917>>>12		uleshort	x		Pixel at (%d,
2918>>>14		uleshort	x		\b%d) Size=
2919# real image width = multiply by 4 (4BPP) 2 (8BPP) 1 (16BPP) 2/3 (24BPP)
2920>>>>4		ulelong  	0x0
2921>>>>>16		uleshort*4	x		\b%d
2922>>>>4		ulelong  	0x1
2923>>>>>16		uleshort*2	x		\b%d
2924>>>>4		ulelong  	0x2
2925>>>>>16		uleshort		x		\b%d
2926>>>>4		ulelong  	0x3
2927# GRR: NOT working
2928#>>>>>16		uleshort*2/3	x		\b%d
2929>>>>>16		uleshort		x		\b2/3*%d
2930# mixed format width not explained!
2931>>>>4		ulelong  	0x4
2932>>>>>16		uleshort		x		\b%d
2933# image height like: 64 240 256
2934>>>18		uleshort		x		\bx%d
2935# TIM image data
2936
2937# MDEC streams
29380		ulelong		0x80010160	MDEC video stream,
2939>16		uleshort	x		%dx
2940>18		uleshort	x		\b%d
2941#>8		ulelong		x		%d frames
2942#>4		uleshort	x		secCount=%d;
2943#>6		uleshort	x		nSectors=%d;
2944#>12		ulelong		x		frameSize=%d;
2945
2946# BS encoded bitstreams
29472		uleshort	0x3800		BS image,
2948# GRR: the above line is also true for binary Computer Graphics Metafile SAB00012.CGM with long parameter length 56 (=38h)
2949>6		uleshort	x		Version %d,
2950>4		uleshort	x		Quantization %d,
2951>0		uleshort	x		(Decompresses to %d words)
2952
2953# Type: farbfeld image.
2954# Url: http://tools.suckless.org/farbfeld/
2955# From: Ian D. Scott <ian@iandouglasscott.com>
2956#
29570		string		farbfeld	farbfeld image data,
2958>8		ubelong		x		%dx
2959>12		ubelong		x		\b%d
2960
2961# Type: Microsoft DirectDraw Surface (DXGI formats)
2962# URL:	https://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
2963# From: Morten Hustveit <morten@debian.org>
2964# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
29650	name	ms-directdraw-dx10
2966>0	ulelong	x	\b, DXGI format:
2967>0	ulelong	1	R32G32B32A32_TYPELESS
2968>0	ulelong	2	R32G32B32A32_FLOAT
2969>0	ulelong	3	R32G32B32A32_UINT
2970>0	ulelong	4	R32G32B32A32_SINT
2971>0	ulelong	5	R32G32B32_TYPELESS
2972>0	ulelong	6	R32G32B32_FLOAT
2973>0	ulelong	7	R32G32B32_UINT
2974>0	ulelong	8	R32G32B32_SINT
2975>0	ulelong	9	R16G16B16A16_TYPELESS
2976>0	ulelong	10	R16G16B16A16_FLOAT
2977>0	ulelong	11	R16G16B16A16_UNORM
2978>0	ulelong	12	R16G16B16A16_UINT
2979>0	ulelong	13	R16G16B16A16_SNORM
2980>0	ulelong	14	R16G16B16A16_SINT
2981>0	ulelong	15	R32G32_TYPELESS
2982>0	ulelong	16	R32G32_FLOAT
2983>0	ulelong	17	R32G32_UINT
2984>0	ulelong	18	R32G32_SINT
2985>0	ulelong	19	R32G8X24_TYPELESS
2986>0	ulelong	20	D32_FLOAT_S8X24_UINT
2987>0	ulelong	21	R32_FLOAT_X8X24_TYPELESS
2988>0	ulelong	22	X32_TYPELESS_G8X24_UINT
2989>0	ulelong	23	R10G10B10A2_TYPELESS
2990>0	ulelong	24	R10G10B10A2_UNORM
2991>0	ulelong	25	R10G10B10A2_UINT
2992>0	ulelong	26	R11G11B10_FLOAT
2993>0	ulelong	27	R8G8B8A8_TYPELESS
2994>0	ulelong	28	R8G8B8A8_UNORM
2995>0	ulelong	29	R8G8B8A8_UNORM_SRGB
2996>0	ulelong	30	R8G8B8A8_UINT
2997>0	ulelong	31	R8G8B8A8_SNORM
2998>0	ulelong	32	R8G8B8A8_SINT
2999>0	ulelong	33	R16G16_TYPELESS
3000>0	ulelong	34	R16G16_FLOAT
3001>0	ulelong	35	R16G16_UNORM
3002>0	ulelong	36	R16G16_UINT
3003>0	ulelong	37	R16G16_SNORM
3004>0	ulelong	38	R16G16_SINT
3005>0	ulelong	39	R32_TYPELESS
3006>0	ulelong	40	D32_FLOAT
3007>0	ulelong	41	R32_FLOAT
3008>0	ulelong	42	R32_UINT
3009>0	ulelong	43	R32_SINT
3010>0	ulelong	44	R24G8_TYPELESS
3011>0	ulelong	45	D24_UNORM_S8_UINT
3012>0	ulelong	46	R24_UNORM_X8_TYPELESS
3013>0	ulelong	47	X24_TYPELESS_G8_UINT
3014>0	ulelong	48	R8G8_TYPELESS
3015>0	ulelong	49	R8G8_UNORM
3016>0	ulelong	50	R8G8_UINT
3017>0	ulelong	51	R8G8_SNORM
3018>0	ulelong	52	R8G8_SINT
3019>0	ulelong	53	R16_TYPELESS
3020>0	ulelong	54	R16_FLOAT
3021>0	ulelong	55	D16_UNORM
3022>0	ulelong	56	R16_UNORM
3023>0	ulelong	57	R16_UINT
3024>0	ulelong	58	R16_SNORM
3025>0	ulelong	59	R16_SINT
3026>0	ulelong	60	R8_TYPELESS
3027>0	ulelong	61	R8_UNORM
3028>0	ulelong	62	R8_UINT
3029>0	ulelong	63	R8_SNORM
3030>0	ulelong	64	R8_SINT
3031>0	ulelong	65	A8_UNORM
3032>0	ulelong	66	R1_UNORM
3033>0	ulelong	67	R9G9B9E5_SHAREDEXP
3034>0	ulelong	68	R8G8_B8G8_UNORM
3035>0	ulelong	69	G8R8_G8B8_UNORM
3036>0	ulelong	70	BC1_TYPELESS
3037>0	ulelong	71	BC1_UNORM
3038>0	ulelong	72	BC1_UNORM_SRGB
3039>0	ulelong	73	BC2_TYPELESS
3040>0	ulelong	74	BC2_UNORM
3041>0	ulelong	75	BC2_UNORM_SRGB
3042>0	ulelong	76	BC3_TYPELESS
3043>0	ulelong	77	BC3_UNORM
3044>0	ulelong	78	BC3_UNORM_SRGB
3045>0	ulelong	79	BC4_TYPELESS
3046>0	ulelong	80	BC4_UNORM
3047>0	ulelong	81	BC4_SNORM
3048>0	ulelong	82	BC5_TYPELESS
3049>0	ulelong	83	BC5_UNORM
3050>0	ulelong	84	BC5_SNORM
3051>0	ulelong	85	B5G6R5_UNORM
3052>0	ulelong	86	B5G5R5A1_UNORM
3053>0	ulelong	87	B8G8R8A8_UNORM
3054>0	ulelong	88	B8G8R8X8_UNORM
3055>0	ulelong	89	R10G10B10_XR_BIAS_A2_UNORM
3056>0	ulelong	90	B8G8R8A8_TYPELESS
3057>0	ulelong	91	B8G8R8A8_UNORM_SRGB
3058>0	ulelong	92	B8G8R8X8_TYPELESS
3059>0	ulelong	93	B8G8R8X8_UNORM_SRGB
3060>0	ulelong	94	BC6H_TYPELESS
3061>0	ulelong	95	BC6H_UF16
3062>0	ulelong	96	BC6H_SF16
3063>0	ulelong	97	BC7_TYPELESS
3064>0	ulelong	98	BC7_UNORM
3065>0	ulelong	99	BC7_UNORM_SRGB
3066>0	ulelong	100	AYUV
3067>0	ulelong	101	Y410
3068>0	ulelong	102	Y416
3069>0	ulelong	103	NV12
3070>0	ulelong	104	P010
3071>0	ulelong	105	P016
3072>0	ulelong	106	420_OPAQUE
3073>0	ulelong	107	YUY2
3074>0	ulelong	108	Y210
3075>0	ulelong	109	Y216
3076>0	ulelong	110	NV11
3077>0	ulelong	111	AI44
3078>0	ulelong	112	IA44
3079>0	ulelong	113	P8
3080>0	ulelong	114	A8P8
3081>0	ulelong	115	B4G4R4A4_UNORM
3082
3083>0	ulelong	116	XBOX_R10G10B10_7E3_A2_FLOAT
3084>0	ulelong	117	XBOX_R10G10B10_6E4_A2_FLOAT
3085>0	ulelong	118	XBOX_D16_UNORM_S8_UINT
3086>0	ulelong	119	XBOX_R16_UNORM_X8_TYPELESS
3087>0	ulelong	120	XBOX_X16_TYPELESS_G8_UINT
3088
3089>0	ulelong	130	DXGI_FORMAT_P208
3090>0	ulelong	131	DXGI_FORMAT_V208
3091>0	ulelong	132	DXGI_FORMAT_V408
3092
3093>0	ulelong	133	ASTC_4X4_TYPELESS
3094>0	ulelong	134	ASTC_4X4_UNORM
3095>0	ulelong	135	ASTC_4X4_UNORM_SRGB
3096>0	ulelong	137	ASTC_5X4_TYPELESS
3097>0	ulelong	138	ASTC_5X4_UNORM
3098>0	ulelong	139	ASTC_5X4_UNORM_SRGB
3099>0	ulelong	141	ASTC_5X5_TYPELESS
3100>0	ulelong	142	ASTC_5X5_UNORM
3101>0	ulelong	143	ASTC_5X5_UNORM_SRGB
3102>0	ulelong	145	ASTC_6X5_TYPELESS
3103>0	ulelong	146	ASTC_6X5_UNORM
3104>0	ulelong	147	ASTC_6X5_UNORM_SRGB
3105>0	ulelong	149	ASTC_6X6_TYPELESS
3106>0	ulelong	150	ASTC_6X6_UNORM
3107>0	ulelong	151	ASTC_6X6_UNORM_SRGB
3108>0	ulelong	153	ASTC_8X5_TYPELESS
3109>0	ulelong	154	ASTC_8X5_UNORM
3110>0	ulelong	155	ASTC_8X5_UNORM_SRGB
3111>0	ulelong	157	ASTC_8X6_TYPELESS
3112>0	ulelong	158	ASTC_8X6_UNORM
3113>0	ulelong	159	ASTC_8X6_UNORM_SRGB
3114>0	ulelong	161	ASTC_8X8_TYPELESS
3115>0	ulelong	162	ASTC_8X8_UNORM
3116>0	ulelong	163	ASTC_8X8_UNORM_SRGB
3117>0	ulelong	165	ASTC_10X5_TYPELESS
3118>0	ulelong	166	ASTC_10X5_UNORM
3119>0	ulelong	167	ASTC_10X5_UNORM_SRGB
3120>0	ulelong	169	ASTC_10X6_TYPELESS
3121>0	ulelong	170	ASTC_10X6_UNORM
3122>0	ulelong	171	ASTC_10X6_UNORM_SRGB
3123>0	ulelong	173	ASTC_10X8_TYPELESS
3124>0	ulelong	174	ASTC_10X8_UNORM
3125>0	ulelong	175	ASTC_10X8_UNORM_SRGB
3126>0	ulelong	177	ASTC_10X10_TYPELESS
3127>0	ulelong	178	ASTC_10X10_UNORM
3128>0	ulelong	179	ASTC_10X10_UNORM_SRGB
3129>0	ulelong	181	ASTC_12X10_TYPELESS
3130>0	ulelong	182	ASTC_12X10_UNORM
3131>0	ulelong	183	ASTC_12X10_UNORM_SRGB
3132>0	ulelong	185	ASTC_12X12_TYPELESS
3133>0	ulelong	186	ASTC_12X12_UNORM
3134>0	ulelong	187	ASTC_12X12_UNORM_SRGB
3135
3136>0	ulelong	190	XBOX_R10G10B10_SNORM_A2_UNORM
3137>0	ulelong	189	XBOX_R4G4_UNORM
3138>0	ulelong	0xFFFFFFFF	DXGI_FORMAT_FORCE_UINT
3139
3140# Type: Microsoft DirectDraw Surface (common data)
3141# URL:	https://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
3142# From: Morten Hustveit <morten@debian.org>
3143# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
31440	name	ms-directdraw-surface
3145>0x10	ulelong	x			%u x
3146>0x0C	ulelong	x			%u
3147# Color depth.
3148>0x58	ulelong	>0			\b, %u-bit color
3149# Determine the pixel format.
3150>0x50	ulelong&0x4	4
3151# FIXME: Handle DX10 and XBOX formats.
3152>>0x54	string	DX10
3153>>>0x80	use	ms-directdraw-dx10
3154>>0x54	string	!DX10
3155>>>0x54	string	x			\b, compressed using %.4s
3156>0x50	ulelong&0x2	0x2		\b, alpha only
3157>0x50	ulelong&0x200	0x200		\b, YUV
3158>0x50	ulelong&0x20000	0x20000		\b, luminance
3159# RGB pixel format
3160>0x50	ulelong&0x40	0x40
3161
3162# Determine the RGB format using the color masks.
3163# ulequad order: 0xGGGGGGGGRRRRRRRR, 0xAAAAAAAABBBBBBBB
3164
3165>>0x58		ulelong	16
3166
3167# NOTE: 15-bit color formats usually have 16-bit listed as the color depth.
3168>>>0x5C		ulequad	0x000003E000007C00
3169>>>>0x64	ulequad 0x000000000000001F	\b, RGB555
3170>>>0x5C		ulequad	0x000003E000001F00
3171>>>>0x64	ulequad 0x000000000000007C	\b, BGR555
3172
3173>>>0x5C		ulequad	0x000007E00000F800
3174>>>>0x64	ulequad 0x000000000000001F	\b, RGB565
3175>>>0x5C		ulequad	0x000007E000001F00
3176>>>>0x64	ulequad 0x00000000000000F8	\b, BGR565
3177
3178>>>0x5C		ulequad	0x000000F000000F00
3179>>>>0x64	ulequad 0x0000F0000000000F	\b, ARGB4444
3180>>>0x5C		ulequad	0x000000F00000000F
3181>>>>0x64	ulequad 0x0000F00000000F00	\b, ABGR4444
3182
3183>>>0x5C		ulequad	0x00000F000000F000
3184>>>>0x64	ulequad 0x0000000F000000F0	\b, RGBA4444
3185>>>0x5C		ulequad	0x00000F00000000F0
3186>>>>0x64	ulequad 0x0000000F0000F000	\b, BGRA4444
3187
3188>>>0x5C		ulequad	0x000000F000000F00
3189>>>>0x64	ulequad 0x000000000000000F	\b, xRGB4444
3190>>>0x5C		ulequad	0x000000F00000000F
3191>>>>0x64	ulequad 0x0000000000000F00	\b, xBGR4444
3192
3193>>>0x5C		ulequad	0x00000F000000F000
3194>>>>0x64	ulequad 0x00000000000000F0	\b, RGBx4444
3195>>>0x5C		ulequad	0x00000F00000000F0
3196>>>>0x64	ulequad 0x000000000000F000	\b, BGRx4444
3197
3198>>>0x5C		ulequad	0x000003E000007C00
3199>>>>0x64	ulequad 0x000080000000001F	\b, ARGB1555
3200>>>0x5C		ulequad	0x000003E000001F00
3201>>>>0x64	ulequad 0x000080000000007C	\b, ABGR1555
3202>>>0x5C		ulequad	0x000007C00000F800
3203>>>>0x64	ulequad 0x000000010000003E	\b, RGBA5551
3204>>>0x5C		ulequad	0x000007C00000003E
3205>>>>0x64	ulequad 0x000000010000F800	\b, BGRA5551
3206
3207>>88		ulelong 24
3208>>>0x5C		ulequad	0x0000FF0000FF0000
3209>>>>0x64	ulequad 0x00000000000000FF	\b, RGB888
3210>>>0x5C		ulequad	0x0000FF00000000FF
3211>>>>0x64	ulequad 0x0000000000FF0000	\b, BGR888
3212
3213>>88		ulelong 32
3214>>>0x5C		ulequad	0x0000FF0000FF0000
3215>>>>0x64	ulequad 0xFF000000000000FF	\b, ARGB8888
3216>>>0x5C		ulequad	0x0000FF00000000FF
3217>>>>0x64	ulequad 0xFF00000000FF0000	\b, ABGR8888
3218
3219>>>0x5C		ulequad	0x00FF0000FF000000
3220>>>>0x64	ulequad 0x000000FF0000FF00	\b, RGBA8888
3221>>>0x5C		ulequad	0x00FF00000000FF00
3222>>>>0x64	ulequad 0x000000FFFF000000	\b, BGBA8888
3223
3224>>>0x5C		ulequad	0x0000FF0000FF0000
3225>>>>0x64	ulequad 0x00000000000000FF	\b, xRGB8888
3226>>>0x5C		ulequad	0x0000FF00000000FF
3227>>>>0x64	ulequad 0x0000000000FF0000	\b, xBGR8888
3228
3229>>>0x5C		ulequad	0x00FF0000FF000000
3230>>>>0x64	ulequad 0x000000000000FF00	\b, RGBx8888
3231>>>0x5C		ulequad	0x00FF00000000FF00
3232>>>>0x64	ulequad 0x00000000FF000000	\b, BGBx8888
3233
3234# Less common 32-bit color formats.
3235>>>0x5C		ulequad	0xFFFF00000000FFFF
3236>>>>0x64	ulequad 0x0000000000000000	\b, G16R16
3237>>>0x5C		ulequad	0x0000FFFFFFFF0000
3238>>>>0x64	ulequad 0x0000000000000000	\b, R16G16
3239
3240>>>0x5C		ulequad	0x000FFC003FF00000
3241>>>>0x64	ulequad 0xC0000000000003FF	\b, A2R10G10B10
3242>>>0x5C		ulequad	0x000FFC00000003FF
3243>>>>0x64	ulequad 0xC00000003FF00000	\b, A2B10G10R10
3244
3245# Type: Microsoft DirectDraw Surface
3246# URL:	https://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
3247# From: Morten Hustveit <morten@debian.org>
3248# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
32490	string/b	DDS\040\174\000\000\000 Microsoft DirectDraw Surface (DDS):
3250>0	use	ms-directdraw-surface
3251
3252# Type: Sega PVR image.
3253# From: David Korth <gerbilsoft@gerbilsoft.com>
3254# References:
3255# - https://fabiensanglard.net/Mykaruga/tools/segaPVRFormat.txt
3256# - https://github.com/yazgoo/pvrx2png
3257# - https://github.com/nickworonekin/puyotools
3258
3259# Sega PVR header.
32600	name	sega-pvr-image-header
3261>0x0C	uleshort	x	%u x
3262>0x0E	uleshort	x	%u
3263# Image format.
3264>0x08	ubyte	0	\b, ARGB1555
3265>0x08	ubyte	1	\b, RGB565
3266>0x08	ubyte	2	\b, ARGB4444
3267>0x08	ubyte	3	\b, YUV442
3268>0x08	ubyte	4	\b, Bump
3269>0x08	ubyte	5	\b, 4bpp
3270>0x08	ubyte	6	\b, 8bpp
3271# Image data type.
3272>0x09	ubyte	0x01	\b, square twiddled
3273>0x09	ubyte	0x02	\b, square twiddled & mipmap
3274>0x09	ubyte	0x03	\b, VQ
3275>0x09	ubyte	0x04	\b, VQ & mipmap
3276>0x09	ubyte	0x05	\b, 8-bit CLUT twiddled
3277>0x09	ubyte	0x06	\b, 4-bit CLUT twiddled
3278>0x09	ubyte	0x07	\b, 8-bit direct twiddled
3279>0x09	ubyte	0x08	\b, 4-bit direct twiddled
3280>0x09	ubyte	0x09	\b, rectangle
3281>0x09	ubyte	0x0B	\b, rectangular stride
3282>0x09	ubyte	0x0D	\b, rectangular twiddled
3283>0x09	ubyte	0x10	\b, small VQ
3284>0x09	ubyte	0x11	\b, small VQ & mipmap
3285>0x09	ubyte	0x12	\b, square twiddled & mipmap
3286
3287# Sega PVR image.
32880	string	PVRT
3289>0x10	string	DDS\040\174\000\000\000 Sega PVR (Xbox) image:
3290>>0x20	use	ms-directdraw-surface
3291>0x10	ubelong	!0x44445320		Sega PVR image:
3292>>0	use	sega-pvr-image-header
3293
3294# Sega PVR image with GBIX.
32950	string	GBIX
3296>0x10	string	PVRT
3297>>0x10	string	DDS\040\174\000\000\000 Sega PVR (Xbox) image:
3298>>>0x20	use	ms-directdraw-surface
3299>>0x10	ubelong	!0x44445320		Sega PVR image:
3300>>>0x10	use	sega-pvr-image-header
3301>>0x08	ulelong	x	\b, global index = %u
3302# Sega GVR image with GBIX.
3303>0x10	string	GVRT	Sega GVR image:
3304>>0x10	use	sega-gvr-image-header
3305>>0x08	ubelong	x	\b, global index = %u
3306
3307# Sega GVR header.
33080	name	sega-gvr-image-header
3309>0x0C	ubeshort	x	%u x
3310>0x0E	ubeshort	x	%u
3311# Image data format.
3312>0x0B	ubyte	0	\b, I4
3313>0x0B	ubyte	1	\b, I8
3314>0x0B	ubyte	2	\b, IA4
3315>0x0B	ubyte	3	\b, IA8
3316>0x0B	ubyte	4	\b, RGB565
3317>0x0B	ubyte	5	\b, RGB5A3
3318>0x0B	ubyte	6	\b, ARGB8888
3319>0x0B	ubyte	8	\b, CI4
3320>0x0B	ubyte	9	\b, CI8
3321>0x0B	ubyte	14	\b, DXT1
3322
3323# Sega GVR image.
33240	string	GVRT	Sega GVR image:
3325>0x10	use	sega-gvr-image-header
3326
3327# Sega GVR image with GCIX. (Wii)
33280	string	GCIX
3329>0x10	string	GVRT	Sega GVR image:
3330>>0x10	use	sega-gvr-image-header
3331>>0x08	ubelong	x	\b, global index = %u
3332
3333# Light Field Picture
3334# Documentation: http://optics.miloush.net/lytro/TheFileFormat.aspx
3335# Typical file extensions: .lfp .lfr .lfx
33360	ubelong	0x894C4650
3337>4	ubelong	0x0D0A1A0A	Lytro Light Field Picture
3338>>8	ubelong	x		\b, version %u
3339
3340# Type: ARRI Raw Image
3341# Info: SMPTE RDD30:2014
3342# From: Harry Mallon <hjmallon at gmail.com>
33430	string ARRI		ARRI ARI image data,
3344>4	ulelong 0x78563412	little-endian,
3345>4 	ulelong 0x12345678	big-endian,
3346>12	ulelong x		version %d,
3347>20	ulelong x 		%dx
3348>24	ulelong x		\b%d
3349
3350# Type: Khronos KTX texture.
3351# From: David Korth <gerbilsoft@gerbilsoft.com>
3352# Reference: https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
3353# https://www.iana.org/assignments/media-types/image/ktx
3354
3355# glEnum decoding.
3356# NOTE: Only the most common formats are listed here.
33570	name	khronos-ktx-glEnum
3358>0	ulelong	0x1907	\b, RGB
3359>0	ulelong	0x1908	\b, RGBA
3360>0	ulelong	0x1909	\b, LUMINANCE
3361>0	ulelong	0x190A	\b, LUMINANCE_ALPHA
3362>0	ulelong	0x80E1	\b, BGR
3363>0	ulelong	0x80E2	\b, BGRA
3364>0	ulelong	0x83A0	\b, RGB_S3TC
3365>0	ulelong	0x83A1	\b, RGB4_S3TC
3366>0	ulelong	0x83A2	\b, RGBA_S3TC
3367>0	ulelong	0x83A3	\b, RGBA4_S3TC
3368>0	ulelong	0x83A4	\b, RGBA_DXT5_S3TC
3369>0	ulelong	0x83A5	\b, RGBA4_DXT5_S3TC
3370>0	ulelong	0x83F0	\b, COMPRESSED_RGB_S3TC_DXT1_EXT
3371>0	ulelong	0x83F1	\b, COMPRESSED_RGBA_S3TC_DXT1_EXT
3372>0	ulelong	0x83F2	\b, COMPRESSED_RGBA_S3TC_DXT3_EXT
3373>0	ulelong	0x83F3	\b, COMPRESSED_RGBA_S3TC_DXT5_EXT
3374>0	ulelong	0x8D64	\b, ETC1_RGB8_OES
3375>0	ulelong	0x9270	\b, COMPRESSED_R11_EAC
3376>0	ulelong	0x9271	\b, COMPRESSED_SIGNED_R11_EAC
3377>0	ulelong	0x9272	\b, COMPRESSED_RG11_EAC
3378>0	ulelong	0x9273	\b, COMPRESSED_SIGNED_RG11_EAC
3379>0	ulelong	0x9274	\b, COMPRESSED_RGB8_ETC2
3380>0	ulelong	0x9275	\b, COMPRESSED_SRGB8_ETC2
3381>0	ulelong	0x9276	\b, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
3382>0	ulelong	0x9277	\b, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
3383>0	ulelong	0x9278	\b, COMPRESSED_RGBA2_ETC2_EAC
3384>0	ulelong	0x9279	\b, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
3385>0	ulelong	0x93B0	\b, COMPRESSED_RGBA_ASTC_4x4_KHR
3386>0	ulelong	0x93B1	\b, COMPRESSED_RGBA_ASTC_5x4_KHR
3387>0	ulelong	0x93B2	\b, COMPRESSED_RGBA_ASTC_5x5_KHR
3388>0	ulelong	0x93B3	\b, COMPRESSED_RGBA_ASTC_6x5_KHR
3389>0	ulelong	0x93B4	\b, COMPRESSED_RGBA_ASTC_6x6_KHR
3390>0	ulelong	0x93B5	\b, COMPRESSED_RGBA_ASTC_8x5_KHR
3391>0	ulelong	0x93B6	\b, COMPRESSED_RGBA_ASTC_8x6_KHR
3392>0	ulelong	0x93B7	\b, COMPRESSED_RGBA_ASTC_8x8_KHR
3393>0	ulelong	0x93B8	\b, COMPRESSED_RGBA_ASTC_10x5_KHR
3394>0	ulelong	0x93B9	\b, COMPRESSED_RGBA_ASTC_10x6_KHR
3395>0	ulelong	0x93BA	\b, COMPRESSED_RGBA_ASTC_10x8_KHR
3396>0	ulelong	0x93BB	\b, COMPRESSED_RGBA_ASTC_10x10_KHR
3397>0	ulelong	0x93BC	\b, COMPRESSED_RGBA_ASTC_12x10_KHR
3398>0	ulelong	0x93BD	\b, COMPRESSED_RGBA_ASTC_12x12_KHR
3399>0	ulelong	0x93D0	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
3400>0	ulelong	0x93D1	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
3401>0	ulelong	0x93D2	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
3402>0	ulelong	0x93D3	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
3403>0	ulelong	0x93D4	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
3404>0	ulelong	0x93D5	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
3405>0	ulelong	0x93D6	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
3406>0	ulelong	0x93D7	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
3407>0	ulelong	0x93D8	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
3408>0	ulelong	0x93D9	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
3409>0	ulelong	0x93DA	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
3410>0	ulelong	0x93DB	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
3411>0	ulelong	0x93DC	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
3412>0	ulelong	0x93DD	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
3413
3414# Endian-specific KTX header.
3415# TODO: glType (all textures I've seen so far are GL_UNSIGNED_BYTE)
34160	name	khronos-ktx-endian-header
3417>20	ulelong	x	\b, %u
3418>24	ulelong	>1	x %u
3419>28	ulelong	>1	x %u
3420>8	ulelong	>0
3421>>8	use	khronos-ktx-glEnum
3422>8	ulelong	0
3423>>12	use	khronos-ktx-glEnum
3424
3425# Main KTX header.
3426# Determine endianness, then check the rest of the header.
34270	string	\xABKTX\ 11\xBB\r\n\x1A\n	Khronos KTX texture
3428!:mime	image/ktx
3429!:ext	ktx
3430>12	ulelong	0x04030201			(little-endian)
3431>>16	use	khronos-ktx-endian-header
3432>12	ubelong	0x04030201			(big-endian)
3433>>16	use	\^khronos-ktx-endian-header
3434
3435# Type: Khronos KTX2 texture.
3436# From: David Korth <gerbilsoft@gerbilsoft.com>
3437# Based on draft19.
3438# Reference: http://github.khronos.org/KTX-Specification/
3439# https://www.iana.org/assignments/media-types/image/ktx2
3440
3441# Supercompression enum.
34420	name	khronos-ktx2-supercompression
3443>0	ulelong	1	BasisLZ
3444>0	ulelong	2	Zstandard
3445>0	ulelong	3	ZLIB
3446
3447# Vulkan format identifier.
3448# NOTE: Formats prohibited from KTX2 are commented out.
34490	name	khronos-ktx2-vkFormat
3450>0	ulelong	0	UNDEFINED
3451>0	ulelong	1	R4G4_UNORM_PACK8
3452>0	ulelong	2	R4G4B4A4_UNORM_PACK16
3453>0	ulelong	3	B4G4R4A4_UNORM_PACK16
3454>0	ulelong	4	R5G6B5_UNORM_PACK16
3455>0	ulelong	5	B5G6R5_UNORM_PACK16
3456>0	ulelong	6	R5G5B5A1_UNORM_PACK16
3457>0	ulelong	7	B5G5R5A1_UNORM_PACK16
3458>0	ulelong	8	A1R5G5B5_UNORM_PACK16
3459>0	ulelong	9	R8_UNORM
3460>0	ulelong	10	R8_SNORM
3461#>0	ulelong	11	R8_USCALED
3462#>0	ulelong	12	R8_SSCALED
3463>0	ulelong	13	R8_UINT
3464>0	ulelong	14	R8_SINT
3465>0	ulelong	15	R8_SRGB
3466>0	ulelong	16	R8G8_UNORM
3467>0	ulelong	17	R8G8_SNORM
3468#>0	ulelong	18	R8G8_USCALED
3469#>0	ulelong	19	R8G8_SSCALED
3470>0	ulelong	20	R8G8_UINT
3471>0	ulelong	21	R8G8_SINT
3472>0	ulelong	22	R8G8_SRGB
3473>0	ulelong	23	R8G8B8_UNORM
3474>0	ulelong	24	R8G8B8_SNORM
3475#>0	ulelong	25	R8G8B8_USCALED
3476#>0	ulelong	26	R8G8B8_SSCALED
3477>0	ulelong	27	R8G8B8_UINT
3478>0	ulelong	28	R8G8B8_SINT
3479>0	ulelong	29	R8G8B8_SRGB
3480>0	ulelong	30	B8G8R8_UNORM
3481>0	ulelong	31	B8G8R8_SNORM
3482#>0	ulelong	32	B8G8R8_USCALED
3483#>0	ulelong	33	B8G8R8_SSCALED
3484>0	ulelong	34	B8G8R8_UINT
3485>0	ulelong	35	B8G8R8_SINT
3486>0	ulelong	36	B8G8R8_SRGB
3487>0	ulelong	37	R8G8B8A8_UNORM
3488>0	ulelong	38	R8G8B8A8_SNORM
3489#>0	ulelong	39	R8G8B8A8_USCALED
3490#>0	ulelong	40	R8G8B8A8_SSCALED
3491>0	ulelong	41	R8G8B8A8_UINT
3492>0	ulelong	42	R8G8B8A8_SINT
3493>0	ulelong	43	R8G8B8A8_SRGB
3494>0	ulelong	44	B8G8R8A8_UNORM
3495>0	ulelong	45	B8G8R8A8_SNORM
3496#>0	ulelong	46	B8G8R8A8_USCALED
3497#>0	ulelong	47	B8G8R8A8_SSCALED
3498>0	ulelong	48	B8G8R8A8_UINT
3499>0	ulelong	49	B8G8R8A8_SINT
3500>0	ulelong	50	B8G8R8A8_SRGB
3501#>0	ulelong	51	A8B8G8R8_UNORM_PACK32
3502#>0	ulelong	52	A8B8G8R8_SNORM_PACK32
3503#>0	ulelong	53	A8B8G8R8_USCALED_PACK32
3504#>0	ulelong	54	A8B8G8R8_SSCALED_PACK32
3505#>0	ulelong	55	A8B8G8R8_UINT_PACK32
3506#>0	ulelong	56	A8B8G8R8_SINT_PACK32
3507#>0	ulelong	57	A8B8G8R8_SRGB_PACK32
3508>0	ulelong	58	A2R10G10B10_UNORM_PACK32
3509>0	ulelong	59	A2R10G10B10_SNORM_PACK32
3510#>0	ulelong	60	A2R10G10B10_USCALED_PACK32
3511#>0	ulelong	61	A2R10G10B10_SSCALED_PACK32
3512>0	ulelong	62	A2R10G10B10_UINT_PACK32
3513>0	ulelong	63	A2R10G10B10_SINT_PACK32
3514>0	ulelong	64	A2B10G10R10_UNORM_PACK32
3515>0	ulelong	65	A2B10G10R10_SNORM_PACK32
3516#>0	ulelong	66	A2B10G10R10_USCALED_PACK32
3517#>0	ulelong	67	A2B10G10R10_SSCALED_PACK32
3518>0	ulelong	68	A2B10G10R10_UINT_PACK32
3519>0	ulelong	69	A2B10G10R10_SINT_PACK32
3520>0	ulelong	70	R16_UNORM
3521>0	ulelong	71	R16_SNORM
3522#>0	ulelong	72	R16_USCALED
3523#>0	ulelong	73	R16_SSCALED
3524>0	ulelong	74	R16_UINT
3525>0	ulelong	75	R16_SINT
3526>0	ulelong	76	R16_SFLOAT
3527>0	ulelong	77	R16G16_UNORM
3528>0	ulelong	78	R16G16_SNORM
3529#>0	ulelong	79	R16G16_USCALED
3530#>0	ulelong	80	R16G16_SSCALED
3531>0	ulelong	81	R16G16_UINT
3532>0	ulelong	82	R16G16_SINT
3533>0	ulelong	83	R16G16_SFLOAT
3534>0	ulelong	84	R16G16B16_UNORM
3535>0	ulelong	85	R16G16B16_SNORM
3536#>0	ulelong	86	R16G16B16_USCALED
3537#>0	ulelong	87	R16G16B16_SSCALED
3538>0	ulelong	88	R16G16B16_UINT
3539>0	ulelong	89	R16G16B16_SINT
3540>0	ulelong	90	R16G16B16_SFLOAT
3541>0	ulelong	91	R16G16B16A16_UNORM
3542>0	ulelong	92	R16G16B16A16_SNORM
3543#>0	ulelong	93	R16G16B16A16_USCALED
3544#>0	ulelong	94	R16G16B16A16_SSCALED
3545>0	ulelong	95	R16G16B16A16_UINT
3546>0	ulelong	96	R16G16B16A16_SINT
3547>0	ulelong	97	R16G16B16A16_SFLOAT
3548>0	ulelong	98	R32_UINT
3549>0	ulelong	99	R32_SINT
3550>0	ulelong	100	R32_SFLOAT
3551>0	ulelong	101	R32G32_UINT
3552>0	ulelong	102	R32G32_SINT
3553>0	ulelong	103	R32G32_SFLOAT
3554>0	ulelong	104	R32G32B32_UINT
3555>0	ulelong	105	R32G32B32_SINT
3556>0	ulelong	106	R32G32B32_SFLOAT
3557>0	ulelong	107	R32G32B32A32_UINT
3558>0	ulelong	108	R32G32B32A32_SINT
3559>0	ulelong	109	R32G32B32A32_SFLOAT
3560>0	ulelong	110	R64_UINT
3561>0	ulelong	111	R64_SINT
3562>0	ulelong	112	R64_SFLOAT
3563>0	ulelong	113	R64G64_UINT
3564>0	ulelong	114	R64G64_SINT
3565>0	ulelong	115	R64G64_SFLOAT
3566>0	ulelong	116	R64G64B64_UINT
3567>0	ulelong	117	R64G64B64_SINT
3568>0	ulelong	118	R64G64B64_SFLOAT
3569>0	ulelong	119	R64G64B64A64_UINT
3570>0	ulelong	120	R64G64B64A64_SINT
3571>0	ulelong	121	R64G64B64A64_SFLOAT
3572>0	ulelong	122	B10G11R11_UFLOAT_PACK32
3573>0	ulelong	123	E5B9G9R9_UFLOAT_PACK32
3574>0	ulelong	124	D16_UNORM
3575>0	ulelong	125	X8_D24_UNORM_PACK32
3576>0	ulelong	126	D32_SFLOAT
3577>0	ulelong	127	S8_UINT
3578>0	ulelong	128	D16_UNORM_S8_UINT
3579>0	ulelong	129	D24_UNORM_S8_UINT
3580>0	ulelong	130	D32_SFLOAT_S8_UINT
3581
3582>0	ulelong	131	BC1_RGB_UNORM_BLOCK
3583>0	ulelong	132	BC1_RGB_SRGB_BLOCK
3584>0	ulelong	133	BC1_RGBA_UNORM_BLOCK
3585>0	ulelong	134	BC1_RGBA_SRGB_BLOCK
3586>0	ulelong	135	BC2_UNORM_BLOCK
3587>0	ulelong	136	BC2_SRGB_BLOCK
3588>0	ulelong	137	BC3_UNORM_BLOCK
3589>0	ulelong	138	BC3_SRGB_BLOCK
3590>0	ulelong	139	BC4_UNORM_BLOCK
3591>0	ulelong	140	BC4_SNORM_BLOCK
3592>0	ulelong	141	BC5_UNORM_BLOCK
3593>0	ulelong	142	BC5_SNORM_BLOCK
3594>0	ulelong	143	BC6H_UFLOAT_BLOCK
3595>0	ulelong	144	BC6H_SFLOAT_BLOCK
3596>0	ulelong	145	BC7_UNORM_BLOCK
3597>0	ulelong	146	BC7_SRGB_BLOCK
3598
3599>0	ulelong	147	ETC2_R8G8B8_UNORM_BLOCK
3600>0	ulelong	148	ETC2_R8G8B8_SRGB_BLOCK
3601>0	ulelong	149	ETC2_R8G8B8A1_UNORM_BLOCK
3602>0	ulelong	150	ETC2_R8G8B8A1_SRGB_BLOCK
3603>0	ulelong	151	ETC2_R8G8B8A8_UNORM_BLOCK
3604>0	ulelong	152	ETC2_R8G8B8A8_SRGB_BLOCK
3605
3606>0	ulelong	153	EAC_R11_UNORM_BLOCK
3607>0	ulelong	154	EAC_R11_SNORM_BLOCK
3608>0	ulelong	155	EAC_R11G11_UNORM_BLOCK
3609>0	ulelong	156	EAC_R11G11_SNORM_BLOCK
3610
3611>0	ulelong	157	ASTC_4x4_UNORM_BLOCK
3612>0	ulelong	158	ASTC_4x4_SRGB_BLOCK
3613>0	ulelong	159	ASTC_5x4_UNORM_BLOCK
3614>0	ulelong	160	ASTC_5x4_SRGB_BLOCK
3615>0	ulelong	161	ASTC_5x5_UNORM_BLOCK
3616>0	ulelong	162	ASTC_5x5_SRGB_BLOCK
3617>0	ulelong	163	ASTC_6x5_UNORM_BLOCK
3618>0	ulelong	164	ASTC_6x5_SRGB_BLOCK
3619>0	ulelong	165	ASTC_6x6_UNORM_BLOCK
3620>0	ulelong	166	ASTC_6x6_SRGB_BLOCK
3621>0	ulelong	167	ASTC_8x5_UNORM_BLOCK
3622>0	ulelong	168	ASTC_8x5_SRGB_BLOCK
3623>0	ulelong	169	ASTC_8x6_UNORM_BLOCK
3624>0	ulelong	170	ASTC_8x6_SRGB_BLOCK
3625>0	ulelong	171	ASTC_8x8_UNORM_BLOCK
3626>0	ulelong	172	ASTC_8x8_SRGB_BLOCK
3627>0	ulelong	173	ASTC_10x5_UNORM_BLOCK
3628>0	ulelong	174	ASTC_10x5_SRGB_BLOCK
3629>0	ulelong	175	ASTC_10x6_UNORM_BLOCK
3630>0	ulelong	176	ASTC_10x6_SRGB_BLOCK
3631>0	ulelong	177	ASTC_10x8_UNORM_BLOCK
3632>0	ulelong	178	ASTC_10x8_SRGB_BLOCK
3633>0	ulelong	179	ASTC_10x10_UNORM_BLOCK
3634>0	ulelong	180	ASTC_10x10_SRGB_BLOCK
3635>0	ulelong	181	ASTC_12x10_UNORM_BLOCK
3636>0	ulelong	182	ASTC_12x10_SRGB_BLOCK
3637>0	ulelong	183	ASTC_12x12_UNORM_BLOCK
3638>0	ulelong	184	ASTC_12x12_SRGB_BLOCK
3639
3640>0	ulelong	1000156000	G8B8G8R8_422_UNORM
3641>0	ulelong	1000156001	B8G8R8G8_422_UNORM
3642>0	ulelong	1000156002	G8_B8_R8_3PLANE_420_UNORM
3643>0	ulelong	1000156003	G8_B8R8_2PLANE_420_UNORM
3644>0	ulelong	1000156004	G8_B8_R8_3PLANE_422_UNORM
3645>0	ulelong	1000156005	G8_B8R8_2PLANE_422_UNORM
3646>0	ulelong	1000156006	G8_B8_R8_3PLANE_444_UNORM
3647>0	ulelong	1000156007	R10X6_UNORM_PACK16
3648>0	ulelong	1000156008	R10X6G10X6_UNORM_2PACK16
3649>0	ulelong	1000156009	R10X6G10X6B10X6A10X6_UNORM_4PACK16
3650>0	ulelong	1000156010	G10X6B10X6G10X6R10X6_422_UNORM_4PACK16
3651>0	ulelong	1000156011	B10X6G10X6R10X6G10X6_422_UNORM_4PACK16
3652>0	ulelong	1000156012	G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16
3653>0	ulelong	1000156013	G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16
3654>0	ulelong	1000156014	G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16
3655>0	ulelong	1000156015	G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16
3656>0	ulelong	1000156016	G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16
3657>0	ulelong	1000156017	R12X4_UNORM_PACK16
3658>0	ulelong	1000156018	R12X4G12X4_UNORM_2PACK16
3659>0	ulelong	1000156019	R12X4G12X4B12X4A12X4_UNORM_4PACK16
3660>0	ulelong	1000156020	G12X4B12X4G12X4R12X4_422_UNORM_4PACK16
3661>0	ulelong	1000156021	B12X4G12X4R12X4G12X4_422_UNORM_4PACK16
3662>0	ulelong	1000156022	G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16
3663>0	ulelong	1000156023	G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16
3664>0	ulelong	1000156024	G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16
3665>0	ulelong	1000156025	G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16
3666>0	ulelong	1000156026	G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16
3667>0	ulelong	1000156027	G16B16G16R16_422_UNORM
3668>0	ulelong	1000156028	B16G16R16G16_422_UNORM
3669>0	ulelong	1000156029	G16_B16_R16_3PLANE_420_UNORM
3670>0	ulelong	1000156030	G16_B16R16_2PLANE_420_UNORM
3671>0	ulelong	1000156031	G16_B16_R16_3PLANE_422_UNORM
3672>0	ulelong	1000156032	G16_B16R16_2PLANE_422_UNORM
3673>0	ulelong	1000156033	G16_B16_R16_3PLANE_444_UNORM
3674
3675>0	ulelong	1000054000	PVRTC1_2BPP_UNORM_BLOCK_IMG
3676>0	ulelong	1000054001	PVRTC1_4BPP_UNORM_BLOCK_IMG
3677>0	ulelong	1000054002	PVRTC2_2BPP_UNORM_BLOCK_IMG
3678>0	ulelong	1000054003	PVRTC2_4BPP_UNORM_BLOCK_IMG
3679>0	ulelong	1000054004	PVRTC1_2BPP_SRGB_BLOCK_IMG
3680>0	ulelong	1000054005	PVRTC1_4BPP_SRGB_BLOCK_IMG
3681>0	ulelong	1000054006	PVRTC2_2BPP_SRGB_BLOCK_IMG
3682>0	ulelong	1000054007	PVRTC2_4BPP_SRGB_BLOCK_IMG
3683
3684>0	ulelong	1000066000	ASTC_4x4_SFLOAT_BLOCK_EXT
3685>0	ulelong	1000066001	ASTC_5x4_SFLOAT_BLOCK_EXT
3686>0	ulelong	1000066002	ASTC_5x5_SFLOAT_BLOCK_EXT
3687>0	ulelong	1000066003	ASTC_6x5_SFLOAT_BLOCK_EXT
3688>0	ulelong	1000066004	ASTC_6x6_SFLOAT_BLOCK_EXT
3689>0	ulelong	1000066005	ASTC_8x5_SFLOAT_BLOCK_EXT
3690>0	ulelong	1000066006	ASTC_8x6_SFLOAT_BLOCK_EXT
3691>0	ulelong	1000066007	ASTC_8x8_SFLOAT_BLOCK_EXT
3692>0	ulelong	1000066008	ASTC_10x5_SFLOAT_BLOCK_EXT
3693>0	ulelong	1000066009	ASTC_10x6_SFLOAT_BLOCK_EXT
3694>0	ulelong	1000066010	ASTC_10x8_SFLOAT_BLOCK_EXT
3695>0	ulelong	1000066011	ASTC_10x10_SFLOAT_BLOCK_EXT
3696>0	ulelong	1000066012	ASTC_12x10_SFLOAT_BLOCK_EXT
3697>0	ulelong	1000066013	ASTC_12x12_SFLOAT_BLOCK_EXT
3698
3699# Main KTX2 header.
37000	string	\xABKTX\ 20\xBB\r\n\x1A\n	Khronos KTX2 texture
3701!:mime	image/ktx2
3702!:ext	ktx2
3703>20	ulelong	x	\b, %u
3704>24	ulelong	>1	x %u
3705>28	ulelong	>1	x %u
3706>32	ulelong	>1	\b, %u layers
3707>36	ulelong	>1	\b, %u faces
3708>40	ulelong	>1	\b, %u mipmaps
3709>44	ulelong	>0	\b,
3710>>44	use	khronos-ktx2-supercompression
3711>12	ulelong	>0	\b,
3712>>12	use	khronos-ktx2-vkFormat
3713
3714# Type: Valve VTF texture.
3715# From: David Korth <gerbilsoft@gerbilsoft.com>
3716# References:
3717# - https://developer.valvesoftware.com/wiki/Valve_Texture_Format
3718
3719# VTF image formats.
37200	name	vtf-image-format
3721>0	ulelong	0	RGBA8888
3722>0	ulelong	1	ABGR8888
3723>0	ulelong	2	RGB888
3724>0	ulelong	3	BGR888
3725>0	ulelong	4	RGB565
3726>0	ulelong	5	I8
3727>0	ulelong	6	IA88
3728>0	ulelong	7	P8
3729>0	ulelong	8	A8
3730>0	ulelong	9	RGB888 (bluescreen)
3731>0	ulelong	10	BGR888 (bluescreen)
3732>0	ulelong	11	ARGB8888
3733>0	ulelong	12	BGRA8888
3734>0	ulelong	13	DXT1
3735>0	ulelong	14	DXT3
3736>0	ulelong	15	DXT5
3737>0	ulelong	16	BGRx8888
3738>0	ulelong	17	BGR565
3739>0	ulelong	18	BGRx5551
3740>0	ulelong	19	BGRA4444
3741>0	ulelong	20	DXT1+A1
3742>0	ulelong	21	BGRA5551
3743>0	ulelong	22	UV88
3744>0	ulelong	23	UVWQ8888
3745>0	ulelong	24	RGBA16161616F
3746>0	ulelong	25	RGBA16161616
3747>0	ulelong	26	UVLX8888
3748
3749# Main VTF header.
37500	string	VTF\0				Valve Texture Format
3751>4	ulelong	x				v%u
3752>8	ulelong	x				\b.%u
3753>0x10	uleshort	x				\b, %u
3754>0x12	uleshort	>1				x %u
3755>4	lequad	0x0000000700000002
3756>>0x3F	uleshort	>1				x %u
3757>0x18	uleshort	>1				\b, %u frames
3758>0x38	ubyte	x				\b, mipmaps: %u
3759>0x34	ulelong	>-1				\b,
3760>>0x34	use	vtf-image-format
3761
3762# Type: Valve VTF3 (PS3) texture.
3763# From: David Korth <gerbilsoft@gerbilsoft.com>
37640	string		VTF3	Valve Texture Format (PS3)
3765>0x14	ubeshort		x	\b, %u
3766>0x16	ubeshort		x	\b x %u
3767>0x10	ubelong&0x2000	0	\b, DXT1
3768>0x10	ubelong&0x2000	0x2000	\b, DXT5
3769
3770# Type: ASTC texture.
3771# From: David Korth <gerbilsoft@gerbilsoft.com>
3772# References:
3773# - https://stackoverflow.com/questions/22600678/determine-internal-format-of-given-astc-compressed-image-through-its-header
3774# - https://stackoverflow.com/a/22682244
37750	ulelong	0x5ca1ab13			ASTC
3776>4	ubyte	x				%u
3777>5	ubyte	x				\bx%u
3778>6	ubyte	>1				\bx%u
3779# X, Y, and Z dimensions are stored as 24-bit LE.
3780# Pretend it's 32-bit and mask off the high byte.
3781>7	ulelong&0x00FFFFFF	x		texture, %u
3782>10	ulelong&0x00FFFFFF	x		x %u
3783>13	ulelong&0x00FFFFFF	>1		x %u
3784
3785# Zebra Metafile graphic
3786# http://www.fileformat.info/format/zbr/egff.htm
37870	ubeshort	0x9a02	Zebra Metafile graphic
3788>2	uleshort 1	(version 1.x)
3789>2	uleshort	2	(version 1.1x or 1.2x)
3790>2	uleshort	3	(version 1.49)
3791>2	uleshort	4	(version 1.50)
3792>4	string	x	(comment = %s)
3793
3794# Microsoft Paint graphic
3795# http://www.fileformat.info/format/mspaint/egff.htm
37960	string	DanM 	Microsoft Paint image data (version 1.x)
3797>4	uleshort	x	(%d
3798>>6	uleshort	x	x %d)
37990	string	LinS 	Microsoft Paint image data (version 2.0)
3800>4	uleshort	x	(%d
3801>>6	uleshort	x	x %d)
3802
3803# reMarkable tablet internal file format (https://www.remarkable.com/)
3804# https://github.com/ax3l/lines-are-beautiful
3805# https://plasma.ninja/blog/devices/remarkable/binary/format/2017/12/26/\
3806#	reMarkable-lines-file-format.html#what-to-do-next
3807# from Axel Huebl
38080		string	reMarkable
3809>11		string	lines
3810>>17		string	with
3811>>>22		string	selections
3812>>>>33		string	and
3813>>>>>37		string	layers
3814>>>>>>43	ulelong	x	reMarkable tablet notebook lines, 1404 x 1872, %x page(s)
3815# newer per-page files for the reMarkable
3816>11		string	.lines
3817>>18		string	file,
3818>>>24		string	version=
3819>>>>32		ubyte	x	reMarkable tablet page (v%c), 1404 x 1872,
3820>>>>>43		ulelong	x	%d layer(s)
3821
3822# Type: PVR3 texture.
3823# From: David Korth <gerbilsoft@gerbilsoft.com>
3824# References:
3825# - http://cdn.imgtec.com/sdk-documentation/PVR+File+Format.Specification.pdf
3826
3827# PVR3 pixel formats.
38280	name		pvr3-pixel-format
3829>0	ulelong	0	PVRTC 2bpp RGB
3830>0	ulelong	1	PVRTC 2bpp RGBA
3831>0	ulelong	2	PVRTC 4bpp RGB
3832>0	ulelong	3	PVRTC 4bpp RGBA
3833>0	ulelong	4	PVRTC-II 2bpp
3834>0	ulelong	5	PVRTC-II 4bpp
3835>0	ulelong	6	ETC1
3836>0	ulelong	7	DXT1
3837>0	ulelong	8	DXT2
3838>0	ulelong	9	DXT3
3839>0	ulelong	10	DXT4
3840>0	ulelong	11	DXT5
3841>0	ulelong	12	BC4
3842>0	ulelong	13	BC5
3843>0	ulelong	14	BC6
3844>0	ulelong	15	BC7
3845>0	ulelong	16	UYVY
3846>0	ulelong	17	YUY2
3847>0	ulelong	18	BW1bpp
3848>0	ulelong	19	R9G9B9E5 Shared Exponent
3849>0	ulelong	20	RGBG8888
3850>0	ulelong	21	GRGB8888
3851>0	ulelong	22	ETC2 RGB
3852>0	ulelong	23	ETC2 RGBA
3853>0	ulelong	24	ETC2 RGB A1
3854>0	ulelong	25	EAC R11
3855>0	ulelong	26	EAC RG11
3856>0	ulelong	27	ASTC_4x4
3857>0	ulelong	28	ASTC_5x4
3858>0	ulelong	29	ASTC_5x5
3859>0	ulelong	30	ASTC_6x5
3860>0	ulelong	31	ASTC_6x6
3861>0	ulelong	32	ASTC_8x5
3862>0	ulelong	33	ASTC_8x6
3863>0	ulelong	34	ASTC_8x8
3864>0	ulelong	35	ASTC_10x5
3865>0	ulelong	36	ASTC_10x6
3866>0	ulelong	37	ASTC_10x8
3867>0	ulelong	38	ASTC_10x10
3868>0	ulelong	39	ASTC_12x10
3869>0	ulelong	40	ASTC_12x12
3870>0	ulelong	41	ASTC_3x3x3
3871>0	ulelong	42	ASTC_4x3x3
3872>0	ulelong	43	ASTC_4x4x3
3873>0	ulelong	44	ASTC_4x4x4
3874>0	ulelong	45	ASTC_5x4x4
3875>0	ulelong	46	ASTC_5x5x4
3876>0	ulelong	47	ASTC_5x5x5
3877>0	ulelong	48	ASTC_6x5x5
3878>0	ulelong	49	ASTC_6x6x5
3879>0	ulelong	50	ASTC_6x6x6
3880
38810	string		PVR\x03			PowerVR 3.0 texture:
3882>0x18	ulelong		x	%u x
3883>0x1C	ulelong		x	%u
3884>0x20	ulelong		>1	x %u
3885>0x08	ubyte		x	\b,
3886>0x0C	ulelong		0
3887>>0x08	use	pvr3-pixel-format
3888>0x0C	ulelong		!0
3889>>0x08	ubyte	!0	%c
3890>>>0x0C	ubyte	!0	\b%u
3891>>0x09	ubyte	!0	\b%c
3892>>>0x0D	ubyte	!0	\b%u
3893>>0x0A	ubyte	!0	\b%c
3894>>>0x0E	ubyte	!0	\b%u
3895>>0x0B	ubyte	!0	\b%c
3896>>>0x0F	ubyte	!0	\b%u
3897>0x10	ulelong		1	\b, sRGB
3898>0x04	ulelong&0x02	0x02	\b, premultiplied alpha
3899
39000	string		\x03RVP			PowerVR 3.0 texture: BE,
3901>0x18	ubelong		x	%u x
3902>0x1C	ubelong		x	%u
3903>0x20	ubelong		>1	x %u
3904>0x08	ubyte		x	\b,
3905>0x0C	ubelong		0
3906>>0x08	use	pvr3-pixel-format
3907>0x0C	ubelong		!0
3908>>0x0B	ubyte	!0	%c
3909>>>0x0F	ubyte	!0	\b%u
3910>>0x0A	ubyte	!0	\b%c
3911>>>0x0E	ubyte	!0	\b%u
3912>>0x09	ubyte	!0	\b%c
3913>>>0x0D	ubyte	!0	\b%u
3914>>0x08	ubyte	!0	\b%c
3915>>>0x0C	ubyte	!0	\b%u
3916>0x10	ubelong		1	\b, sRGB
3917>0x04	ubelong&0x02	0x02	\b, premultiplied alpha
3918
3919# Type: Microsoft Xbox XPR0 texture.
3920# From: David Korth <gerbilsoft@gerbilsoft.com>
3921# References:
3922# - https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/develop/src/core/hle/D3D8/XbD3D8Types.h
3923
3924# XPR pixel formats.
39250	name	xbox-xpr-pixel-format
3926>0	ubyte	0x00	L8
3927>0	ubyte	0x01	AL8
3928>0	ubyte	0x02	ARGB1555
3929>0	ubyte	0x03	RGB555
3930>0	ubyte	0x04	ARGB4444
3931>0	ubyte	0x05	RGB565
3932>0	ubyte	0x06	ARGB8888
3933>0	ubyte	0x07	xRGB8888
3934>0	ubyte	0x0B	P8
3935>0	ubyte	0x0C	DXT1
3936>0	ubyte	0x0E	DXT2
3937>0	ubyte	0x0F	DXT4
3938>0	ubyte	0x10	Linear ARGB1555
3939>0	ubyte	0x11	Linear RGB565
3940>0	ubyte	0x12	Linear ARGB8888
3941>0	ubyte	0x13	Linear L8
3942>0	ubyte	0x16	Linear R8B8
3943>0	ubyte	0x17	Linear G8B8
3944>0	ubyte	0x19	A8
3945>0	ubyte	0x1A	A8L8
3946>0	ubyte	0x1B	Linear AL8
3947>0	ubyte	0x1C	Linear RGB555
3948>0	ubyte	0x1D	Linear ARGB4444
3949>0	ubyte	0x1E	Linear xRGB8888
3950>0	ubyte	0x1F	Linear A8
3951>0	ubyte	0x20	Linear A8L8
3952>0	ubyte	0x24	YUY2
3953>0	ubyte	0x25	UYVY
3954>0	ubyte	0x27	L6V5U5
3955>0	ubyte	0x28	V8U8
3956>0	ubyte	0x29	R8B8
3957>0	ubyte	0x2A	D24S8
3958>0	ubyte	0x2B	F24S8
3959>0	ubyte	0x2C	D16
3960>0	ubyte	0x2D	F16
3961>0	ubyte	0x2E	Linear D24S8
3962>0	ubyte	0x2F	Linear F24S8
3963>0	ubyte	0x30	Linear D16
3964>0	ubyte	0x31	Linear F16
3965>0	ubyte	0x32	L16
3966>0	ubyte	0x33	V16U16
3967>0	ubyte	0x35	Linear L16
3968>0	ubyte	0x36	Linear V16U16
3969>0	ubyte	0x37	Linear L6V5U5
3970>0	ubyte	0x38	RGBA5551
3971>0	ubyte	0x39	RGBA4444
3972>0	ubyte	0x3A	QWVU8888
3973>0	ubyte	0x3B	BGRA8888
3974>0	ubyte	0x3C	RGBA8888
3975>0	ubyte	0x3D	Linear RGBA5551
3976>0	ubyte	0x3E	Linear RGBA4444
3977>0	ubyte	0x3F	Linear ABGR8888
3978>0	ubyte	0x40	Linear BGRA8888
3979>0	ubyte	0x41	Linear RGBA8888
3980>0	ubyte	0x64	Vertex Data
3981
39820	string		XPR0	Microsoft Xbox XPR0 texture
3983>0x19	ubyte	x	\b, format:
3984>>0x19	use	xbox-xpr-pixel-format
3985
3986# ILDA Image Data Transfer Format
3987# https://www.ilda.com/resources/StandardsDocs/ILDA_IDTF14_rev011.pdf
3988#
3989# Updated by Chuck Hein (laser@geekdude.com)
3990#
39910	string		ILDA	ILDA Image Data Transfer Format
3992>7	ubyte		0x00	3D Coordinates with Indexed Color
3993>7	ubyte		0x01	2D Coordinates with Indexed Color
3994>7	ubyte		0x02	Color Palette
3995>7	ubyte		0x04	3D Coordinates with True Color
3996>7	ubyte		0x05	2D Coordinates with True Color
3997>8	string		>0	\b, palette %s
3998>16	string		>0	\b, company %s
3999>24	ubeshort	>0	\b, number of records %d
4000>>26	ubeshort	x	\b, palette number %d
4001>>28	ubeshort	>0	\b, number of frames %d
4002>>30	ubyte		>0	\b, projector number %d
4003
4004# Dropbox "lepton" compressed jpeg format
4005# https://github.com/dropbox/lepton
40060	ubelong&0xfffff0ff	0xcf84005a	Lepton image file
4007>2	ubyte			x		(version %d)
4008
4009# Apple QuickTake camera raw images
4010# https://en.wikipedia.org/wiki/Apple_QuickTake
4011# dcraw can decode them
40120	name quicktake
4013>4	ubelong		8
4014>>544	ubeshort	x	\b, %dx
4015>>546	ubeshort	x	\b%d
4016>4	ubelong		4
4017>>546	ubeshort	x	\b, %dx
4018>>544	ubeshort	x	\b%d
4019
40200	string	qktk	Apple QuickTake 100 Raw Image
4021>0	use quicktake
4022
40230	string	qktn
4024>4	ubyte	0	Apple QuickTake 150 Raw Image
4025>4	ubyte	>0	Apple QuickTake 200 Raw Image
4026>0	use quicktake
4027
4028# From:		Joerg Jenderek
4029# URL:		http://fileformats.archiveteam.org/wiki/Corel_Photo-Paint_image
4030# Reference:	http://blog.argasinski.eu/wp-content/uploads/2011/08/cpt-specification-0.01.pdf
40310	string	CPT
4032>4	string	FILE		Corel Photo-Paint image, version
4033# version like 7, 9 or 8
4034>>3	ubyte	x		%c,
4035!:mime	image/x-corel-cpt
4036!:ext	cpt
4037# if blocks_array_offset available jump blockNumber*8 bytes
4038>>0x34	ulelong		>0
4039>>>(0x28.l*8)	ubyte	x
4040# jump additional stored blocks_array_offset bytes forward to object block
4041>>>>&(0x34.l-1) ulelong x	%u
4042# object height in pixels
4043>>>>>&0		ulelong	x	x %u
4044# if no blocks_array_offset available jump blockNumber*8 bytes
4045>>0x34	ulelong		=0
4046>>>(0x28.l*8)	ubyte	x
4047# jump additional 0x13C bytes forward to object block
4048>>>>&0x13B	ulelong x	%u
4049>>>>>&0	ulelong		x	x %u
4050# image color model used
4051>>0x8	ulelong	x
4052>>>0x8	ulelong	0x1		RGB 24 bits
4053>>>0x8	ulelong	0x3		CMYK 24 bits
4054>>>0x8	ulelong	0x5		greyscale 8 bits
4055>>>0x8	ulelong	0x6		black and white 1 bit
4056>>>0x8	ulelong	0xA		RGB 8 bits
4057# palette_length  number of colors * 3 in case of 8-bit RGB paletted image
4058# 0 otherwise. Allowed values: 0 or [1..256] * 3
4059#>>0xC	ulelong	>0		\b, palette length %u
4060>>>>0xC	ulelong/3	<256	\b, %u colors
4061>>>0x8	ulelong	0xB		LAB
4062>>>0x8	ulelong	0xC		RGB 48 bits
4063>>>0x8	ulelong	0xE		greyscale 16 bits
4064# this should not happen
4065>>>0x8	default	x		color model
4066>>>>0x8	ulelong	x		%#x
4067# bit 1 in CPT file flags: UCS-2 file comment present
4068>>0x31	ubyte		&0x02
4069# look for comment marker
4070>>>0x100	search/0xc9d	\4\2\0\0
4071# UCS-2 file comment
4072>>>>&0		lestring16	x	"%s"
4073# if no UCS-2 is present show ANSI file comment[112] if available
4074>>0x31	ubyte&0x02	=0
4075>>>0x3C string		>\0	"%-.112s"
4076# reserved seems to be always 0
4077#>>0x10	ulelong		>0	\b, reserved1 %u
4078# horizontal real dpi = dpi_h * 25.4 / 10**6
4079>>0x18	ulelong	x		\b, %u micro dots/mm
4080# image vertical DPI in CPT DPI unit
4081#>>0x1C	ulelong	x		\b, %u micro dots/mm
4082# reserved seems to be always 0
4083#>>0x20	ulelong		>0	\b, reserved2 %u
4084#>>0x24	ulelong		>0	\b, reserved3 %u
4085# blocks_count; number of CPT_Block blocks. Allowed values: > 0
4086>>0x28	ulelong		x	\b, %u block
4087# plural s
4088>>0x28	ulelong		!1	\bs
4089# CPT file flags
4090# lower byte of CPT file flags: 0x94~CPT9FILE 0x01~often CPT7FILE 0x8C~CPT8FILE
4091#>>0x30	ubyte		x	\b, lower flags %#x
4092# upper byte of CPT file flags:
4093#>>0x31	ubyte		>0	\b, upper flags %#x
4094# bit 2 in CPT file flags: unknown
4095#>>0x31	ubyte		&0x04	\b, with UNKNOWN
4096# bits 3-7 in CPT file flags: unknown, seem to be often 0
4097# show unusual flag combinations
4098>>0x31	ubyte&0xFC	>0
4099>>>0x30	uleshort	x	\b, flags %#4.4x
4100# reserved seems to be always 0
4101#>>0x32	uleshort	>0	\b, reserved4 %#x
4102# blocks_array_offset is always 0 for CPT7 and CPT8 files created by PP7-PP8
4103# typical values like: 13Ch 154h 43Ch 4F0h DA8h
4104>>0x34	ulelong	x		\b, array offset %#x
4105# reserved seems to be often 0
4106>>0x38	ulelong		>0	\b, reserved5 %#x
4107# possible next master block
4108#>>0x100	ubequad		!0	\b, next block=%#llx...
4109# bit 0: ICC profile block present
4110>>0x31	ubyte		&0x01	\b, with ICC profile
4111# check for characteristic string acsp of color profile for DEBUGGING
4112#>>>0x178	string	x	icc=%.4s
4113#	display ICC/ICM color profile by ./icc
4114#>>>0x154	use		color-profile
4115
4116# URL:		http://fileformats.archiveteam.org/wiki/CorelDRAW
4117#		https://en.wikipedia.org/wiki/CorelDRAW
4118# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/c/cdr-gen.trid.xml
4119# Note:		called "CorelDRAW drawing (generic)" by TrID
4120#		version til 2 WL-based; from version 3 til 13 handled by ./riff and from 14 zip based handled by ./archive
41210	ubelong&0xFFffF7ff	0x574C6500	Corel Draw Picture
4122#!:mime						image/x-coreldraw
4123!:mime						application/vnd.corel-draw
4124!:ext						cdr
4125# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/c/cdr-corel-10.trid.xml
4126# Note:		called "CorelDRAW drawing (v1.0)" by TrID and
4127#		"CorelDraw Drawing" with version "1.0" by DROID via PUID fmt/467
4128#		only DROID fmt-467-signature-id-726.cdr example
4129>2	ubyte			0x65		\b, version 1.0
4130#>>4	ubelong			!0x45000000	\b, at 4 %#8.8x
4131# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/c/cdr-corel-20.trid.xml
4132# Note:		called "CorelDRAW drawing (v2.0)" by TrID and
4133#		"CorelDraw Drawing" with version "2.0" by DROID via PUID fmt/466
4134>2	ubyte			0x6D		\b, version 2.0
4135# According to DROID 0xed080000 or 0x25050000
4136#>>4	ubelong			!0xed080000
4137#>>>4	ubelong			!0x25050000	\b, at 4 %#8.8x
4138
4139# Type: Crunch compressed texture.
4140# From: David Korth <gerbilsoft@gerbilsoft.com>
4141# References:
4142# - https://github.com/BinomialLLC/crunch/blob/44c8402e24441c7524ca364941fd224ab3b971e9/inc/crn_decomp.h#L267
41430	ubelong		0x4878004A	Crunch compressed texture:
4144>0x0C	ubeshort	x	%u x
4145>0x0E	ubeshort	x	%u
4146>0x12	ubyte		0	\b, DXT1
4147>0x12	ubyte		1	\b, DXT3
4148>0x12	ubyte		2	\b, DXT5
4149>0x12	ubyte		3	\b, DXT5 CCxY
4150>0x12	ubyte		4	\b, DXT5 xGxR
4151>0x12	ubyte		5	\b, DXT5 xGBR
4152>0x12	ubyte		6	\b, DXT5 AGBR
4153>0x12	ubyte		7	\b, DXn XY
4154>0x12	ubyte		8	\b, DXn YX
4155>0x12	ubyte		9	\b, DXT5 Alpha
4156>0x12	ubyte		10	\b, ETC1
4157>0x10	ubyte		>1	\b, %u images
4158>0x11	ubyte		>1	\b, %u faces
4159# TODO: Flags at 0x13? (ubeshort)
4160
4161# Type: BasisLZ compressed texture.
4162# From: David Korth <gerbilsoft@gerbilsoft.com>
4163# References:
4164# - https://github.com/BinomialLLC/basis_universal/blob/master/spec/basis_spec.txt
41650	uleshort		0x4273
4166>0x04	uleshort		0x4D	BasisLZ
4167>>0x02	uleshort		x	v%x compressed texture:
4168>>0x14	ubyte			0	ETC1S
4169>>0x14	ubyte			1	UASTC 4x4
4170>>0x0E	ulelong&0xFFFFFF	>1	\b, %u slices
4171>>0x11	ulelong&0xFFFFFF	>1	\b, %u images
4172>>0x15	uleshort&0x02		2	\b, Y-flipped
4173
4174# MIME registration: https://www.iana.org/assignments/media-types/model/e57
4175# Sample files: http://www.libe57.org/data.html
4176# Reference implementation: http://www.libe57.org/
4177# https://www.ri.cmu.edu/pub_files/2011/1/2011-huber-e57-v3.pdf
41780	string		ASTM-E57	ASTM E57 three-dimensional model
4179!:mime model/e57
4180!:ext e57
4181
4182# QOI [Quite OK Image Format] images
4183# (Horia Mihai David, mihaidavid@posteo.net)
4184#
4185# QOI format by Dominic Szablewski <http://phoboslab.org/>
4186#           <https://qoiformat.org/>
4187#
4188# Based on spec v1.0 (2022.01.05) <https://qoiformat.org/qoi-specification.pdf>
4189
41900	string		qoif	QOI image data
4191!:ext qoi
4192!:mime image/x-qoi
4193# See <https://github.com/phoboslab/qoi/issues/167>
4194>4      ubelong		x       %ux
4195>8      ubelong		x       \b%u,
4196>>13	ubyte		0	s
4197>>>12	ubyte		3	\bRGB
4198>>>12	ubyte		4	\bRGBA
4199>>>12	default		x
4200>>>>12	ubyte		x	\b*bad channels %u*
4201>>>13	ubyte		0	(linear alpha)
4202>>13	ubyte		1
4203>>>12	ubyte		3	RGB
4204>>>12	ubyte		4	RGBA
4205>>>13	ubyte		1	(all channels linear)
4206>>13	default		x
4207>>>13	ubyte		x	*bad colorspace %u*
4208
4209
4210# Type: Godot 3 texture (pixel format)
4211# From: David Korth <gerbilsoft@gerbilsoft.com>
42120	name	godot-pixel-format-v3
4213>0	ulelong&0xFFFFF	0	L8
4214>0	ulelong&0xFFFFF	1	LA8
4215>0	ulelong&0xFFFFF	2	R8
4216>0	ulelong&0xFFFFF	3	RG8
4217>0	ulelong&0xFFFFF	4	RGB8
4218>0	ulelong&0xFFFFF	5	RGBA8
4219>0	ulelong&0xFFFFF	6	RGBA4444
4220>0	ulelong&0xFFFFF	7	RGB565
4221>0	ulelong&0xFFFFF	8	RF
4222>0	ulelong&0xFFFFF	9	RGF
4223>0	ulelong&0xFFFFF	10	RGBF
4224>0	ulelong&0xFFFFF	11	RGBAF
4225>0	ulelong&0xFFFFF	12	RH
4226>0	ulelong&0xFFFFF	13	RGH
4227>0	ulelong&0xFFFFF	14	RGBH
4228>0	ulelong&0xFFFFF	15	RGBAH
4229>0	ulelong&0xFFFFF	16	RGBE9995
4230>0	ulelong&0xFFFFF	17	DXT1
4231>0	ulelong&0xFFFFF	18	DXT3
4232>0	ulelong&0xFFFFF	19	DXT5
4233>0	ulelong&0xFFFFF	20	RGTC_R
4234>0	ulelong&0xFFFFF	21	RGTC_RG
4235>0	ulelong&0xFFFFF	22	BPTC_RGBA
4236>0	ulelong&0xFFFFF	23	BPTC_RGBF
4237>0	ulelong&0xFFFFF	24	BPTC_RGBFU
4238>0	ulelong&0xFFFFF	25	PVRTC1_2
4239>0	ulelong&0xFFFFF	26	PVRTC1_2A
4240>0	ulelong&0xFFFFF	27	PVRTC1_4
4241>0	ulelong&0xFFFFF	28	PVRTC1_4A
4242>0	ulelong&0xFFFFF	29	ETC
4243>0	ulelong&0xFFFFF	30	ETC2_R11
4244>0	ulelong&0xFFFFF	31	ETC2_R11S
4245>0	ulelong&0xFFFFF	32	ETC2_RG11
4246>0	ulelong&0xFFFFF	33	ETC2_RG11S
4247>0	ulelong&0xFFFFF	34	ETC2_RGB8
4248>0	ulelong&0xFFFFF	35	ETC2_RGBA8
4249>0	ulelong&0xFFFFF	36	ETC2_RGB8A1
4250# NOTE: This is a custom pixel format used by Sonic Colors Ultimate.
4251# Godot 4 later added its own ASTC format values.
4252>0	ulelong&0xFFFFF	37	ASTC_8x8
4253
4254# Type: Godot 4 texture (pixel format)
4255# From: David Korth <gerbilsoft@gerbilsoft.com>
4256# NOTE: This is a custom pixel format used by Sonic Colors Ultimate.
4257# Godot 4 later added its own ASTC format values.
42580	name	godot-pixel-format-v4
4259>0	ulelong&0xFFFFF	0	L8
4260>0	ulelong&0xFFFFF	1	LA8
4261>0	ulelong&0xFFFFF	2	R8
4262>0	ulelong&0xFFFFF	3	RG8
4263>0	ulelong&0xFFFFF	4	RGB8
4264>0	ulelong&0xFFFFF	5	RGBA8
4265>0	ulelong&0xFFFFF	6	RGBA4444
4266>0	ulelong&0xFFFFF	7	RGB565
4267>0	ulelong&0xFFFFF	8	RF
4268>0	ulelong&0xFFFFF	9	RGF
4269>0	ulelong&0xFFFFF	10	RGBF
4270>0	ulelong&0xFFFFF	11	RGBAF
4271>0	ulelong&0xFFFFF	12	RH
4272>0	ulelong&0xFFFFF	13	RGH
4273>0	ulelong&0xFFFFF	14	RGBH
4274>0	ulelong&0xFFFFF	15	RGBAH
4275>0	ulelong&0xFFFFF	16	RGBE9995
4276>0	ulelong&0xFFFFF	17	DXT1
4277>0	ulelong&0xFFFFF	18	DXT3
4278>0	ulelong&0xFFFFF	19	DXT5
4279>0	ulelong&0xFFFFF	20	RGTC_R
4280>0	ulelong&0xFFFFF	21	RGTC_RG
4281>0	ulelong&0xFFFFF	22	BPTC_RGBA
4282>0	ulelong&0xFFFFF	23	BPTC_RGBF
4283>0	ulelong&0xFFFFF	24	BPTC_RGBFU
4284>0	ulelong&0xFFFFF	25	ETC
4285>0	ulelong&0xFFFFF	36	ETC2_R11
4286>0	ulelong&0xFFFFF	27	ETC2_R11S
4287>0	ulelong&0xFFFFF	28	ETC2_RG11
4288>0	ulelong&0xFFFFF	29	ETC2_RG11S
4289>0	ulelong&0xFFFFF	30	ETC2_RGB8
4290>0	ulelong&0xFFFFF	31	ETC2_RGBA8
4291>0	ulelong&0xFFFFF	32	ETC2_RGB8A1
4292>0	ulelong&0xFFFFF	33	ETC2_RA_AS_RG
4293>0	ulelong&0xFFFFF	34	DXT5_RA_AS_RG
4294>0	ulelong&0xFFFFF	35	ASTC_4x4
4295>0	ulelong&0xFFFFF	36	ASTC_4x4_HDR
4296>0	ulelong&0xFFFFF	37	ASTC_8x8
4297>0	ulelong&0xFFFFF	38	ASTC_8x8_HDR
4298
4299# Type: Godot 3, 4 texture (rescale display, width)
4300# From: David Korth <gerbilsoft@gerbilsoft.com>
4301# Shows rescale value if it's not a power of 2.
43020	name	godot-rescale-display-w
4303>0	uleshort	0
4304>0	uleshort	1
4305>0	uleshort	2
4306>0	uleshort	4
4307>0	uleshort	8
4308>0	uleshort	16
4309>0	uleshort	32
4310>0	uleshort	64
4311>0	uleshort	128
4312>0	uleshort	256
4313>0	uleshort	512
4314>0	uleshort	1024
4315>0	uleshort	2048
4316>0	uleshort	4096
4317>0	uleshort	8192
4318>0	uleshort	16384
4319>0	uleshort	32768
4320>0	default		x
4321>>0	uleshort	x	(rescale to %u x
4322
4323# Type: Godot 3, 4 texture (rescale display, height)
4324# From: David Korth <gerbilsoft@gerbilsoft.com>
4325# Shows rescale value if it's not a power of 2.
43260	name	godot-rescale-display-h
4327>0	clear	x
4328>0	uleshort	0
4329>0	uleshort	1
4330>0	uleshort	2
4331>0	uleshort	4
4332>0	uleshort	8
4333>0	uleshort	16
4334>0	uleshort	32
4335>0	uleshort	64
4336>0	uleshort	128
4337>0	uleshort	256
4338>0	uleshort	512
4339>0	uleshort	1024
4340>0	uleshort	2048
4341>0	uleshort	4096
4342>0	uleshort	8192
4343>0	uleshort	16384
4344>0	uleshort	32768
4345>0	default		x
4346>>0	uleshort	x	%u)
4347
4348# Type: Godot 3 texture
4349# From: David Korth <gerbilsoft@gerbilsoft.com>
4350# References:
4351# - https://github.com/godotengine/godot/blob/3.3/core/image.h
4352# - https://github.com/godotengine/godot/blob/3.3/scene/resources/texture.cpp
4353# - https://github.com/godotengine/godot/blob/3.3/scene/resources/texture.h
4354# TODO: Don't show "rescale to" if it matches the image size.
43550	string	GDST	Godot 3 texture:
4356!:ext	stex
4357!:mime	image/x-godot-stex
4358>4	uleshort	x	%u x
4359>8	uleshort	x	%u
4360>6	uleshort	0	\b,
4361>6	uleshort	!0
4362>>6	use	godot-rescale-display-w
4363>>10	use	godot-rescale-display-h
4364>>10	uleshort	x	\b,
4365>16	ulelong&0x800000	!0		has mipmaps,
4366>16	ulelong&0x100000	0x100000	lossless encoding
4367>16	ulelong&0x200000	0x200000	lossy encoding
4368>16	ulelong&0x300000	0
4369>>16	use	godot-pixel-format-v3
4370
4371# Type: Godot 4 texture
4372# From: David Korth <gerbilsoft@gerbilsoft.com>
4373# References:
4374# - https://github.com/godotengine/godot/blob/master/core/io/image.h
4375# - https://github.com/godotengine/godot/blob/master/scene/resources/texture.cpp
4376# - https://github.com/godotengine/godot/blob/master/scene/resources/texture.h
4377# TODO: Don't show "rescale to" if it matches the image size.
43780	string	GST2	Godot 4 texture
4379!:ext	stex
4380!:mime	image/x-godot-stex
4381>4	ulelong		x	v%u:
4382>0x28	uleshort	x	%u x
4383>0x2A	uleshort	x	%u
4384>8	use	godot-rescale-display-w
4385>12	use	godot-rescale-display-h
4386>12	uleshort	x	\b,
4387>0x2C	ulelong		>1	%u mipmaps,
4388>0x30	use	godot-pixel-format-v4
4389>0x24	ulelong		1	\b, embedded PNG image
4390>0x24	ulelong		2	\b, embedded WebP image
4391>0x24	ulelong		3	\b, Basis Universal
4392
4393# Summary:	iCEDraw graphic *.IDF
4394# URL:		http://fileformats.archiveteam.org/wiki/ICEDraw
4395# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/i/idf-icedraw.trid.xml
4396# From:		Joerg Jenderek
4397# Note:		called "iCEDraw graphic" by TrID, "iCEDraw text" by FFmpeg and "iCE Draw" by Ansilove
4398#		verified by FFmpeg command `ffprobe ICE-9605.IDF` and `ansilove -s SQ-FORCE.IDF`
43990	string		\0041.4\0\0\0\0O\0	iCEDraw graphic
4400#!:mime	application/octet-stream
4401!:mime	image/x-idf
4402!:ext	idf
4403
4404# Type: ColoRIX VGA Paint Image File (.rix/.sci/.scX)
4405# From: Eddy Jansson <github.com/eloj>
4406# Reference: https://www.fileformat.info/format/rix/spec/
4407#
44080	name		rix-header
4409>0	uleshort	x	\b, %u x
4410>2	uleshort	x	%u
4411# palette type:
4412# .. if direct color, low bits encode bpp
4413>4	ubyte&128	0
4414>>4 ubyte&127		x	\b %u bpp (direct color)
4415# .. else palette
4416>4	ubyte&128	128
4417>>4	ubyte&7		0	\b x 2
4418>>4	ubyte&7		1	\b x 4
4419>>4	ubyte&7		2	\b x 8
4420>>4	ubyte&7		3	\b x 16
4421>>4	ubyte&7		4	\b x 32
4422>>4	ubyte&7		5	\b x 64
4423>>4	ubyte&7		6	\b x 128
4424>>4	ubyte&7		7	\b x 256
4425# storage type
4426#>5	ubyte&15	0	\b, Linear
4427>5	ubyte&15	1	\b, Planar (0213)
4428>5	ubyte&15	2	\b, Planar
4429>5	ubyte&15	3	\b, Text
4430>5	ubyte&15	4	\b, Planar lines
4431>5	ubyte&128	128	\b (compressed)
4432>5	ubyte&64	64	\b (extension)
4433>5	ubyte&32	32	\b (encrypted)
4434
44350	string	RIX3	ColoRIX Image
4436>4	use		rix-header
4437
44380	string	RIX7	ColoRIX Slideshow
4439
4440# http://fileformats.archiveteam.org/wiki/PaperPort_(MAX)
44410	string 	ViG	Visioneer PaperPort
4442>3	string	Ae	2
4443>3	string	Be	2
4444>3	string	Cj	3-4
4445>3	string	Em	5-7
4446>3	string	Fk	8-12
4447>3	default	x	MAX
4448
4449
4450# https://teem.sourceforge.net/nrrd/index.html
4451# From: Quasar Jarosz <quasar@uams.edu>, 2023
44520	string	NRRD000				NRRD imaging data
4453!:mime  image/x.nrrd
4454!:ext   nrrd
4455>7	string	x				\b, version %s
4456>0	search	type:
4457>>&1	string	x				\b, type: %s
4458>0	search	dimension:
4459>>&1	string	x				\b, dimensions: %s
4460>0	search	sizes:
4461>>&1	string	x				\b, sizes: %s
4462>0	search	encoding:
4463>>&1	string	x				\b, encoding: %s
4464
4465# From:		Joerg Jenderek
4466# URL:		http://justsolve.archiveteam.org/wiki/PICT
4467#		https://en.wikipedia.org/wiki/PICT
4468# Reference:	https://www.fileformat.info/format/macpict/egff.htm
4469#		http://mark0.net/download/triddefs_xml.7z/defs/p/pict-v2.trid.xml
4470# Note: 	called "Macintosh Quickdraw/PICT drawing" by shared MIME-info database from freedesktop.org,
4471#		"QuickDraw/PICT bitmap (v2)" by TrID and "Macintosh PICT Image" version 2.0 by DROID via PUID via fmt/341
4472# 		verified by command like `deark -m pict -l -d2 flag_b24.pct` as PICT v2,
4473#		partly by NetPBM `picttoppm venus.pct | file` as "Macintosh PICT",
4474#		partly by ImageMagick `identify -verbose flag_b24.pct` as (Apple Macintosh QuickDraw/PICT) and
4475#		partly by XnView `nconvert -fullinfo *.pict *.pic *.pct` as "Macintosh PICT 2"
4476# look for version operator (0011h) and version number (02FFh)
4477522 ubelong				0x001102ff
4478# few Macintosh QuickDraw with one corner at -1/-1 coordinates like PICT_129.pict PICT_2012.pict (strength=81=70+11) before Claris clip art (strength=80 ./claris)
4479!:strength +11
4480# look for Version operator (0C00h)
4481>526	ubeshort			0x0c00
4482# skip DROID fmt-341-signature-id-468.pct with invalid dimension x=0
4483>>520		ubeshort		!0
4484# skip DROID variant fmt-341-signature-id-468.pct using 0xAB instead 0x0
4485>>>0		long			!0xABABABAB		Macintosh QuickDraw PICT, version 2
4486#!:mime		application/octet-stream
4487!:mime		image/x-pict
4488!:apple		????PICT
4489!:ext		pict/pic/pct
4490# maybe also suffix pict2	https://www.xnview.com/de/image_formats/
4491#!:ext		pict2/pict/pic/pct
4492# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pict.trid.xml
4493# Note: 	called "Macintosh Quickdraw/PICT Drawing" by TrID
4494#		"real" content stored by opcode 0x8200 (CompressedQuickTime *.qtif) with none, cvid or JPEG compression
4495# look for LongText QuickTime followed by trademark character
4496>>>>554		search/691976/b		QuickTime\252		\b, QuickTime
4497# look for LongText afterwards like "and a/None|Cinepak|Photo - JPEG decompressor/are needed to see this picture"
4498>>>>>&0		search/28/bs	\040decompressor	with decompressor
4499>>>>>>&-4	string			None			None
4500# Cinepak and "Compact Video decompressor" seems to be cvid
4501>>>>>>&-7	string			Cinepak			Cinepak
4502>>>>>>&-12	string			Photo\040-\040JPEG	JPEG
4503>>>>>>&-13	string			Compact\040Video	cvid
4504# case where decompression is not like: Cinepak None "Photo - JPEG" "Compact Video decompressor"
4505>>>>>>&-6		default			x
4506>>>>>>>&0	string			x			"%0.6s"
4507# file size in bytes; not reliable sometimes 0 or little smaller than real size
4508#>>>>512	ubeshort		x			\b, size %u
4509# 8 bytes picFrame (rectangle); for most examples one corner is located at coordinates 0/0; except deark other tools fail when negative values
4510# GRR: samples with coordinates -1/-1 and Y=0x01??|0x00?? are interpreted as "Claris clip art" (strength=80 ./claris)
4511#>>>>518		ubeshort		x			Y=%#4.4x
4512>>>>520		ubeshort		x			\b, %u
4513>>>>>516	beshort			!0			\b-%d
4514>>>>518		ubeshort		x			x %u
4515>>>>>514	beshort			!0			\b-%d
4516# Note:		at the beginning all zeros or information about the particular software like: PICT
4517>>>>0		long			!0			\b, at 0
4518>>>>>0		string			x			%.4s
4519# version 2.0 files also have a 26-byte header following the version information
4520# like: 0 FFFEh (freedesktop egff~Encyclopedia of Graphics File Formats) FFFFh (egff)
4521>>>>528		ubeshort		x			\b, at 528 %#4.4x
4522# 2nd opcode like: 0x0000~NOP 0x0001~Clip 0x00a0~ShortComment 0x00a1~LongComment 0x001e~DefHilite 0x001f~OpColor
4523>>>>552		ubeshort		x			\b, at 552 second opcode %#4.4x
4524# last opcode if not opEndPic (00FFh)
4525>>>>-2		ubeshort		!0x00FF			\b, at the end %#4.4x opcode
4526# Reference:	http://web.archive.org/web/20010703041301/http://developer.apple.com/technotes/qd/qd_14.html
4527#		http://mark0.net/download/triddefs_xml.7z/defs/p/pict-v1.trid.xml
4528# Note: 	called "QuickDraw/PICT bitmap (v1)" by TrID and "Macintosh PICT Image" version 1.0 by DROID via PUID via x-fmt/80
4529# 		verified by command like `deark -m pict -l -d2 FC9.PCT` as PICT v1,
4530#		by ImageMagick `identify -verbose *.pict` as PICT (Apple Macintosh QuickDraw/PICT) and
4531#		by XnView `nconvert -fullinfo *.pict *.pct` as "Macintosh PICT"
4532# 1 byte opcode for picversion (11h); next byte version number (1)
4533522		ubeshort	0x1101
4534# skip DROID x-fmt-80-signature-id-859.pct x-fmt-80-signature-id-860.pct without next opcode usually clipRgn (1h)
4535>524		ubyte		=0x01
4536>>0		use		mac-pict1
4537#	display Macintosh PICT drawing version 1 information
45380		name		mac-pict1
4539>520		ubeshort	x		Macintosh QuickDraw PICT, version 1
4540#!:mime		application/octet-stream
4541!:mime		image/x-pict
4542!:apple		????PICT
4543!:ext		pict/pct
4544# maybe also suffix pict1 and pic
4545#!:ext		pict1/pict/pic/pct
4546# file size in bytes; not reliable sometimes 0 or smaller than real size
4547#>512		ubeshort	x		\b, size %u
4548# 8 bytes picFrame (rectangle)
4549>520		ubeshort	x		\b, %u
4550>516		ubeshort	!0		\b-%u
4551>518		ubeshort	x		x %u
4552>514		ubeshort	!0		\b-%u
4553# Note:		According to DROID at the beginning all zeros or information about the particular software like DRWG(MD|D2)
4554>0		long		!0		\b, at 0
4555>>0		string		x		%.6s
4556>>0		ubelong		x		%#8.8x
4557>>4		ubeshort	x		\b%4.4x
4558# 2nd opcode if not clipRgn (1h)
4559>524		ubyte		!0x01		\b, at 524 %#2.2x opcode
4560# last opcode if not opEndPic (FFh)
4561>-1		ubyte		!0xFF		\b, at the end %#2.2x opcode
4562
4563# https://github.com/aseprite/aseprite/blob/main/docs/ase-file-specs.md
456420		ulelong		0
4565>24		ulelong		0
4566>>4		uleshort	0xA5E0	Aseprite asset file
4567!:ext	aseprite
4568>>>0		ulelong		x	\b, size %u
4569>>>6		uleshort	x	\b, frames %u
4570>>>8		uleshort	x	\b, size %ux
4571>>>10		uleshort	x	\b%u
4572>>>12		uleshort	32	\b, RGBA
4573>>>12		uleshort	16	\b, Grayscale
4574>>>12		uleshort	8	\b, Indexed
4575>>>14		ulelong		x	\b, flags %#x
4576#>>>18		uleshort	x	\b, speed %u
4577>>>28		ubyte		x	\b, transparency index %u
4578>>>32		uleshort	x	\b, number of colors %u
4579>>>34		ubyte		>0	\b, pixel ratio %u:
4580>>>>35		ubyte		x	\b%u
4581>>>36		leshort		x	\b, grid position (%d,
4582>>>38		leshort		x	\b%d)
4583>>>40		uleshort	x	\b, grid size %dx
4584>>>42		uleshort	x	\b%d
4585