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