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