images revision 360521
1
2#------------------------------------------------------------------------------
3# $File: images,v 1.171 2019/11/23 16:19:47 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# Prevent conflicts with CRI ADX.
31>(2.S-2) belong	!0x28632943
32# skip more garbage like *.iso by looking for positive image type
33>>2	ubyte			>0
34# skip some compiled terminfo like xterm+tmux by looking for image type less equal 33
35>>>2	ubyte			<34
36# skip arches.3200 , Finder.Root , Slp.1 by looking for low pixel depth 1 8 15 16 24 32
37>>>>16	ubyte			1
38>>>>>0		use		tga-image
39>>>>16	ubyte			8
40>>>>>0		use		tga-image
41>>>>16	ubyte			15
42>>>>>0		use		tga-image
43>>>>16	ubyte			16
44>>>>>0		use		tga-image
45>>>>16	ubyte			24
46>>>>>0		use		tga-image
47>>>>16	ubyte			32
48>>>>>0		use		tga-image
49#	display tga bitmap image information
500	name				tga-image
51>2	ubyte		<34		Targa image data
52!:mime	image/x-tga
53!:apple	????TPIC
54# normal extension .tga but some Truevision products used others:
55# tpic (Apple),icb (Image Capture Board),vda (Video Display Adapter),vst (NuVista),win (UNSURE about that)
56!:ext	tga/tpic/icb/vda/vst
57# image type 1 2 3 9 10 11 32 33
58>2	ubyte&0xF7	1		- Map
59>2	ubyte&0xF7	2		- RGB
60# alpha channel
61>>17	ubyte&0x0F	>0		\bA
62>2	ubyte&0xF7	3		- Mono
63# type not found, but by http://www.fileformat.info/format/tga/corion.htm
64# Compressed color-mapped data, using Huffman, Delta, and runlength encoding
65>2	ubyte		32		- Color
66# Compressed color-mapped data, using Huffman, Delta, and RLE. 4-pass quadtree- type process
67>2	ubyte		33		- Color
68# Color Map Type 0~no 1~color map
69>1	ubyte		1		(
70# first color map entry, 0 normal
71>>3	uleshort	>0		\b%d-
72# color map length 0 2 1dh 3bh d9h 100h
73>>5	uleshort	x		\b%d)
74# 8~run length encoding bit
75>2	ubyte&0x08	8		- RLE
76# gimp can create big pictures!
77>12	uleshort	>0		%d x
78>12	uleshort	=0		65536 x
79# image height. 0 interpreted as 65536
80>14	uleshort	>0		%d
81>14	uleshort	=0		65536
82# Image Pixel depth 1 8 15 16 24 32
83>16	ubyte		x		x %d
84# X origin of image. 0 normal
85>8	uleshort	>0		+%d
86# Y origin of image. 0 normal; positive for top
87>10	uleshort	>0		+%d
88# Image descriptor: bits 3-0 give the alpha channel depth, bits 5-4 give direction
89>17	ubyte&0x0F	>0		- %d-bit alpha
90# bits 5-4 give direction. normal bottom left
91>17	ubyte		&0x20		- top
92#>17	ubyte		^0x20		- bottom
93>17	ubyte		&0x10		- right
94#>17	ubyte		^0x10		- left
95# some info say other bits 6-7 should be zero
96# but data storage interleave by http://www.fileformat.info/format/tga/corion.htm
97# 00 - no interleave;01 - even/odd interleave; 10 - four way interleave; 11 - reserved
98#>17	ubyte&0xC0	0x00		- no interleave
99>17	ubyte&0xC0	0x40		- interleave
100>17	ubyte&0xC0	0x80		- four way interleave
101>17	ubyte&0xC0	0xC0		- reserved
102# positive length implies identification field
103>0	ubyte		>0
104>>18	string		x		"%s"
105# last 18 bytes of newer tga file footer signature
106>18	search/4261301/s	TRUEVISION-XFILE.\0
107# extension area offset if not 0
108>>&-8		ulelong			>0
109# length of the extension area. normal 495 for version 2.0
110>>>(&-4.l)	uleshort		0x01EF
111# AuthorName[41]
112>>>>&0		string			>\0		- author "%-.40s"
113# Comment[324]=4 * 80 null terminated
114>>>>&41		string			>\0		- comment "%-.80s"
115# date
116>>>>&365	ubequad&0xffffFFFFffff0000	!0
117# Day
118>>>>>&-6		uleshort		x		%d
119# Month
120>>>>>&-8		uleshort		x		\b-%d
121# Year
122>>>>>&-4		uleshort		x		\b-%d
123# time
124>>>>&371	ubequad&0xffffFFFFffff0000	!0
125# hour
126>>>>>&-8		uleshort		x		%d
127# minutes
128>>>>>&-6		uleshort		x		\b:%.2d
129# second
130>>>>>&-4		uleshort		x		\b:%.2d
131# JobName[41]
132>>>>&377		string			>\0		- job "%-.40s"
133# JobHour Jobminute Jobsecond
134>>>>&418	ubequad&0xffffFFFFffff0000	!0
135>>>>>&-8		uleshort		x		%d
136>>>>>&-6		uleshort		x		\b:%.2d
137>>>>>&-4		uleshort		x		\b:%.2d
138# SoftwareId[41]
139>>>>&424		string			>\0		- %-.40s
140# SoftwareVersionNumber
141>>>>&424	ubyte				>0
142>>>>>&40		uleshort/100		x		%d
143>>>>>&40		uleshort%100		x		\b.%d
144# VersionLetter
145>>>>>&42		ubyte			>0x20		\b%c
146# KeyColor
147>>>>&468		ulelong			>0		- keycolor 0x%8.8x
148# Denominator of Pixel ratio. 0~no pixel aspect
149>>>>&474	uleshort			>0
150# Numerator
151>>>>>&-4		uleshort		>0		- aspect %d
152>>>>>&-2		uleshort		x		\b/%d
153# Denominator of Gamma ratio. 0~no Gamma value
154>>>>&478	uleshort			>0
155# Numerator
156>>>>>&-4		uleshort		>0		- gamma %d
157>>>>>&-2		uleshort		x		\b/%d
158# ColorOffset
159#>>>>&480	ulelong			x		- col offset 0x%8.8x
160# StampOffset
161#>>>>&484	ulelong			x		- stamp offset 0x%8.8x
162# ScanOffset
163#>>>>&488	ulelong			x		- scan offset 0x%8.8x
164# AttributesType
165#>>>>&492	ubyte			x		- Attributes 0x%x
166## EndOfTGA
167
168# PBMPLUS images
169# The next byte following the magic is always whitespace.
170# strength is changed to try these patterns before "x86 boot sector"
1710	name		netpbm
172>3	regex/s		=[0-9]{1,50}\ [0-9]{1,50}	Netpbm image data
173>>&0	regex		=[0-9]{1,50} 			\b, size = %s x
174>>>&0	regex		=[0-9]{1,50}			\b %s
175
1760	search/1	P1
177>0	regex/4		P1[\040\t\f\r\n]
178>>0	use		netpbm
179>>0	string		x	\b, bitmap
180!:strength + 65
181!:mime	image/x-portable-bitmap
182
1830	search/1	P2
184>0	regex/4		P2[\040\t\f\r\n]
185>>0	use		netpbm
186>>0	string		x	\b, greymap
187!:strength + 65
188!:mime	image/x-portable-greymap
189
1900	search/1	P3
191>0	regex/4		P3[\040\t\f\r\n]
192>>0	use		netpbm
193>>0	string		x	\b, pixmap
194!:strength + 65
195!:mime	image/x-portable-pixmap
196
1970	string		P4
198>0	regex/4		P4[\040\t\f\r\n]
199>>0	use		netpbm
200>>0	string		x	\b, rawbits, bitmap
201!:strength + 65
202!:mime	image/x-portable-bitmap
203
2040	string		P5
205>0	regex/4		P5[\040\t\f\r\n]
206>>0	use		netpbm
207>>0	string		x	\b, rawbits, greymap
208!:strength + 65
209!:mime	image/x-portable-greymap
210
2110	string		P6
212>0	regex/4		P6[\040\t\f\r\n]
213>>0	use		netpbm
214>>0	string		x	\b, rawbits, pixmap
215!:strength + 65
216!:mime	image/x-portable-pixmap
217
2180	string		P7		Netpbm PAM image file
219!:mime	image/x-portable-pixmap
220
221# From: bryanh@giraffe-data.com (Bryan Henderson)
2220	string		\117\072	Solitaire Image Recorder format
223>4	string		\013		MGI Type 11
224>4	string		\021		MGI Type 17
2250	string		.MDA		MicroDesign data
226>21	byte		48		version 2
227>21	byte		51		version 3
2280	string		.MDP		MicroDesign page data
229>21	byte		48		version 2
230>21	byte		51		version 3
231
232# NIFF (Navy Interchange File Format, a modification of TIFF) images
233# [GRR:  this *must* go before TIFF]
2340	string		IIN1		NIFF image data
235!:mime	image/x-niff
236
237# Canon RAW version 1 (CRW) files are a type of Canon Image File Format
238# (CIFF) file. These are apparently all little-endian.
239# From: Adam Buchbinder <adam.buchbinder@gmail.com>
240# URL: https://www.sno.phy.queensu.ca/~phil/exiftool/canon_raw.html
2410	string		II\x1a\0\0\0HEAPCCDR	Canon CIFF raw image data
242!:mime	image/x-canon-crw
243>16	leshort		x	\b, version %d.
244>14	leshort		x	\b%d
245
246# Canon RAW version 2 (CR2) files are a kind of TIFF with an extra magic
247# number. Put this above the TIFF test to make sure we detect them.
248# These are apparently all little-endian.
249# From: Adam Buchbinder <adam.buchbinder@gmail.com>
250# URL: https://libopenraw.freedesktop.org/wiki/Canon_CR2
2510	string		II\x2a\0\x10\0\0\0CR	Canon CR2 raw image data
252!:mime	image/x-canon-cr2
253!:strength +80
254>10	byte		x	\b, version %d.
255>11	byte		x	\b%d
256
257# Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
258# The second word of TIFF files is the TIFF version number, 42, which has
259# never changed.  The TIFF specification recommends testing for it.
2600	string		MM\x00\x2a	TIFF image data, big-endian
261!:strength +70
262!:mime	image/tiff
263>(4.L)	use		\^tiff_ifd
2640	string		II\x2a\x00	TIFF image data, little-endian
265!:mime	image/tiff
266!:strength +70
267>(4.l)	use		tiff_ifd
268
2690	name		tiff_ifd
270>0	leshort		x		\b, direntries=%d
271>2	use		tiff_entry
272
2730	name		tiff_entry
274# NewSubFileType
275>0	leshort		0xfe
276>>12	use		tiff_entry
277>0	leshort		0x100
278>>4	lelong		1
279>>>12	use		tiff_entry
280>>>8	leshort		x		\b, width=%d
281>0	leshort		0x101
282>>4	lelong		1
283>>>8	leshort		x		\b, height=%d
284>>>12	use		tiff_entry
285>0	leshort		0x102
286>>8	leshort		x		\b, bps=%d
287>>12	use		tiff_entry
288>0	leshort		0x103
289>>4	lelong		1		\b, compression=
290>>>8	leshort		1		\bnone
291>>>8	leshort		2		\bhuffman
292>>>8	leshort		3		\bbi-level group 3
293>>>8	leshort		4		\bbi-level group 4
294>>>8	leshort		5		\bLZW
295>>>8	leshort		6		\bJPEG (old)
296>>>8	leshort		7		\bJPEG
297>>>8	leshort		8		\bdeflate
298>>>8	leshort		9		\bJBIG, ITU-T T.85
299>>>8	leshort		0xa		\bJBIG, ITU-T T.43
300>>>8	leshort		0x7ffe		\bNeXT RLE 2-bit
301>>>8	leshort		0x8005		\bPackBits (Macintosh RLE)
302>>>8	leshort		0x8029		\bThunderscan RLE
303>>>8	leshort		0x807f		\bRasterPadding (CT or MP)
304>>>8	leshort		0x8080		\bRLE (Line Work)
305>>>8	leshort		0x8081		\bRLE (High-Res Cont-Tone)
306>>>8	leshort		0x8082		\bRLE (Binary Line Work)
307>>>8	leshort		0x80b2		\bDeflate (PKZIP)
308>>>8	leshort		0x80b3		\bKodak DCS
309>>>8	leshort		0x8765		\bJBIG
310>>>8	leshort		0x8798		\bJPEG2000
311>>>8	leshort		0x8799		\bNikon NEF Compressed
312>>>8	default		x
313>>>>8	leshort		x		\b(unknown 0x%x)
314>>>12	use		tiff_entry
315>0	leshort		0x106		\b, PhotometricIntepretation=
316>>8	clear		x
317>>8	leshort		0		\bWhiteIsZero
318>>8	leshort		1		\bBlackIsZero
319>>8	leshort		2		\bRGB
320>>8	leshort		3		\bRGB Palette
321>>8	leshort		4		\bTransparency Mask
322>>8	leshort		5		\bCMYK
323>>8	leshort		6		\bYCbCr
324>>8	leshort		8		\bCIELab
325>>8	default		x
326>>>8	leshort		x		\b(unknown=0x%x)
327>>12	use		tiff_entry
328# FillOrder
329>0	leshort		0x10a
330>>4	lelong		1
331>>>12	use		tiff_entry
332# DocumentName
333>0	leshort		0x10d
334>>(8.l)	string		x		\b, name=%s
335>>>12	use		tiff_entry
336# ImageDescription
337>0	leshort		0x10e
338>>(8.l)	string		x		\b, description=%s
339>>>12	use		tiff_entry
340# Make
341>0	leshort		0x10f
342>>(8.l)	string		x		\b, manufacturer=%s
343>>>12	use		tiff_entry
344# Model
345>0	leshort		0x110
346>>(8.l)	string		x		\b, model=%s
347>>>12	use		tiff_entry
348# StripOffsets
349>0	leshort		0x111
350>>12	use		tiff_entry
351# Orientation
352>0	leshort		0x112		\b, orientation=
353>>8	leshort		1		\bupper-left
354>>8	leshort		3		\blower-right
355>>8	leshort		6		\bupper-right
356>>8	leshort		8		\blower-left
357>>8	leshort		9		\bundefined
358>>8	default		x
359>>>8	leshort		x		\b[*%d*]
360>>12	use		tiff_entry
361# XResolution
362>0	leshort		0x11a
363>>8	lelong		x		\b, xresolution=%d
364>>12	use		tiff_entry
365# YResolution
366>0	leshort		0x11b
367>>8	lelong		x		\b, yresolution=%d
368>>12	use		tiff_entry
369# ResolutionUnit
370>0	leshort		0x128
371>>8	leshort		x		\b, resolutionunit=%d
372>>12	use		tiff_entry
373# Software
374>0	leshort		0x131
375>>(8.l)	string		x		\b, software=%s
376>>12	use		tiff_entry
377# Datetime
378>0	leshort		0x132
379>>(8.l)	string		x		\b, datetime=%s
380>>12	use		tiff_entry
381# HostComputer
382>0	leshort		0x13c
383>>(8.l)	string		x		\b, hostcomputer=%s
384>>12	use		tiff_entry
385# WhitePoint
386>0	leshort		0x13e
387>>12	use		tiff_entry
388# PrimaryChromaticities
389>0	leshort		0x13f
390>>12	use		tiff_entry
391# YCbCrCoefficients
392>0	leshort		0x211
393>>12	use		tiff_entry
394# YCbCrPositioning
395>0	leshort		0x213
396>>12	use		tiff_entry
397# ReferenceBlackWhite
398>0	leshort		0x214
399>>12	use		tiff_entry
400# Copyright
401>0	leshort		0x8298
402>>(8.l)	string		x		\b, copyright=%s
403>>12	use		tiff_entry
404# ExifOffset
405>0	leshort		0x8769
406>>12	use		tiff_entry
407# GPS IFD
408>0	leshort		0x8825		\b, GPS-Data
409>>12	use		tiff_entry
410
411#>0	leshort		x		\b, unknown=0x%x
412#>>12	use		tiff_entry
413
4140	string		MM\x00\x2b	Big TIFF image data, big-endian
415!:mime	image/tiff
4160	string		II\x2b\x00	Big TIFF image data, little-endian
417!:mime	image/tiff
418
419# PNG [Portable Network Graphics, or "PNG's Not GIF"] images
420# (Greg Roelofs, newt@uchicago.edu)
421# (Albert Cahalan, acahalan@cs.uml.edu)
422#
423# 137 P N G \r \n ^Z \n [4-byte length] I H D R [HEAD data] [HEAD crc] ...
424#
425
426# IHDR parser
4270	name		png-ihdr
428>0	belong		x		\b, %d x
429>4	belong		x		%d,
430>8	byte		x		%d-bit
431>9	byte		0		grayscale,
432>9	byte		2		\b/color RGB,
433>9	byte		3		colormap,
434>9	byte		4		gray+alpha,
435>9	byte		6		\b/color RGBA,
436#>10	byte		0		deflate/32K,
437>12	byte		0		non-interlaced
438>12	byte		1		interlaced
439
440# Standard PNG image.
4410	string		\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0DIHDR	PNG image data
442!:mime	image/png
443!:ext   png
444!:strength +10
445>16	use		png-ihdr
446
447# Apple CgBI PNG image.
4480	string		\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x04CgBI
449>24	string  	\x00\x00\x00\x0DIHDR	PNG image data (CgBI)
450!:mime	image/png
451!:ext   png
452!:strength +10
453>>32	use		png-ihdr
454
455# possible GIF replacements; none yet released!
456# (Greg Roelofs, newt@uchicago.edu)
457#
458# GRR 950115:  this was mine ("Zip GIF"):
4590	string		GIF94z		ZIF image (GIF+deflate alpha)
460!:mime	image/x-unknown
461#
462# GRR 950115:  this is Jeremy Wohl's Free Graphics Format (better):
463#
4640	string		FGF95a		FGF image (GIF+deflate beta)
465!:mime	image/x-unknown
466#
467# GRR 950115:  this is Thomas Boutell's Portable Bitmap Format proposal
468# (best; not yet implemented):
469#
4700	string		PBF		PBF image (deflate compression)
471!:mime	image/x-unknown
472
473# GIF
474# Strength set up to beat 0x55AA DOS/MBR signature word lookups (+65)
4750	string		GIF8		GIF image data
476!:strength +80
477!:mime	image/gif
478!:apple	8BIMGIFf
479>4	string		7a		\b, version 8%s,
480>4	string		9a		\b, version 8%s,
481>6	leshort		>0		%d x
482>8	leshort		>0		%d
483#>10	byte		&0x80		color mapped,
484#>10	byte&0x07	=0x00		2 colors
485#>10	byte&0x07	=0x01		4 colors
486#>10	byte&0x07	=0x02		8 colors
487#>10	byte&0x07	=0x03		16 colors
488#>10	byte&0x07	=0x04		32 colors
489#>10	byte&0x07	=0x05		64 colors
490#>10	byte&0x07	=0x06		128 colors
491#>10	byte&0x07	=0x07		256 colors
492
493# ITC (CMU WM) raster files.  It is essentially a byte-reversed Sun raster,
494# 1 plane, no encoding.
4950	string		\361\0\100\273	CMU window manager raster image data
496>4	lelong		>0		%d x
497>8	lelong		>0		%d,
498>12	lelong		>0		%d-bit
499
500# Magick Image File Format
501# URL:		https://imagemagick.org/script/miff.php
502# Reference:	http://fileformats.archiveteam.org/wiki/MIFF
503# Update:	Joerg Jenderek
504# http://www.nationalarchives.gov.uk/pronom/fmt/930
5050	search/256/bc	id=imagemagick
506# skip bad ASCII text by following new line~0x0A or space~0x20 character
507#>&0	ubyte		x		\b, next character 0x%x
508# called by TriD ImageMagick Machine independent File Format bitmap
509>&0	ubyte&0xD5	0		MIFF image data
510# https://reposcope.com/mimetype/image/miff
511#!:mime	image/miff
512!:mime	image/x-miff
513!:ext	miff/mif
514# examples with standard file(1) magic
515#>>0	string		=id=ImageMagick	with standard magic
516# examples with unusual file(1) magic like 
517>>0	string		!id=ImageMagick	starting with
518# start with comment (brace) like http://samples.fileformat.info/.../AQUARIUM.MIF
519>>>0	ubyte		=0x7b		comment
520# skip second character which is often a newline and show comment
521>>>>2	string		x		"%s"
522# does not start with comment, probably letters with other case like Id=ImageMagick
523# ImageMagick-7.0.9-2/Magick++/demo/smile_anim.miff
524>>>0	ubyte		!0x7b
525>>>>0	string		>\0		'%-.14s'
526
527# Artisan
5280	long		1123028772	Artisan image data
529>4	long		1		\b, rectangular 24-bit
530>4	long		2		\b, rectangular 8-bit with colormap
531>4	long		3		\b, rectangular 32-bit (24-bit with matte)
532
533# FIG (Facility for Interactive Generation of figures), an object-based format
5340	search/1	#FIG		FIG image text
535>5	string		x		\b, version %.3s
536
537# PHIGS
5380	string		ARF_BEGARF		PHIGS clear text archive
5390	string		@(#)SunPHIGS		SunPHIGS
540# version number follows, in the form m.n
541>40	string		SunBin			binary
542>32	string		archive			archive
543
544# GKS (Graphics Kernel System)
5450	string		GKSM		GKS Metafile
546>24	string		SunGKS		\b, SunGKS
547
548# CGM image files
5490	string		BEGMF		clear text Computer Graphics Metafile
550
551# MGR bitmaps  (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
5520	string	yz	MGR bitmap, modern format, 8-bit aligned
5530	string	zz	MGR bitmap, old format, 1-bit deep, 16-bit aligned
5540	string	xz	MGR bitmap, old format, 1-bit deep, 32-bit aligned
5550	string	yx	MGR bitmap, modern format, squeezed
556
557# Fuzzy Bitmap (FBM) images
5580	string		%bitmap\0	FBM image data
559>30	long		0x31		\b, mono
560>30	long		0x33		\b, color
561
562# facsimile data
5631	string		PC\ Research,\ Inc	group 3 fax data
564>29	byte		0		\b, normal resolution (204x98 DPI)
565>29	byte		1		\b, fine resolution (204x196 DPI)
566# From: Herbert Rosmanith <herp@wildsau.idv.uni.linz.at>
5670	string		Sfff		structured fax file
568
569# From: Joerg Jenderek <joerg.jen.der.ek@gmx.net>
570# most files with the extension .EPA and some with .BMP
5710	string		\x11\x06	Award BIOS Logo, 136 x 84
572!:mime	image/x-award-bioslogo
5730	string		\x11\x09	Award BIOS Logo, 136 x 126
574!:mime	image/x-award-bioslogo
575#0	string		\x07\x1f	BIOS Logo corrupted?
576# http://www.blackfiveservices.co.uk/awbmtools.shtml
577# http://biosgfx.narod.ru/v3/
578# http://biosgfx.narod.ru/abr-2/
5790	string		AWBM
580>4	leshort		<1981		Award BIOS bitmap
581!:mime	image/x-award-bmp
582# image width is a multiple of 4
583>>4	leshort&0x0003	0
584>>>4		leshort	x		\b, %d
585>>>6		leshort	x		x %d
586>>4	leshort&0x0003	>0		\b,
587>>>4	leshort&0x0003	=1
588>>>>4		leshort	x		%d+3
589>>>4	leshort&0x0003	=2
590>>>>4		leshort	x		%d+2
591>>>4	leshort&0x0003	=3
592>>>>4		leshort	x		%d+1
593>>>6		leshort	x		x %d
594# at offset 8 starts imagedata followed by "RGB " marker
595
596# PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
597# https://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.\
598# 28bitmap_information_header.29
599# Note:	variant starting direct with DIB header see
600#	http://fileformats.archiveteam.org/wiki/BMP
601#	verified by ImageMagick version 6.8.9-8 command `identify *.dib`
6020	leshort		40
603# skip bad samples like GAME by looking for valid number of color planes
604>12	uleshort	1		Device independent bitmap graphic
605!:mime	image/bmp
606!:apple	????BMPp
607!:ext	dib
608>>4	lelong		x		\b, %d x
609>>8	lelong		x		%d x
610>>14	leshort		x		%d
611# number of color planes (must be 1) 
612#>>12	uleshort	>1		\b, %u color planes
613# compression method: 0~no 1~RLE 8-bit/pixel 3~Huffman 1D
614#>>16	ulelong		3		\b, Huffman 1D compression
615>>16	ulelong		>0		\b, %u compression
616# image size is the size of raw bitmap; a dummy 0 can be given for BI_RGB bitmaps
617>>20	ulelong		x		\b, image size %u
618# horizontal and vertical resolution of the image (pixel per metre, signed integer) 
619>>24	lelong		>0		\b, resolution %d x
620>>>28	lelong		x		%d px/m
621# number of colors in palette, or 0 to default to 2**n
622#>>32	ulelong		>0		\b, %u colors
623# number of important colors used, or 0 when every color is important
624>>36	ulelong		>0		\b, %u important colors
6250	string		BM
626>14	leshort		12		PC bitmap, OS/2 1.x format
627!:mime	image/x-ms-bmp
628>>18	leshort		x		\b, %d x
629>>20	leshort		x		%d
630>14	leshort		64		PC bitmap, OS/2 2.x format
631!:mime	image/bmp
632!:apple	????BMPp
633!:ext	bmp
634# image width and height fields are unsigned integers for OS/2
635>>18	ulelong		x		\b, %u x
636>>22	ulelong		x		%u
637# number of bits per pixel (color depth); found 1 4 8
638>>28	uleshort	>1		x %u
639# x, y coordinates of the hotspot
640>>6	uleshort	>0		\b, hotspot %ux
641>>>8	uleshort	x		\b%u
642>>26	uleshort	>1		\b, %u color planes
643# cbSize; size of file or headers
644>>2	ulelong		x		\b, cbSize %u
645#>>2	ulelong		x		\b, cbSize 0x%x
646# offBits; offset to bitmap data like 56h 5Eh 8Eh 43Eh
647>>10	ulelong			x	\b, bits offset %u
648#>>10	ulelong			x	\b, bits offset 0x%x
649#>>(10.l) ubequad		!0	\b, bits 0x%16.16llx
650# BITMAPV2INFOHEADER	adds RGB bit masks
651>14	leshort		52		PC bitmap, Adobe Photoshop
652!:mime	image/bmp
653!:apple	????BMPp
654!:ext	bmp
655>>18	lelong		x		\b, %d x
656>>22	lelong		x		%d x
657>>28	leshort		x		%d
658# BITMAPV3INFOHEADER	adds alpha channel bit mask
659>14	leshort		56		PC bitmap, Adobe Photoshop with alpha channel mask
660!:mime	image/bmp
661!:apple	????BMPp
662!:ext	bmp
663>>18	lelong		x		\b, %d x
664>>22	lelong		x		%d x
665>>28	leshort		x		%d
666>14	leshort		40
667# jump 4 bytes before end of file/header to skip fmt-116-signature-id-118.dib
668>>(2.l-4)	ulong	x		PC bitmap, Windows 3.x format
669!:mime	image/bmp
670!:apple	????BMPp
671>>>18	lelong		x		\b, %d x
672>>>22	lelong		x		%d
673# 320 x 400		https://en.wikipedia.org/wiki/LOGO.SYS
674>>>18	ulequad		=0x0000019000000140	x
675!:ext	bmp/sys
676>>>18	ulequad		!0x0000019000000140
677# compression method 2~RLE 4-bit/pixel implies also extension rle
678>>>>30	ulelong		2		x
679!:ext	bmp/rle
680>>>>30	default		x		x
681!:ext	bmp
682# number of bits per pixel (color depth); found 1 2 4 8 16 24 32
683>>>28	leshort		x		%d
684# x, y coordinates of the hotspot; there is no hotspot in bitmaps, so values 0
685#>>>6	uleshort	>0		\b, hotspot %ux
686#>>>>8	uleshort	x		\b%u
687# number of color planes (must be 1), except badplanes.bmp for testing
688#>>>26	uleshort	>1		\b, %u color planes
689# compression method: 0~no 1~RLE 8-bit/pixel 2~RLE 4-bit/pixel 3~Huffman 1D 6~RGBA bit field masks
690#>>>30	ulelong		3		\b, Huffman 1D compression
691>>>30	ulelong		>0		\b, %u compression
692# image size is the size of raw bitmap; a dummy 0 can be given for BI_RGB bitmaps
693>>>34	ulelong		>0		\b, image size %u
694# horizontal and vertical resolution of the image (pixel per metre, signed integer) 
695>>>38	lelong		>0		\b, resolution %d x
696>>>>42	lelong		x		%d px/m
697# number of colors in palette 16 256, or 0 to default to 2**n
698#>>>46	ulelong		>0		\b, %u colors
699# number of important colors used, or 0 when every color is important
700>>>50	ulelong		>0		\b, %u important colors
701# cbSize; often size of file
702>>>2	ulelong		x		\b, cbSize %u
703#>>>2	ulelong		x		\b, cbSize 0x%x
704# offBits; offset to bitmap data like 36h 76h BEh 236h 406h 436h 4E6h
705>>>10	ulelong			x	\b, bits offset %u
706#>>>10	ulelong			x	\b, bits offset 0x%x
707#>>>(10.l) ubequad		!0	\b, bits 0x%16.16llxd
708>14	leshort		124		PC bitmap, Windows 98/2000 and newer format
709!:mime	image/x-ms-bmp
710>>18	lelong		x		\b, %d x
711>>22	lelong		x		%d x
712>>28	leshort		x		%d
713>14	leshort		108		PC bitmap, Windows 95/NT4 and newer format
714!:mime	image/x-ms-bmp
715>>18	lelong		x		\b, %d x
716>>22	lelong		x		%d x
717>>28	leshort		x		%d
718>14	leshort		128		PC bitmap, Windows NT/2000 format
719!:mime	image/x-ms-bmp
720>>18	lelong		x		\b, %d x
721>>22	lelong		x		%d x
722>>28	leshort		x		%d
723# Update:	Joerg Jenderek
724# URL:		http://fileformats.archiveteam.org/wiki/OS/2_Icon
725# Reference:	http://www.fileformat.info
726#		/format/os2bmp/spec/902d5c253f2a43ada39c2b81034f27fd/view.htm
727# Note: verified by command like `deark -l -d3 OS2MEMU.ICO`
7280	string			IC
729# skip Lotus smart icon *.smi by looking for valid hotspot coordinates
730>6	ulelong&0xFF00FF00	=0	OS/2 icon
731# jump 4 bytes before end of header/file and test for accessibility
732#>>(2.l-4) ubelong		x	End of header is OK!
733!:mime	image/x-os2-ico
734!:ext	ico
735# cbSize; size of header or file in bytes like 1ah 120h 420h
736>>2	ulelong			x	\b, cbSize %u
737# xHotspot, yHotspot; coordinates of the hotspot for icons like 16 32
738>>6	uleshort		x	\b, hotspot %ux
739>>8	uleshort		x	\b%u
740# offBits; offset in bytes to the beginning of the bit-map pel data like 20h
741>>10	ulelong			x	\b, bits offset %u
742#>>(10.l) ubequad		x	\b, bits 0x%16.16llx
743#0	string		PI		PC pointer image data
744#0	string		CI		PC color icon data
7450	string		CI
746# test also for valid dib header sizes 12 or 64
747>14	ulelong		<65		OS/2
748# test also for valid hotspot coordinates
749#>>6	ulelong&0xFE00FE00	=0	OS/2
750!:mime	image/x-os2-ico
751!:ext	ico
752>>14	ulelong		12		1.x color icon
753# image width and height fields are unsigned integers for OS/2
754>>>18	uleshort	x		%u x
755# stored height = 2 * real height
756>>>20	uleshort/2	x		%u
757# number of bits per pixel (color depth). Typical 32 24 16 8 4 but only 1 found
758>>>24	uleshort	>1		x %u
759# color planes; must be 1
760#>>>22	uleshort	>1		\b, %u color planes
761>>14	ulelong		64		2.x color icon
762# image width and height
763>>>18	ulelong		x		%u x
764# stored height = 2 * real height
765>>>22	ulelong/2	x		%u
766# number of bits per pixel (color depth). only 1 found
767>>>28	uleshort	>1		x %u
768#>>>26	uleshort	>1		\b, %u color planes
769# compression method: 0~no 3~Huffman 1D
770>>>30	ulelong		3		\b, Huffman 1D compression
771#>>>30	ulelong		>0		\b, %u compression
772# xHotspot, yHotspot; coordinates of the hotspot like 0 1 16 20 32 33 63 64
773>>6	uleshort		x	\b, hotspot %ux
774>>8	uleshort		x	\b%u
775# cbSize; size of header or maybe file in bytes like 1Ah 4Eh 84Eh
776>>2	ulelong			x	\b, cbSize %u
777#>>2	ulelong			x	\b, cbSize %x
778# offBits; offset to bitmap data (pixel array) like E4h 3Ah 66h 6Ah 33Ah 4A4h
779>>10	ulelong			x	\b, bits offset %u
780#>>10	ulelong			x	\b, bits offset 0x%x
781#>>(10.l) ubequad		!0	\b, bits 0x%16.16llx
782# dib header size: 12~Ch~OS/2 1.x 64~40h~OS/2 2.x
783#>>14	ulelong		x		\b, dib header size %u
784#0	string		CP		PC color pointer image data
785# URL:		http://fileformats.archiveteam.org/wiki/OS/2_Pointer
786# Reference:	http://www.fileformat.info/format/os2bmp/egff.htm
7870	string		CP
788# skip CPU-Z Report by checking for valid dib header sizes 12 or 64
789>14	ulelong		<65		OS/2
790# http://extension.nirsoft.net/PTR
791!:mime	image/x-ibm-pointer
792!:ext	ptr
793>>14	ulelong		12		1.x color pointer
794# image width and height fields are unsigned integers for OS/2
795>>>18	uleshort	x		%u x
796# stored height = 2 * real height
797>>>20	uleshort/2	x		%u
798# number of bits per pixel (color depth). Typical 32 24 16 8 4 but only 1 found
799>>>24	uleshort	>1		x %u
800# color planes; must be 1
801#>>>22	uleshort	>1		\b, %u color planes
802>>14	ulelong		64		2.x color pointer
803# image width and height
804>>>18	ulelong		x		%u x
805# stored height = 2 * real height
806>>>22	ulelong/2	x		%u
807# number of bits per pixel (color depth). only 1 found
808>>>28	uleshort	>1		x %u
809#>>>26	uleshort	>1		\b, %u color planes
810# compression method: 0~no 3~Huffman 1D
811>>>30	ulelong		3		\b, Huffman 1D compression
812#>>>30	ulelong		>0		\b, %u compression
813# xHotspot, yHotspot; coordinates of the hotspot like 0 3 4 8 15 16 23 27 31
814>>6	uleshort		x	\b, hotspot %ux
815>>8	uleshort		x	\b%u
816# cbSize; size of header or maybe file in bytes like 1Ah 4Eh
817>>2	ulelong			x	\b, cbSize %u
818#>>2	ulelong			x	\b, cbSize %x
819# offBits; offset to bitmap data (pixel array) like 6Ah A4h E4h 4A4h
820>>10	ulelong			x	\b, bits offset %u
821#>>10	ulelong			x	\b, bits offset 0x%x
822#>>(10.l) ubequad		!0	\b, bits 0x%16.16llx
823# dib header size: 12~Ch~OS/2 1.x 64~40h~OS/2 2.x
824#>>14	ulelong		x		\b, dib header size %u
825# Conflicts with other entries [BABYL]
826# URL:	http://fileformats.archiveteam.org/wiki/BMP#OS.2F2_Bitmap_Array
827# Note:	container for OS/2 icon "IC", color icon "CI", color pointer "CP" or bitmap "BM"
828#0	string		BA		PC bitmap array data
8290	string		BA
830# skip old Emacs RMAIL BABYL ./mail.news by checking for low header size
831>2	ulelong		<0x004c5942	OS/2 graphic array
832!:mime	image/x-os2-graphics
833#!:apple	????BMPf
834# cbSize; size of header like 28h 5Ch
835>>2	ulelong			x	\b, cbSize %u
836#>>2	ulelong			x	\b, cbSize 0x%x
837# offNext; offset to data like 0 48h F2h 4Eh 64h C6h D2h D6h DAh E6h EAh 348h
838>>6	ulelong			>0	\b, data offset %u
839#>>6	ulelong			>0	\b, data offset 0x%x
840#>>(6.l) ubequad		!0	\b, data 0x%16.16llx
841# dimensions of the intended device like 640 x 480 for VGA or 1024 x 768
842>>10	uleshort	>0		\b, display %u
843>>>12	uleshort	>0		x %u
844# usType of first array element
845#>>14	string		x		\b, usType %2.2s
846# 1 space char after "1st"
847# no *.bga examples found https://www.openwith.org/file-extensions/bga/1342
848>>14	string		BM	\b; 1st 
849!:ext	bmp/bga
850>>14	string		CI	\b; 1st 
851!:ext	ico
852>>14	string		CP	\b; 1st 
853!:ext	ico
854>>14	string		IC	\b; 1st 
855!:ext	ico
856# no white-black pointer found
857#>>14	string		PT	\b; 1st 
858#!:ext	
859>>14	indirect	x	
860
861# XPM icons (Greg Roelofs, newt@uchicago.edu)
8620	search/1	/*\ XPM\ */	X pixmap image text
863!:mime	image/x-xpmi
864
865# Utah Raster Toolkit RLE images (janl@ifi.uio.no)
8660	leshort		0xcc52		RLE image data,
867>6	leshort		x		%d x
868>8	leshort		x		%d
869>2	leshort		>0		\b, lower left corner: %d
870>4	leshort		>0		\b, lower right corner: %d
871>10	byte&0x1	=0x1		\b, clear first
872>10	byte&0x2	=0x2		\b, no background
873>10	byte&0x4	=0x4		\b, alpha channel
874>10	byte&0x8	=0x8		\b, comment
875>11	byte		>0		\b, %d color channels
876>12	byte		>0		\b, %d bits per pixel
877>13	byte		>0		\b, %d color map channels
878
879# image file format (Robert Potter, potter@cs.rochester.edu)
8800	string		Imagefile\ version-	iff image data
881# this adds the whole header (inc. version number), informative but longish
882>10	string		>\0		%s
883
884# Sun raster images, from Daniel Quinlan (quinlan@yggdrasil.com)
8850	belong		0x59a66a95	Sun raster image data
886>4	belong		>0		\b, %d x
887>8	belong		>0		%d,
888>12	belong		>0		%d-bit,
889#>16	belong		>0		%d bytes long,
890>20	belong		0		old format,
891#>20	belong		1		standard,
892>20	belong		2		compressed,
893>20	belong		3		RGB,
894>20	belong		4		TIFF,
895>20	belong		5		IFF,
896>20	belong		0xffff		reserved for testing,
897>24	belong		0		no colormap
898>24	belong		1		RGB colormap
899>24	belong		2		raw colormap
900#>28	belong		>0		colormap is %d bytes long
901
902# SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
903#
904# See
905#	http://reality.sgi.com/grafica/sgiimage.html
906#
9070	beshort		474		SGI image data
908#>2	byte		0		\b, verbatim
909>2	byte		1		\b, RLE
910#>3	byte		1		\b, normal precision
911>3	byte		2		\b, high precision
912>4	beshort		x		\b, %d-D
913>6	beshort		x		\b, %d x
914>8	beshort		x		%d
915>10	beshort		x		\b, %d channel
916>10	beshort		!1		\bs
917>80	string		>0		\b, "%s"
918
9190	string		IT01		FIT image data
920>4	belong		x		\b, %d x
921>8	belong		x		%d x
922>12	belong		x		%d
923#
9240	string		IT02		FIT image data
925>4	belong		x		\b, %d x
926>8	belong		x		%d x
927>12	belong		x		%d
928#
9292048	string		PCD_IPI		Kodak Photo CD image pack file
930>0xe02	byte&0x03	0x00		, landscape mode
931>0xe02	byte&0x03	0x01		, portrait mode
932>0xe02	byte&0x03	0x02		, landscape mode
933>0xe02	byte&0x03	0x03		, portrait mode
9340	string		PCD_OPA		Kodak Photo CD overview pack file
935
936# FITS format.  Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
937# FITS is the Flexible Image Transport System, the de facto standard for
938# data and image transfer, storage, etc., for the astronomical community.
939# (FITS floating point formats are big-endian.)
9400	string	SIMPLE\ \ =	FITS image data
941!:mime	image/fits
942!:ext	fits/fts
943>109	string	8		\b, 8-bit, character or unsigned binary integer
944>108	string	16		\b, 16-bit, two's complement binary integer
945>107	string	\ 32		\b, 32-bit, two's complement binary integer
946>107	string	-32		\b, 32-bit, floating point, single precision
947>107	string	-64		\b, 64-bit, floating point, double precision
948
949# other images
9500	string	This\ is\ a\ BitMap\ file	Lisp Machine bit-array-file
951
952# From SunOS 5.5.1 "/etc/magic" - appeared right before Sun raster image
953# stuff.
954#
9550	beshort		0x1010		PEX Binary Archive
956
957# DICOM medical imaging data
958# URL:		https://en.wikipedia.org/wiki/DICOM#Data_format
959# Note:		"dcm" is the official file name extension
960# 		XnView mention also "dc3" and "acr" as file name extension
961128	string	DICM			DICOM medical imaging data
962!:mime	application/dicom
963!:ext dcm/dicom/dic
964
965# XWD - X Window Dump file.
966#   As described in /usr/X11R6/include/X11/XWDFile.h
967#   used by the xwd program.
968#   Bradford Castalia, idaeim, 1/01
969#   updated by Adam Buchbinder, 2/09
970# The following assumes version 7 of the format; the first long is the length
971# of the header, which is at least 25 4-byte longs, and the one at offset 8
972# is a constant which is always either 1 or 2. Offset 12 is the pixmap depth,
973# which is a maximum of 32.
9740	belong	>100
975>8	belong	<3
976>>12	belong	<33
977>>>4	belong	7			XWD X Window Dump image data
978!:mime	image/x-xwindowdump
979>>>>100	string	>\0			\b, "%s"
980>>>>16	belong	x			\b, %dx
981>>>>20	belong	x			\b%dx
982>>>>12	belong	x			\b%d
983
984# PDS - Planetary Data System
985#   These files use Parameter Value Language in the header section.
986#   Unfortunately, there is no certain magic, but the following
987#   strings have been found to be most likely.
9880	string	NJPL1I00		PDS (JPL) image data
9892	string	NJPL1I			PDS (JPL) image data
9900	string	CCSD3ZF			PDS (CCSD) image data
9912	string	CCSD3Z			PDS (CCSD) image data
9920	string	PDS_			PDS image data
9930	string	LBLSIZE=		PDS (VICAR) image data
994
995# pM8x: ATARI STAD compressed bitmap format
996#
997# from Oskar Schirmer <schirmer@scara.com> Feb 2, 2001
998# p M 8 5/6 xx yy zz data...
999# Atari ST STAD bitmap is always 640x400, bytewise runlength compressed.
1000# bytes either run horizontally (pM85) or vertically (pM86). yy is the
1001# most frequent byte, xx and zz are runlength escape codes, where xx is
1002# used for runs of yy.
1003#
10040	string	pM85		Atari ST STAD bitmap image data (hor)
1005>5	byte	0x00		(white background)
1006>5	byte	0xFF		(black background)
10070	string	pM86		Atari ST STAD bitmap image data (vert)
1008>5	byte	0x00		(white background)
1009>5	byte	0xFF		(black background)
1010
1011# From: Alex Myczko <alex@aiei.ch>
1012# https://www.atarimax.com/jindroush.atari.org/afmtatr.html
10130	leshort	0x0296		Atari ATR image
1014
1015# XXX:
1016# This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
1017# magic.
1018# SGI RICE image file <mpruett@sgi.com>
1019#0	beshort	0x5249		RICE image
1020#>2	beshort	x		v%d
1021#>4	beshort	x		(%d x
1022#>6	beshort	x		%d)
1023#>8	beshort	0		8 bit
1024#>8	beshort	1		10 bit
1025#>8	beshort	2		12 bit
1026#>8	beshort	3		13 bit
1027#>10	beshort	0		4:2:2
1028#>10	beshort	1		4:2:2:4
1029#>10	beshort	2		4:4:4
1030#>10	beshort	3		4:4:4:4
1031#>12	beshort	1		RGB
1032#>12	beshort	2		CCIR601
1033#>12	beshort	3		RP175
1034#>12	beshort	4		YUV
1035
1036# PCX image files
1037# From: Dan Fandrich <dan@coneharvesters.com>
1038# updated by Joerg Jenderek at Feb 2013 by https://de.wikipedia.org/wiki/PCX
1039# https://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
1040# GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
1041# 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
10420	ubelong&0xffF8fe00	0x0a000000
1043# for PCX bit depth > 0
1044>3	ubyte		>0
1045# test for valid versions
1046>>1	ubyte		<6
1047>>>1	ubyte		!1	PCX
1048!:mime	image/x-pcx
1049#!:mime	image/pcx
1050>>>>1	ubyte		0	ver. 2.5 image data
1051>>>>1	ubyte		2	ver. 2.8 image data, with palette
1052>>>>1	ubyte		3	ver. 2.8 image data, without palette
1053>>>>1	ubyte		4	for Windows image data
1054>>>>1	ubyte		5	ver. 3.0 image data
1055>>>>4	uleshort	x	bounding box [%d,
1056>>>>6	uleshort	x	%d] -
1057>>>>8	uleshort	x	[%d,
1058>>>>10	uleshort	x	%d],
1059>>>>65	ubyte		>1	%d planes each of
1060>>>>3	ubyte		x	%d-bit
1061>>>>68	byte		1	colour,
1062>>>>68	byte		2	grayscale,
1063# this should not happen
1064>>>>68	default		x	image,
1065>>>>12	leshort		>0	%d x
1066>>>>>14	uleshort	x	%d dpi,
1067>>>>2	byte		0	uncompressed
1068>>>>2	byte		1	RLE compressed
1069
1070# Adobe Photoshop
1071# From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
10720	string		8BPS Adobe Photoshop Image
1073!:mime	image/vnd.adobe.photoshop
1074>4   beshort 2 (PSB)
1075>18  belong  x \b, %d x
1076>14  belong  x %d,
1077>24  beshort 0 bitmap
1078>24  beshort 1 grayscale
1079>>12 beshort 2 with alpha
1080>24  beshort 2 indexed
1081>24  beshort 3 RGB
1082>>12 beshort 4 \bA
1083>24  beshort 4 CMYK
1084>>12 beshort 5 \bA
1085>24  beshort 7 multichannel
1086>24  beshort 8 duotone
1087>24  beshort 9 lab
1088>12  beshort > 1
1089>>12  beshort x \b, %dx
1090>12  beshort 1 \b,
1091>22  beshort x %d-bit channel
1092>12  beshort > 1 \bs
1093
1094# XV thumbnail indicator (ThMO)
10950	string		P7\ 332		XV thumbnail image data
1096
1097# NITF is defined by United States MIL-STD-2500A
10980	string	NITF	National Imagery Transmission Format
1099>25	string	>\0	dated %.14s
1100
1101# GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
1102# Format variations from: Bernd Nuernberger <bernd.nuernberger@web.de>
1103# Update: Joerg Jenderek
1104# See http://fileformats.archiveteam.org/wiki/GEM_Raster
1105# For variations, also see:
1106#    https://www.seasip.info/Gem/ff_img.html (Ventura)
1107#    http://www.atari-wiki.com/?title=IMG_file (XIMG, STTT)
1108#    http://www.fileformat.info/format/gemraster/spec/index.htm (XIMG, STTT)
1109#    http://sylvana.net/1stguide/1STGUIDE.ENG (TIMG)
11100       beshort     0x0001
1111# header_size
1112>2      beshort     0x0008
1113>>0     use gem_info
1114>2      beshort     0x0009
1115>>0     use gem_info
1116# no example for NOSIG
1117>2      beshort     24
1118>>0     use gem_info
1119# no example for HYPERPAINT
1120>2      beshort     25
1121>>0     use gem_info
112216      string      XIMG\0
1123>0      use gem_info
1124# no example
112516      string      STTT\0\x10
1126>0      use gem_info
1127# no example or description
112816      string      TIMG\0
1129>0      use gem_info
1130
11310   name        gem_info
1132# version is 2 for some XIMG and 1 for all others
1133>0	beshort		<0x0003		GEM
1134# https://www.snowstone.org.uk/riscos/mimeman/mimemap.txt
1135!:mime	image/x-gem
1136# header_size 24 25 27 59 779 words for colored bitmaps
1137>>2	beshort		>9
1138>>>16	string		STTT\0\x10	STTT
1139>>>16	string		TIMG\0		TIMG
1140# HYPERPAINT or NOSIG variant
1141>>>16	string		\0\x80
1142>>>>2	beshort		=24		NOSIG
1143>>>>2	beshort		!24		HYPERPAINT
1144# NOSIG or XIMG variant
1145>>>16	default		x
1146>>>>16	string		!XIMG\0		NOSIG
1147>>16	string		=XIMG\0		XIMG Image data
1148!:ext	img/ximg
1149# to avoid Warning: Current entry does not yet have a description for adding a EXTENSION type
1150>>16	string		!XIMG\0		Image data
1151!:ext	img
1152# header_size is 9 for Ventura files and 8 for other GEM Paint files
1153>>2	beshort		9		(Ventura)
1154#>>2	beshort		8		(Paint)
1155>>12	beshort		x		%d x
1156>>14	beshort		x		%d,
1157# 1 4 8
1158>>4	beshort		x		%d planes,
1159# in tenths of a millimetre
1160>>8	beshort		x		%d x
1161>>10	beshort		x		%d pixelsize
1162# pattern_size 1-8. 2 for GEM Paint
1163>>6	beshort		!2		\b, pattern size %d
1164
1165# GEM Metafile (Wolfram Kleff)
11660	lelong		0x0018FFFF	GEM Metafile data
1167>4	leshort		x		version %d
1168
1169#
1170# SMJPEG. A custom Motion JPEG format used by Loki Entertainment
1171# Software Torbjorn Andersson <d91tan@Update.UU.SE>.
1172#
11730	string	\0\nSMJPEG	SMJPEG
1174>8	belong	x		%d.x data
1175# According to the specification you could find any number of _TXT
1176# headers here, but I can't think of any way of handling that. None of
1177# the SMJPEG files I tried it on used this feature. Even if such a
1178# file is encountered the output should still be reasonable.
1179>16	string	_SND		\b,
1180>>24	beshort	>0		%d Hz
1181>>26	byte	8		8-bit
1182>>26	byte	16		16-bit
1183>>28	string	NONE		uncompressed
1184# >>28	string	APCM		ADPCM compressed
1185>>27	byte	1		mono
1186>>28	byte	2		stereo
1187# Help! Isn't there any way to avoid writing this part twice?
1188>>32	string	_VID		\b,
1189# >>>48	string	JFIF		JPEG
1190>>>40	belong	>0		%d frames
1191>>>44	beshort	>0		(%d x
1192>>>46	beshort	>0		%d)
1193>16	string	_VID		\b,
1194# >>32	string	JFIF		JPEG
1195>>24	belong	>0		%d frames
1196>>28	beshort	>0		(%d x
1197>>30	beshort	>0		%d)
1198
11990	string	Paint\ Shop\ Pro\ Image\ File	Paint Shop Pro Image File
1200
1201# "thumbnail file" (icon)
1202# descended from "xv", but in use by other applications as well (Wolfram Kleff)
12030       string          P7\ 332         XV "thumbnail file" (icon) data
1204
1205# taken from fkiss: (<yav@mte.biglobe.ne.jp> ?)
12060       string          KiSS            KISS/GS
1207>4      byte            16              color
1208>>5     byte            x               %d bit
1209>>8     leshort         x               %d colors
1210>>10    leshort         x               %d groups
1211>4      byte            32              cell
1212>>5     byte            x               %d bit
1213>>8     leshort         x               %d x
1214>>10    leshort         x               %d
1215>>12    leshort         x               +%d
1216>>14    leshort         x               +%d
1217
1218# Webshots (www.webshots.com), by John Harrison
12190       string          C\253\221g\230\0\0\0 Webshots Desktop .wbz file
1220
1221# Hercules DASD image files
1222# From Jan Jaeger <jj@septa.nl>
12230       string  CKD_P370        Hercules CKD DASD image file
1224>8      long    x               \b, %d heads per cylinder
1225>12     long    x               \b, track size %d bytes
1226>16     byte    x               \b, device type 33%2.2X
1227
12280       string  CKD_C370        Hercules compressed CKD DASD image file
1229>8      long    x               \b, %d heads per cylinder
1230>12     long    x               \b, track size %d bytes
1231>16     byte    x               \b, device type 33%2.2X
1232
12330       string  CKD_S370        Hercules CKD DASD shadow file
1234>8      long    x               \b, %d heads per cylinder
1235>12     long    x               \b, track size %d bytes
1236>16     byte    x               \b, device type 33%2.2X
1237
1238# Squeak images and programs - etoffi@softhome.net
12390	string		\146\031\0\0	Squeak image data
12400	search/1	'From\040Squeak	Squeak program text
1241
1242# partimage: file(1) magic for PartImage files (experimental, incomplete)
1243# Author: Hans-Joachim Baader <hjb@pro-linux.de>
12440		string	PaRtImAgE-VoLuMe	PartImage
1245>0x0020		string	0.6.1		file version %s
1246>>0x0060	lelong	>-1		volume %d
1247#>>0x0064 8 byte identifier
1248#>>0x007c reserved
1249>>0x0200	string	>\0		type %s
1250>>0x1400	string	>\0		device %s,
1251>>0x1600	string	>\0		original filename %s,
1252# Some fields omitted
1253>>0x2744	lelong	0		not compressed
1254>>0x2744	lelong	1		gzip compressed
1255>>0x2744	lelong	2		bzip2 compressed
1256>>0x2744	lelong	>2		compressed with unknown algorithm
1257>0x0020		string	>0.6.1		file version %s
1258>0x0020		string	<0.6.1		file version %s
1259
1260# DCX is multi-page PCX, using a simple header of up to 1024
1261# offsets for the respective PCX components.
1262# From: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
12630	lelong	987654321	DCX multi-page PCX image data
1264
1265# Simon Walton <simonw@matteworld.com>
1266# Kodak Cineon format for scanned negatives
1267# http://www.kodak.com/US/en/motion/support/dlad/
12680	lelong  0xd75f2a80	Cineon image data
1269>200	belong  >0		\b, %d x
1270>204	belong  >0		%d
1271
1272
1273# Bio-Rad .PIC is an image format used by microscope control systems
1274# and related image processing software used by biologists.
1275# From: Vebjorn Ljosa <vebjorn@ljosa.com>
1276# BOOL values are two-byte integers; use them to rule out false positives.
1277# https://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
1278# Samples: https://www.loci.wisc.edu/software/sample-data
127914	leshort <2
1280>62	leshort <2
1281>>54	leshort 12345		Bio-Rad .PIC Image File
1282>>>0	leshort >0		%d x
1283>>>2	leshort >0		%d,
1284>>>4	leshort =1		1 image in file
1285>>>4	leshort >1		%d images in file
1286
1287# From Jan "Yenya" Kasprzak <kas@fi.muni.cz>
1288# The description of *.mrw format can be found at
1289# http://www.dalibor.cz/minolta/raw_file_format.htm
12900	string	\000MRM			Minolta Dimage camera raw image data
1291
1292# Summary: DjVu image / document
1293# Extension: .djvu
1294# Reference: http://djvu.org/docs/DjVu3Spec.djvu
1295# Submitted by: Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
1296# Modified by (1): Abel Cheung <abelcheung@gmail.com>
12970	string	AT&TFORM
1298>12	string	DJVM		DjVu multiple page document
1299!:mime	image/vnd.djvu
1300>12	string	DJVU		DjVu image or single page document
1301!:mime	image/vnd.djvu
1302>12	string	DJVI		DjVu shared document
1303!:mime	image/vnd.djvu
1304>12	string	THUM		DjVu page thumbnails
1305!:mime	image/vnd.djvu
1306
1307# Originally by Marc Espie
1308# Modified by Robert Minsk <robertminsk at yahoo.com>
1309# https://www.openexr.com/openexrfilelayout.pdf
13100	lelong		20000630	OpenEXR image data,
1311!:mime image/x-exr
1312>4	lelong&0x000000ff x		version %d,
1313>4	lelong		^0x00000200	storage: scanline
1314>4	lelong		&0x00000200	storage: tiled
1315>8	search/0x1000	compression\0	\b, compression:
1316>>&16	byte		0		none
1317>>&16	byte		1		rle
1318>>&16	byte		2		zips
1319>>&16	byte		3		zip
1320>>&16	byte		4		piz
1321>>&16	byte		5		pxr24
1322>>&16	byte		6		b44
1323>>&16	byte		7		b44a
1324>>&16	byte		8		dwaa
1325>>&16	byte		9		dwab
1326>>&16	byte		>9		unknown
1327>8	 search/0x1000	dataWindow\0	\b, dataWindow:
1328>>&10	lelong		x		(%d
1329>>&14	lelong		x		%d)-
1330>>&18	lelong		x		\b(%d
1331>>&22	lelong		x		%d)
1332>8	search/0x1000	displayWindow\0	\b, displayWindow:
1333>>&10	lelong		x		(%d
1334>>&14	lelong		x		%d)-
1335>>&18	lelong		x		\b(%d
1336>>&22	lelong		x		%d)
1337>8	search/0x1000	lineOrder\0	 \b, lineOrder:
1338>>&14	byte		0		increasing y
1339>>&14	byte		1		decreasing y
1340>>&14	byte		2		random y
1341>>&14	byte		>2		unknown
1342
1343# SMPTE Digital Picture Exchange Format, SMPTE DPX
1344#
1345# ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
1346# Moving-Picture Exchange (DPX), v1.0, 18 February 1994
1347# Robert Minsk <robertminsk at yahoo.com>
1348# Modified by Harry Mallon <hjmallon at gmail.com>
13490	string		SDPX	DPX image data, big-endian,
1350!:mime image/x-dpx
1351>0	use		dpx_info
13520	string		XPDS	DPX image data, little-endian,
1353!:mime image/x-dpx
1354>0	use		\^dpx_info
1355
13560	name		dpx_info
1357>768	beshort		<4
1358>>772	belong		x	%dx
1359>>776	belong		x	\b%d,
1360>768	beshort		>3
1361>>776	belong		x	%dx
1362>>772	belong		x	\b%d,
1363>768	beshort		0	left to right/top to bottom
1364>768	beshort		1	right to left/top to bottom
1365>768	beshort		2	left to right/bottom to top
1366>768	beshort		3	right to left/bottom to top
1367>768	beshort		4	top to bottom/left to right
1368>768	beshort		5	top to bottom/right to left
1369>768	beshort		6	bottom to top/left to right
1370>768	beshort		7	bottom to top/right to left
1371
1372# From: Tom Hilinski <tom.hilinski@comcast.net>
1373# https://www.unidata.ucar.edu/packages/netcdf/
13740	string	CDF\001			NetCDF Data Format data
1375
1376#-----------------------------------------------------------------------
1377# Hierarchical Data Format, used to facilitate scientific data exchange
1378# specifications at http://hdf.ncsa.uiuc.edu/
13790	belong	0x0e031301	Hierarchical Data Format (version 4) data
1380!:mime	application/x-hdf
13810	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) data
1382!:mime	application/x-hdf
1383512	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 512 bytes user block
1384!:mime	application/x-hdf
13851024	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 1k user block
1386!:mime	application/x-hdf
13872048	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 2k user block
1388!:mime	application/x-hdf
13894096	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 4k user block
1390!:mime	application/x-hdf
1391
1392
1393# From: Tobias Burnus <burnus@net-b.de>
1394# Xara (for a while: Corel Xara) is a graphic package, see
1395# http://www.xara.com/ for Windows and as GPL application for Linux
13960	string	XARA\243\243	Xara graphics file
1397
1398# https://www.cartesianinc.com/Tech/
13990	string	CPC\262		Cartesian Perceptual Compression image
1400!:mime	image/x-cpi
1401
1402# From Albert Cahalan <acahalan@gmail.com>
1403# puredigital used it for the CVS disposable camcorder
1404#8       lelong  4       ZBM bitmap image data
1405#>4      leshort x       %u x
1406#>6      leshort x       %u
1407
1408# From Albert Cahalan <acahalan@gmail.com>
1409# uncompressed 5:6:5 HighColor image for OLPC XO firmware icons
14100       string C565     OLPC firmware icon image data
1411>4      leshort x       %u x
1412>6      leshort x       %u
1413
1414# Applied Images - Image files from Cytovision
1415# Gustavo Junior Alves <gjalves@gjalves.com.br>
14160	string	\xce\xda\xde\xfa	Cytovision Metaphases file
14170	string	\xed\xad\xef\xac	Cytovision Karyotype file
14180	string	\x0b\x00\x03\x00	Cytovision FISH Probe file
14190	string	\xed\xfe\xda\xbe	Cytovision FLEX file
14200	string	\xed\xab\xed\xfe	Cytovision FLEX file
14210	string	\xad\xfd\xea\xad	Cytovision RATS file
1422
1423# Wavelet Scalar Quantization format used in gray-scale fingerprint images
1424# From Tano M Fotang <mfotang@quanteq.com>
14250	string	\xff\xa0\xff\xa8\x00	Wavelet Scalar Quantization image data
1426
1427# Type:		PCO B16 image files
1428# URL:		http://www.pco.de/fileadmin/user_upload/db/download/MA_CWDCOPIE_0412b.pdf
1429# From:		Florian Philipp <florian.philipp@binarywings.net>
1430# Extension:	.b16
1431# Description:	Pixel image format produced by PCO Camware, typically used
1432#		together with PCO cameras.
1433# Note:		Different versions exist for e.g. 8 bit and 16 bit images.
1434#		Documentation is incomplete.
14350	string/b	PCO-	PCO B16 image data
1436>12	lelong		x	\b, %dx
1437>16	lelong		x	\b%d
1438>20	lelong		0	\b, short header
1439>20	lelong		-1	\b, extended header
1440>>24	lelong		0	\b, grayscale
1441>>>36	lelong		0	linear LUT
1442>>>36	lelong		1	logarithmic LUT
1443>>>28	lelong		x	[%d
1444>>>32	lelong		x	\b,%d]
1445>>24	lelong		1	\b, color
1446>>>64	lelong		0	linear LUT
1447>>>64	lelong		1	logarithmic LUT
1448>>>40	lelong		x	r[%d
1449>>>44	lelong		x	\b,%d]
1450>>>48	lelong		x	g[%d
1451>>>52	lelong		x	\b,%d]
1452>>>56	lelong		x	b[%d
1453>>>60	lelong		x	\b,%d]
1454
1455# Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
1456# From: Markus Heidelberg <markus.heidelberg at web.de>
14570	string/t	[BitmapInfo2]	Polar Monitor Bitmap text
1458!:mime	image/x-polar-monitor-bitmap
1459
1460# From: Rick Richardson <rickrich@gmail.com>
1461# updated by: Joerg Jenderek
1462# URL: http://techmods.net/nuvi/
14630	string	GARMIN\ BITMAP\ 01	Garmin Bitmap file
1464# extension is also used for
1465# Sony SRF raw image (image/x-sony-srf)
1466# SRF map
1467# Terragen Surface Map (https://www.planetside.co.uk/terragen)
1468# FileLocator Pro search criteria file (https://www.mythicsoft.com/filelocatorpro)
1469!:ext srf
1470#!:mime	image/x-garmin-srf
1471# version 1.00,2.00,2.10,2.40,2.50
1472>0x2f	string		>0		\b, version %4.4s
1473# width (2880,2881,3240)
1474>0x55	uleshort	>0		\b, %dx
1475# height (80,90)
1476>>0x53	uleshort	x		\b%d
1477
1478# Type:	Ulead Photo Explorer5 (.pe5)
1479# URL:	http://www.jisyo.com/cgibin/view.cgi?EXT=pe5 (Japanese)
1480# From:	Simon Horman <horms@debian.org>
14810	string	IIO2H			Ulead Photo Explorer5
1482
1483# Type:	X11 cursor
1484# URL:	http://webcvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?view=markup
1485# From:	Mathias Brodala <info@noctus.net>
14860	string	Xcur			X11 cursor
1487
1488# Type:	Olympus ORF raw images.
1489# URL:	https://libopenraw.freedesktop.org/wiki/Olympus_ORF
1490# From:	Adam Buchbinder <adam.buchbinder@gmail.com>
14910	string		MMOR		Olympus ORF raw image data, big-endian
1492!:mime	image/x-olympus-orf
14930	string		IIRO		Olympus ORF raw image data, little-endian
1494!:mime	image/x-olympus-orf
14950	string		IIRS		Olympus ORF raw image data, little-endian
1496!:mime	image/x-olympus-orf
1497
1498# Type: files used in modern AVCHD camcoders to store clip information
1499# Extension: .cpi
1500# From: Alexander Danilov <alexander.a.danilov@gmail.com>
15010	string	HDMV0100	AVCHD Clip Information
1502
1503# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1504# URL: http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
1505# Radiance HDR; usually has .pic or .hdr extension.
15060	string	#?RADIANCE\n	Radiance HDR image data
1507#!mime	image/vnd.radiance
1508
1509# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1510# URL: https://www.mpi-inf.mpg.de/resources/pfstools/pfs_format_spec.pdf
1511# Used by the pfstools packages. The regex matches for the image size could
1512# probably use some work. The MIME type is made up; if there's one in
1513# actual common use, it should replace the one below.
15140	string	PFS1\x0a	PFS HDR image data
1515#!mime	image/x-pfs
1516>1	regex	[0-9]*\ 		\b, %s
1517>>1	regex	\ [0-9]{4}		\bx%s
1518
1519# Type: Foveon X3F
1520# URL:  https://www.photofo.com/downloads/x3f-raw-format.pdf
1521# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1522# Note that the MIME type isn't defined anywhere that I can find; if
1523# there's a canonical type for this format, it should replace this one.
15240	string	FOVb	Foveon X3F raw image data
1525!:mime	image/x-x3f
1526>6	leshort	x	\b, version %d.
1527>4	leshort	x	\b%d
1528>28	lelong	x	\b, %dx
1529>32	lelong	x	\b%d
1530
1531# Paint.NET file
1532# From Adam Buchbinder <adam.buchbinder@gmail.com>
15330	string	PDN3	Paint.NET image data
1534!:mime	image/x-paintnet
1535
1536# Not really an image.
1537# From: "Tano M. Fotang" <mfotang@quanteq.com>
15380	string	\x46\x4d\x52\x00	ISO/IEC 19794-2 Format Minutiae Record (FMR)
1539
1540# doc: https://www.shikino.co.jp/eng/products/images/FLOWER.jpg.zip
1541# example: https://www.shikino.co.jp/eng/products/images/FLOWER.wdp.zip
154290	bequad		0x574D50484F544F00	JPEG-XR Image
1543>98	byte&0x08	=0x08			\b, hard tiling
1544>99	byte&0x80	=0x80			\b, tiling present
1545>99	byte&0x40	=0x40			\b, codestream present
1546>99	byte&0x38	x			\b, spatial xform=
1547>99	byte&0x38	0x00			\bTL
1548>99	byte&0x38	0x08			\bBL
1549>99	byte&0x38	0x10			\bTR
1550>99	byte&0x38	0x18			\bBR
1551>99	byte&0x38	0x20			\bBT
1552>99	byte&0x38	0x28			\bRB
1553>99	byte&0x38	0x30			\bLT
1554>99	byte&0x38	0x38			\bLB
1555>100	byte&0x80	=0x80			\b, short header
1556>>102	beshort+1	x			\b, %d
1557>>104	beshort+1	x			\bx%d
1558>100	byte&0x80	=0x00			\b, long header
1559>>102	belong+1	x			\b, %x
1560>>106	belong+1	x			\bx%x
1561>101	beshort&0xf	x			\b, bitdepth=
1562>>101	beshort&0xf	0x0			\b1-WHITE=1
1563>>101	beshort&0xf	0x1			\b8
1564>>101	beshort&0xf	0x2			\b16
1565>>101	beshort&0xf	0x3			\b16-SIGNED
1566>>101	beshort&0xf	0x4			\b16-FLOAT
1567>>101	beshort&0xf	0x5			\b(reserved 5)
1568>>101	beshort&0xf	0x6			\b32-SIGNED
1569>>101	beshort&0xf	0x7			\b32-FLOAT
1570>>101	beshort&0xf	0x8			\b5
1571>>101	beshort&0xf	0x9			\b10
1572>>101	beshort&0xf	0xa			\b5-6-5
1573>>101	beshort&0xf	0xb			\b(reserved %d)
1574>>101	beshort&0xf	0xc			\b(reserved %d)
1575>>101	beshort&0xf	0xd			\b(reserved %d)
1576>>101	beshort&0xf	0xe			\b(reserved %d)
1577>>101	beshort&0xf	0xf			\b1-BLACK=1
1578>101	beshort&0xf0	x			\b, colorfmt=
1579>>101	beshort&0xf0	0x00			\bYONLY
1580>>101	beshort&0xf0	0x10			\bYUV240
1581>>101	beshort&0xf0	0x20			\bYWV422
1582>>101	beshort&0xf0	0x30			\bYWV444
1583>>101	beshort&0xf0	0x40			\bCMYK
1584>>101	beshort&0xf0	0x50			\bCMYKDIRECT
1585>>101	beshort&0xf0	0x60			\bNCOMPONENT
1586>>101	beshort&0xf0	0x70			\bRGB
1587>>101	beshort&0xf0	0x80			\bRGBE
1588>>101	beshort&0xf0	>0x80			\b(reserved 0x%x)
1589
1590# From: Johan van der Knijff <johan.vanderknijff@kb.nl>
1591#
1592# BPG (Better Portable Graphics) format
1593# https://bellard.org/bpg/
1594# http://fileformats.archiveteam.org/wiki/BPG
1595#
15960	string	\x42\x50\x47\xFB	BPG (Better Portable Graphics)
1597!:mime  image/bpg
1598
1599# From: Joerg Jenderek
1600# URL: https://en.wikipedia.org/wiki/Apple_Icon_Image_format
16010	string		icns		Mac OS X icon
1602!:mime	image/x-icns
1603!:apple	????icns
1604!:ext icns
1605>4	ubelong		>0
1606# file size
1607>>4	ubelong		x		\b, %d bytes
1608# icon type
1609>>8	string		x		\b, "%4.4s" type
1610
1611# TIM images
16120		lelong		0x00000010	TIM image,
1613>4		lelong  	0x8		4-Bit,
1614>4		lelong  	0x9		8-Bit,
1615>4		lelong  	0x2		15-Bit,
1616>4		lelong  	0x3		24-Bit,
1617>4		lelong 		&8
1618>>(8.l+12)	leshort		x		Pixel at (%d,
1619>>(8.l+14)	leshort		x		\b%d)
1620>>(8.l+16)	leshort		x		Size=%dx
1621>>(8.l+18)	leshort		x		\b%d,
1622>>4		lelong 		0x8		16 CLUT Entries at
1623>>4		lelong 		0x9		256 CLUT Entries at
1624>>12		leshort		x		(%d,
1625>>14		leshort		x		\b%d)
1626>4		lelong		^8
1627>>12		leshort		x		Pixel at (%d,
1628>>14		leshort		x		\b%d)
1629>>16		leshort		x		Size=%dx
1630>>18		leshort		x		\b%d
1631
1632# MDEC streams
16330		lelong		0x80010160	MDEC video stream,
1634>16		leshort		x		%dx
1635>18		leshort		x		\b%d
1636#>8		lelong		x		%d frames
1637#>4		leshort		x		secCount=%d;
1638#>6		leshort		x		nSectors=%d;
1639#>12		lelong		x		frameSize=%d;
1640
1641# BS encoded bitstreams
16422		leshort		0x3800		BS image,
1643>6		leshort		x		Version %d,
1644>4		leshort		x		Quantization %d,
1645>0		leshort		x		(Decompresses to %d words)
1646
1647# Type: farbfeld image.
1648# Url: http://tools.suckless.org/farbfeld/
1649# From: Ian D. Scott <ian@iandouglasscott.com>
1650#
16510		string		farbfeld	farbfeld image data,
1652>8		ubelong		x		%dx
1653>12		ubelong		x		\b%d
1654
1655# Type: Microsoft DirectDraw Surface (common data)
1656# URL:	https://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
1657# From: Morten Hustveit <morten@debian.org>
1658# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
16590	name	ms-directdraw-surface
1660>0x10	ulelong	x			%u x
1661>0x0C	ulelong	x			%u
1662# Color depth.
1663>0x58	ulelong	>0			\b, %u-bit color
1664# Determine the pixel format.
1665>0x50	ulelong&0x4	4
1666# FIXME: Handle DX10 and XBOX formats.
1667>>0x54	string	x			\b, compressed using %.4s
1668>0x50	ulelong&0x2	0x2		\b, alpha only
1669>0x50	ulelong&0x200	0x200		\b, YUV
1670>0x50	ulelong&0x20000	0x20000		\b, luminance
1671# RGB pixel format
1672>0x50	ulelong&0x40	0x40
1673
1674# Determine the RGB format using the color masks.
1675# ulequad order: 0xGGGGGGGGRRRRRRRR, 0xAAAAAAAABBBBBBBB
1676
1677>>0x58		ulelong	16
1678
1679# NOTE: 15-bit color formats usually have 16-bit listed as the color depth.
1680>>>0x5C		ulequad	0x000003E000007C00
1681>>>>0x64	ulequad 0x000000000000001F	\b, RGB555
1682>>>0x5C		ulequad	0x000003E000001F00
1683>>>>0x64	ulequad 0x000000000000007C	\b, BGR555
1684
1685>>>0x5C		ulequad	0x000007E00000F800
1686>>>>0x64	ulequad 0x000000000000001F	\b, RGB565
1687>>>0x5C		ulequad	0x000007E000001F00
1688>>>>0x64	ulequad 0x00000000000000F8	\b, BGR565
1689
1690>>>0x5C		ulequad	0x000000F000000F00
1691>>>>0x64	ulequad 0x0000F0000000000F	\b, ARGB4444
1692>>>0x5C		ulequad	0x000000F00000000F
1693>>>>0x64	ulequad 0x0000F00000000F00	\b, ABGR4444
1694
1695>>>0x5C		ulequad	0x00000F000000F000
1696>>>>0x64	ulequad 0x0000000F000000F0	\b, RGBA4444
1697>>>0x5C		ulequad	0x00000F00000000F0
1698>>>>0x64	ulequad 0x0000000F0000F000	\b, BGRA4444
1699
1700>>>0x5C		ulequad	0x000000F000000F00
1701>>>>0x64	ulequad 0x000000000000000F	\b, xRGB4444
1702>>>0x5C		ulequad	0x000000F00000000F
1703>>>>0x64	ulequad 0x0000000000000F00	\b, xBGR4444
1704
1705>>>0x5C		ulequad	0x00000F000000F000
1706>>>>0x64	ulequad 0x00000000000000F0	\b, RGBx4444
1707>>>0x5C		ulequad	0x00000F00000000F0
1708>>>>0x64	ulequad 0x000000000000F000	\b, BGRx4444
1709
1710>>>0x5C		ulequad	0x000003E000007C00
1711>>>>0x64	ulequad 0x000080000000001F	\b, ARGB1555
1712>>>0x5C		ulequad	0x000003E000001F00
1713>>>>0x64	ulequad 0x000080000000007C	\b, ABGR1555
1714>>>0x5C		ulequad	0x000007C00000F800
1715>>>>0x64	ulequad 0x000000010000003E	\b, RGBA5551
1716>>>0x5C		ulequad	0x000007C00000003E
1717>>>>0x64	ulequad 0x000000010000F800	\b, BGRA5551
1718
1719>>88		ulelong 24
1720>>>0x5C		ulequad	0x0000FF0000FF0000
1721>>>>0x64	ulequad 0x00000000000000FF	\b, RGB888
1722>>>0x5C		ulequad	0x0000FF00000000FF
1723>>>>0x64	ulequad 0x0000000000FF0000	\b, BGR888
1724
1725>>88		ulelong 32
1726>>>0x5C		ulequad	0x0000FF0000FF0000
1727>>>>0x64	ulequad 0xFF000000000000FF	\b, ARGB8888
1728>>>0x5C		ulequad	0x0000FF00000000FF
1729>>>>0x64	ulequad 0xFF00000000FF0000	\b, ABGR8888
1730
1731>>>0x5C		ulequad	0x00FF0000FF000000
1732>>>>0x64	ulequad 0x000000FF0000FF00	\b, RGBA8888
1733>>>0x5C		ulequad	0x00FF00000000FF00
1734>>>>0x64	ulequad 0x000000FFFF000000	\b, BGBA8888
1735
1736>>>0x5C		ulequad	0x0000FF0000FF0000
1737>>>>0x64	ulequad 0x00000000000000FF	\b, xRGB8888
1738>>>0x5C		ulequad	0x0000FF00000000FF
1739>>>>0x64	ulequad 0x0000000000FF0000	\b, xBGR8888
1740
1741>>>0x5C		ulequad	0x00FF0000FF000000
1742>>>>0x64	ulequad 0x000000000000FF00	\b, RGBx8888
1743>>>0x5C		ulequad	0x00FF00000000FF00
1744>>>>0x64	ulequad 0x00000000FF000000	\b, BGBx8888
1745
1746# Less common 32-bit color formats.
1747>>>0x5C		ulequad	0xFFFF00000000FFFF
1748>>>>0x64	ulequad 0x0000000000000000	\b, G16R16
1749>>>0x5C		ulequad	0x0000FFFFFFFF0000
1750>>>>0x64	ulequad 0x0000000000000000	\b, R16G16
1751
1752>>>0x5C		ulequad	0x000FFC003FF00000
1753>>>>0x64	ulequad 0xC0000000000003FF	\b, A2R10G10B10
1754>>>0x5C		ulequad	0x000FFC00000003FF
1755>>>>0x64	ulequad 0xC00000003FF00000	\b, A2B10G10R10
1756
1757# Type: Microsoft DirectDraw Surface
1758# URL:	https://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
1759# From: Morten Hustveit <morten@debian.org>
1760# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
17610	string/b	DDS\040\174\000\000\000 Microsoft DirectDraw Surface (DDS):
1762>0	use	ms-directdraw-surface
1763
1764# Type: Sega PVR image.
1765# From: David Korth <gerbilsoft@gerbilsoft.com>
1766# References:
1767# - https://fabiensanglard.net/Mykaruga/tools/segaPVRFormat.txt
1768# - https://github.com/yazgoo/pvrx2png
1769# - https://github.com/nickworonekin/puyotools
1770
1771# Sega PVR header.
17720	name	sega-pvr-image-header
1773>0x0C	leshort	x	%u x
1774>0x0E	leshort	x	%u
1775# Image format.
1776>0x08	byte	0	\b, ARGB1555
1777>0x08	byte	1	\b, RGB565
1778>0x08	byte	2	\b, ARGB4444
1779>0x08	byte	3	\b, YUV442
1780>0x08	byte	4	\b, Bump
1781>0x08	byte	5	\b, 4bpp
1782>0x08	byte	6	\b, 8bpp
1783# Image data type.
1784>0x09	byte	0x01	\b, square twiddled
1785>0x09	byte	0x02	\b, square twiddled & mipmap
1786>0x09	byte	0x03	\b, VQ
1787>0x09	byte	0x04	\b, VQ & mipmap
1788>0x09	byte	0x05	\b, 8-bit CLUT twiddled
1789>0x09	byte	0x06	\b, 4-bit CLUT twiddled
1790>0x09	byte	0x07	\b, 8-bit direct twiddled
1791>0x09	byte	0x08	\b, 4-bit direct twiddled
1792>0x09	byte	0x09	\b, rectangle
1793>0x09	byte	0x0B	\b, rectangular stride
1794>0x09	byte	0x0D	\b, rectangular twiddled
1795>0x09	byte	0x10	\b, small VQ
1796>0x09	byte	0x11	\b, small VQ & mipmap
1797>0x09	byte	0x12	\b, square twiddled & mipmap
1798
1799# Sega PVR image.
18000	string	PVRT
1801>0x10	string	DDS\040\174\000\000\000 Sega PVR (Xbox) image:
1802>>0x20	use	ms-directdraw-surface
1803>0x10	belong	!0x44445320		Sega PVR image:
1804>>0	use	sega-pvr-image-header
1805
1806# Sega PVR image with GBIX.
18070	string	GBIX
1808>0x10	string	PVRT
1809>>0x10	string	DDS\040\174\000\000\000 Sega PVR (Xbox) image:
1810>>>0x20	use	ms-directdraw-surface
1811>>0x10	belong	!0x44445320		Sega PVR image:
1812>>>0x10	use	sega-pvr-image-header
1813>>0x08	lelong	x	\b, global index = %u
1814
1815# Sega GVR header.
18160	name	sega-gvr-image-header
1817>0x0C	beshort	x	%u x
1818>0x0E	beshort	x	%u
1819# Image data format.
1820>0x0B	byte	0	\b, I4
1821>0x0B	byte	1	\b, I8
1822>0x0B	byte	2	\b, IA4
1823>0x0B	byte	3	\b, IA8
1824>0x0B	byte	4	\b, RGB565
1825>0x0B	byte	5	\b, RGB5A3
1826>0x0B	byte	6	\b, ARGB8888
1827>0x0B	byte	8	\b, CI4
1828>0x0B	byte	9	\b, CI8
1829>0x0B	byte	14	\b, DXT1
1830
1831# Sega GVR image.
18320	string	GVRT	Sega GVR image:
1833>0x10	use	sega-gvr-image-header
1834
1835# Sega GVR image with GBIX.
18360	string	GBIX
1837>0x10	string	GVRT	Sega GVR image:
1838>>0x10	use	sega-gvr-image-header
1839>>0x08	belong	x	\b, global index = %u
1840
1841# Sega GVR image with GCIX. (Wii)
18420	string	GCIX
1843>0x10	string	GVRT	Sega GVR image:
1844>>0x10	use	sega-gvr-image-header
1845>>0x08	belong	x	\b, global index = %u
1846
1847# Light Field Picture
1848# Documentation: http://optics.miloush.net/lytro/TheFileFormat.aspx
1849# Typical file extensions: .lfp .lfr .lfx
1850
18510	belong	0x894C4650
1852>4	belong	0x0D0A1A0A
1853>12	belong	0x00000000	Lytro Light Field Picture
1854>8	belong	x		\b, version %d
1855
1856# Type: Vision Research Phantom CINE Format
1857# URL: https://www.phantomhighspeed.com/
1858# URL2: http://phantomhighspeed.force.com/vriknowledge/servlet/fileField?id=0BEU0000000Cfyk
1859# From: Harry Mallon <hjmallon at gmail.com>
1860#
1861# This has a short "CI" code but the 44 is the size of the struct which is
1862# stable
18630	string	CI
1864>2	leshort 44		Vision Research CINE Video,
1865>>4	leshort	0		Grayscale,
1866>>4	leshort 1		JPEG Compressed,
1867>>4	leshort 2		RAW,
1868>>6	leshort x		version %d,
1869>>20	lelong	x		%d frames,
1870>>48	lelong	x		%dx
1871>>52	lelong	x		\b%d
1872
1873# Type: ARRI Raw Image
1874# Info: SMPTE RDD30:2014
1875# From: Harry Mallon <hjmallon at gmail.com>
18760	string ARRI		ARRI ARI image data,
1877>4	lelong 0x78563412	little-endian,
1878>4 	lelong 0x12345678	big-endian,
1879>12	lelong x		version %d,
1880>20	lelong x 		%dx
1881>24	lelong x		\b%d
1882
1883# Type: Khronos KTX texture.
1884# From: David Korth <gerbilsoft@gerbilsoft.com>
1885# References:
1886# - https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
1887
1888# glEnum decoding.
1889# NOTE: Only the most common formats are listed here.
18900	name	khronos-ktx-glEnum
1891>0	lelong	0x1907	\b, RGB
1892>0	lelong	0x1908	\b, RGBA
1893>0	lelong	0x1909	\b, LUMINANCE
1894>0	lelong	0x190A	\b, LUMINANCE_ALPHA
1895>0	lelong	0x80E1	\b, BGR
1896>0	lelong	0x80E2	\b, BGRA
1897>0	lelong	0x83A0	\b, RGB_S3TC
1898>0	lelong	0x83A1	\b, RGB4_S3TC
1899>0	lelong	0x83A2	\b, RGBA_S3TC
1900>0	lelong	0x83A3	\b, RGBA4_S3TC
1901>0	lelong	0x83A4	\b, RGBA_DXT5_S3TC
1902>0	lelong	0x83A5	\b, RGBA4_DXT5_S3TC
1903>0	lelong	0x8D64	\b, ETC1_RGB8_OES
1904>0	lelong	0x9270	\b, COMPRESSED_R11_EAC
1905>0	lelong	0x9271	\b, COMPRESSED_SIGNED_R11_EAC
1906>0	lelong	0x9272	\b, COMPRESSED_RG11_EAC
1907>0	lelong	0x9273	\b, COMPRESSED_SIGNED_RG11_EAC
1908>0	lelong	0x9274	\b, COMPRESSED_RGB8_ETC2
1909>0	lelong	0x9275	\b, COMPRESSED_SRGB8_ETC2
1910>0	lelong	0x9276	\b, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
1911>0	lelong	0x9277	\b, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
1912>0	lelong	0x9278	\b, COMPRESSED_RGBA2_ETC2_EAC
1913>0	lelong	0x9279	\b, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
1914>0	lelong	0x93B0	\b, COMPRESSED_RGBA_ASTC_4x4_KHR
1915>0	lelong	0x93B1	\b, COMPRESSED_RGBA_ASTC_5x4_KHR
1916>0	lelong	0x93B2	\b, COMPRESSED_RGBA_ASTC_5x5_KHR
1917>0	lelong	0x93B3	\b, COMPRESSED_RGBA_ASTC_6x5_KHR
1918>0	lelong	0x93B4	\b, COMPRESSED_RGBA_ASTC_6x6_KHR
1919>0	lelong	0x93B5	\b, COMPRESSED_RGBA_ASTC_8x5_KHR
1920>0	lelong	0x93B6	\b, COMPRESSED_RGBA_ASTC_8x6_KHR
1921>0	lelong	0x93B7	\b, COMPRESSED_RGBA_ASTC_8x8_KHR
1922>0	lelong	0x93B8	\b, COMPRESSED_RGBA_ASTC_10x5_KHR
1923>0	lelong	0x93B9	\b, COMPRESSED_RGBA_ASTC_10x6_KHR
1924>0	lelong	0x93BA	\b, COMPRESSED_RGBA_ASTC_10x8_KHR
1925>0	lelong	0x93BB	\b, COMPRESSED_RGBA_ASTC_10x10_KHR
1926>0	lelong	0x93BC	\b, COMPRESSED_RGBA_ASTC_12x10_KHR
1927>0	lelong	0x93BD	\b, COMPRESSED_RGBA_ASTC_12x12_KHR
1928>0	lelong	0x93D0	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
1929>0	lelong	0x93D1	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
1930>0	lelong	0x93D2	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
1931>0	lelong	0x93D3	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
1932>0	lelong	0x93D4	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
1933>0	lelong	0x93D5	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
1934>0	lelong	0x93D6	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
1935>0	lelong	0x93D7	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
1936>0	lelong	0x93D8	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
1937>0	lelong	0x93D9	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
1938>0	lelong	0x93DA	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
1939>0	lelong	0x93DB	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
1940>0	lelong	0x93DC	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
1941>0	lelong	0x93DD	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
1942
1943# Endian-specific KTX header.
1944# TODO: glType (all textures I've seen so far are GL_UNSIGNED_BYTE)
19450	name	khronos-ktx-endian-header
1946>20	lelong	x	\b, %u
1947>24	lelong	>1	x %u
1948>28	lelong	>1	x %u
1949>8	lelong	>0
1950>>8	use	khronos-ktx-glEnum
1951>8	lelong	0
1952>>12	use	khronos-ktx-glEnum
1953
1954# Main KTX header.
1955# Determine endianness, then check the rest of the header.
19560	string	\xABKTX\ 11\xBB\r\n\x1A\n	Khronos KTX texture
1957>12	lelong	0x04030201			(little-endian)
1958>>16	use	khronos-ktx-endian-header
1959>12	belong	0x04030201			(big-endian)
1960>>16	use	\^khronos-ktx-endian-header
1961
1962# Type: Valve VTF texture.
1963# From: David Korth <gerbilsoft@gerbilsoft.com>
1964# References:
1965# - https://developer.valvesoftware.com/wiki/Valve_Texture_Format
1966
1967# VTF image formats.
19680	name	vtf-image-format
1969>0	lelong	0	RGBA8888
1970>0	lelong	1	ABGR8888
1971>0	lelong	2	RGB888
1972>0	lelong	3	BGR888
1973>0	lelong	4	RGB565
1974>0	lelong	5	I8
1975>0	lelong	6	IA88
1976>0	lelong	7	P8
1977>0	lelong	8	A8
1978>0	lelong	9	RGB888 (bluescreen)
1979>0	lelong	10	BGR888 (bluescreen)
1980>0	lelong	11	ARGB8888
1981>0	lelong	12	BGRA8888
1982>0	lelong	13	DXT1
1983>0	lelong	14	DXT3
1984>0	lelong	15	DXT5
1985>0	lelong	16	BGRx8888
1986>0	lelong	17	BGR565
1987>0	lelong	18	BGRx5551
1988>0	lelong	19	BGRA4444
1989>0	lelong	20	DXT1+A1
1990>0	lelong	21	BGRA5551
1991>0	lelong	22	UV88
1992>0	lelong	23	UVWQ8888
1993>0	lelong	24	RGBA16161616F
1994>0	lelong	25	RGBA16161616
1995>0	lelong	26	UVLX8888
1996
1997# Main VTF header.
19980	string	VTF\0				Valve Texture Format
1999>4	lelong	x				v%u
2000>8	lelong	x				\b.%u
2001>0x10	leshort	x				\b, %u
2002>0x12	leshort	>1				x %u
2003>4	lequad	0x0000000700000002
2004>>0x3F	leshort	>1				x %u
2005>0x18	leshort	>1				\b, %u frames
2006>0x38	byte	x				\b, mipmaps: %u
2007>0x34	lelong	>-1				\b,
2008>>0x34	use	vtf-image-format
2009
2010# Type: Valve VTF3 (PS3) texture.
2011# From: David Korth <gerbilsoft@gerbilsoft.com>
20120	string		VTF3	Valve Texture Format (PS3)
2013>0x14	beshort		x	\b, %u
2014>0x16	beshort		x	\b x %u
2015>0x10	belong&0x2000	0	\b, DXT1
2016>0x10	belong&0x2000	0x2000	\b, DXT5
2017
2018# Type: ASTC texture.
2019# From: David Korth <gerbilsoft@gerbilsoft.com>
2020# References:
2021# - https://stackoverflow.com/questions/22600678/determine-internal-format-of-given-astc-compressed-image-through-its-header
2022# - https://stackoverflow.com/a/22682244
20230	lelong	0x5ca1ab13			ASTC
2024>4	byte	x				%u
2025>5	byte	x				\bx%u
2026>6	byte	>1				\bx%u
2027# X, Y, and Z dimensions are stored as 24-bit LE.
2028# Pretend it's 32-bit and mask off the high byte.
2029>7	lelong&0x00FFFFFF	x		texture, %u
2030>10	lelong&0x00FFFFFF	x		x %u
2031>13	lelong&0x00FFFFFF	>1		x %u
2032
2033# Zebra Metafile graphic
2034# http://www.fileformat.info/format/zbr/egff.htm
20350	beshort	0x9a02	Zebra Metafile graphic
2036>2	leshort 1	(version 1.x)
2037>2	leshort	2	(version 1.1x or 1.2x)
2038>2	leshort	3	(version 1.49)
2039>2	leshort	4	(version 1.50)
2040>4	string	x	(comment = %s)
2041
2042# Microsoft Paint graphic
2043# http://www.fileformat.info/format/mspaint/egff.htm
20440	string	DanM 	icrosoft Paint image data (version 1.x)
2045>4	leshort	x	(%d
2046>>6	leshort	x	x %d)
20470	string	LinS 	Microsoft Paint image data (version 2.0)
2048>4	leshort	x	(%d
2049>>6	leshort	x	x %d)
2050
2051# reMarkable tablet internal file format (https://www.remarkable.com/)
2052# https://github.com/ax3l/lines-are-beautiful
2053# https://plasma.ninja/blog/devices/remarkable/binary/format/2017/12/26/\
2054#	reMarkable-lines-file-format.html#what-to-do-next
2055# from Axel Huebl
20560		string	reMarkable
2057>11		string	lines
2058>>17		string	with
2059>>>22		string	selections
2060>>>>33		string	and
2061>>>>>37		string	layers
2062>>>>>>43	lelong	x	reMarkable tablet notebook lines, 1404 x 1872, %x page(s)
2063
2064# newer per-page files for the reMarkable
20650		string	reMarkable
2066>11		string	.lines
2067>>18		string	file,
2068>>>24		string	version=
2069>>>>32		byte	x	reMarkable tablet page (v%c), 1404 x 1872,
2070>>>>>43		lelong	x	%d layer(s)
2071
2072# Type: PVR3 texture.
2073# From: David Korth <gerbilsoft@gerbilsoft.com>
2074# References:
2075# - http://cdn.imgtec.com/sdk-documentation/PVR+File+Format.Specification.pdf
2076
2077# PVR3 pixel formats.
20780	name		pvr3-pixel-format
2079>4	ulelong	0
2080>>0	ulelong	0	PVRTC 2bpp RGB
2081>>0	ulelong	1	PVRTC 2bpp RGBA
2082>>0	ulelong	2	PVRTC 4bpp RGB
2083>>0	ulelong	3	PVRTC 4bpp RGBA
2084>>0	ulelong	4	PVRTC-II 2bpp
2085>>0	ulelong	5	PVRTC-II 4bpp
2086>>0	ulelong	6	ETC1
2087>>0	ulelong	7	DXT1
2088>>0	ulelong	8	DXT2
2089>>0	ulelong	9	DXT3
2090>>0	ulelong	10	DXT4
2091>>0	ulelong	11	DXT5
2092>>0	ulelong	12	BC4
2093>>0	ulelong	13	BC5
2094>>0	ulelong	14	BC6
2095>>0	ulelong	15	BC7
2096>>0	ulelong	16	UYVY
2097>>0	ulelong	17	YUY2
2098>>0	ulelong	18	BW1bpp
2099>>0	ulelong	19	R9G9B9E5 Shared Exponent
2100>>0	ulelong	20	RGBG8888
2101>>0	ulelong	21	GRGB8888
2102>>0	ulelong	22	ETC2 RGB
2103>>0	ulelong	23	ETC2 RGBA
2104>>0	ulelong	24	ETC2 RGB A1
2105>>0	ulelong	25	EAC R11
2106>>0	ulelong	26	EAC RG11
2107>>0	ulelong	27	ASTC_4x4
2108>>0	ulelong	28	ASTC_5x4
2109>>0	ulelong	29	ASTC_5x5
2110>>0	ulelong	30	ASTC_6x5
2111>>0	ulelong	31	ASTC_6x6
2112>>0	ulelong	32	ASTC_8x5
2113>>0	ulelong	33	ASTC_8x6
2114>>0	ulelong	34	ASTC_8x8
2115>>0	ulelong	35	ASTC_10x5
2116>>0	ulelong	36	ASTC_10x6
2117>>0	ulelong	37	ASTC_10x8
2118>>0	ulelong	38	ASTC_10x10
2119>>0	ulelong	39	ASTC_12x10
2120>>0	ulelong	40	ASTC_12x12
2121>>0	ulelong	41	ASTC_3x3x3
2122>>0	ulelong	42	ASTC_4x3x3
2123>>0	ulelong	43	ASTC_4x4x3
2124>>0	ulelong	44	ASTC_4x4x4
2125>>0	ulelong	45	ASTC_5x4x4
2126>>0	ulelong	46	ASTC_5x5x4
2127>>0	ulelong	47	ASTC_5x5x5
2128>>0	ulelong	48	ASTC_6x5x5
2129>>0	ulelong	49	ASTC_6x6x5
2130>>0	ulelong	50	ASTC_6x6x6
2131>4	ulelong	!0
2132>>0	byte	!0	%c
2133>>1	byte	!0	\b%c
2134>>2	byte	!0	\b%c
2135>>3	byte	!0	\b%c
2136
21370	string		PVR\x03			PVR 3.0 texture:
2138>0x18	ulelong		x	%u x
2139>0x1C	ulelong		x	%u
2140>0x20	ulelong		>1	x %u
2141>0x08	byte		x	\b,
2142>0x08	use	pvr3-pixel-format
2143>0x10	ulelong		1	\b, sRGB
2144>0x04	ulelong&0x02	0x02	\b, premultiplied alpha
2145
2146# Type: Microsoft Xbox XPR0 texture.
2147# From: David Korth <gerbilsoft@gerbilsoft.com>
2148# References:
2149# - https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/develop/src/core/hle/D3D8/XbD3D8Types.h
2150
2151# XPR pixel formats.
21520	name	xbox-xpr-pixel-format
2153>0	byte	0x00	L8
2154>0	byte	0x01	AL8
2155>0	byte	0x02	ARGB1555
2156>0	byte	0x03	RGB555
2157>0	byte	0x04	ARGB4444
2158>0	byte	0x05	RGB565
2159>0	byte	0x06	ARGB8888
2160>0	byte	0x07	xRGB8888
2161>0	byte	0x0B	P8
2162>0	byte	0x0C	DXT1
2163>0	byte	0x0E	DXT2
2164>0	byte	0x0F	DXT4
2165>0	byte	0x10	Linear ARGB1555
2166>0	byte	0x11	Linear RGB565
2167>0	byte	0x12	Linear ARGB8888
2168>0	byte	0x13	Linear L8
2169>0	byte	0x16	Linear R8B8
2170>0	byte	0x17	Linear G8B8
2171>0	byte	0x19	A8
2172>0	byte	0x1A	A8L8
2173>0	byte	0x1B	Linear AL8
2174>0	byte	0x1C	Linear RGB555
2175>0	byte	0x1D	Linear ARGB4444
2176>0	byte	0x1E	Linear xRGB8888
2177>0	byte	0x1F	Linear A8
2178>0	byte	0x20	Linear A8L8
2179>0	byte	0x24	YUY2
2180>0	byte	0x25	UYVY
2181>0	byte	0x27	L6V5U5
2182>0	byte	0x28	V8U8
2183>0	byte	0x29	R8B8
2184>0	byte	0x2A	D24S8
2185>0	byte	0x2B	F24S8
2186>0	byte	0x2C	D16
2187>0	byte	0x2D	F16
2188>0	byte	0x2E	Linear D24S8
2189>0	byte	0x2F	Linear F24S8
2190>0	byte	0x30	Linear D16
2191>0	byte	0x31	Linear F16
2192>0	byte	0x32	L16
2193>0	byte	0x33	V16U16
2194>0	byte	0x35	Linear L16
2195>0	byte	0x36	Linear V16U16
2196>0	byte	0x37	Linear L6V5U5
2197>0	byte	0x38	RGBA5551
2198>0	byte	0x39	RGBA4444
2199>0	byte	0x3A	QWVU8888
2200>0	byte	0x3B	BGRA8888
2201>0	byte	0x3C	RGBA8888
2202>0	byte	0x3D	Linear RGBA5551
2203>0	byte	0x3E	Linear RGBA4444
2204>0	byte	0x3F	Linear ABGR8888
2205>0	byte	0x40	Linear BGRA8888
2206>0	byte	0x41	Linear RGBA8888
2207>0	byte	0x64	Vertex Data
2208
22090	string		XPR0	Microsoft Xbox XPR0 texture
2210>0x19	byte	x	\b, format:
2211>>0x19	use	xbox-xpr-pixel-format
2212
2213# ILDA Image Data Transfer Format
2214# https://www.ilda.com/resources/StandardsDocs/ILDA_IDTF14_rev011.pdf
2215#
2216# Updated by Chuck Hein (laser@geekdude.com)
2217#
22180	string	ILDA	ILDA Image Data Transfer Format
2219>7	byte	0x00	3D Coordinates with Indexed Color
2220>7	byte	0x01	2D Coordinates with Indexed Color
2221>7	byte	0x02	Color Palette
2222>7	byte	0x04	3D Coordinates with True Color
2223>7	byte	0x05	2D Coordinates with True Color
2224>8	string	>0	\b, palette %s
2225>16	string	>0	\b, company %s
2226>24	beshort	>0	\b, number of records %d
2227>>26	beshort	x	\b, palette number %d
2228>>28	beshort	>0	\b, number of frames %d
2229>>30	byte	>0	\b, projector number %d
2230
2231# Dropbox "lepton" compressed jpeg format
2232# https://github.com/dropbox/lepton
22330	belong&0xfffff0ff	0xcf84005a	Lepton image file
2234>2	byte			x		(version %d)
2235