xref: /freebsd/contrib/file/magic/Magdir/images (revision f5ef5f675d9d9eb6e35ed9142d70ecf774456ad4)
1
2#------------------------------------------------------------------------------
3# $File: images,v 1.146 2018/07/03 20:55:37 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# skip more garbage like *.iso by looking for positive image type
31>2	ubyte			>0
32# skip some compiled terminfo like xterm+tmux by looking for image type less equal 33
33>>2	ubyte			<34
34# skip arches.3200 , Finder.Root , Slp.1 by looking for low pixel depth 1 8 15 16 24 32
35>>>16	ubyte			1
36>>>>0		use		tga-image
37>>>16	ubyte			8
38>>>>0		use		tga-image
39>>>16	ubyte			15
40>>>>0		use		tga-image
41>>>16	ubyte			16
42>>>>0		use		tga-image
43>>>16	ubyte			24
44>>>>0		use		tga-image
45>>>16	ubyte			32
46>>>>0		use		tga-image
47#	display tga bitmap image information
480	name				tga-image
49>2	ubyte		<34		Targa image data
50!:mime	image/x-tga
51!:apple	????TPIC
52# normal extension .tga but some Truevision products used others:
53# tpic (Apple),icb (Image Capture Board),vda (Video Display Adapter),vst (NuVista),win (UNSURE about that)
54!:ext	tga/tpic/icb/vda/vst
55# image type 1 2 3 9 10 11 32 33
56>2	ubyte&0xF7	1		- Map
57>2	ubyte&0xF7	2		- RGB
58# alpha channel
59>>17	ubyte&0x0F	>0		\bA
60>2	ubyte&0xF7	3		- Mono
61# type not found, but by http://www.fileformat.info/format/tga/corion.htm
62# Compressed color-mapped data, using Huffman, Delta, and runlength encoding
63>2	ubyte		32		- Color
64# Compressed color-mapped data, using Huffman, Delta, and RLE. 4-pass quadtree- type process
65>2	ubyte		33		- Color
66# Color Map Type 0~no 1~color map
67>1	ubyte		1		(
68# first color map entry, 0 normal
69>>3	uleshort	>0		\b%d-
70# color map length 0 2 1dh 3bh d9h 100h
71>>5	uleshort	x		\b%d)
72# 8~run length encoding bit
73>2	ubyte&0x08	8		- RLE
74# gimp can create big pictures!
75>12	uleshort	>0		%d x
76>12	uleshort	=0		65536 x
77# image height. 0 interpreted as 65536
78>14	uleshort	>0		%d
79>14	uleshort	=0		65536
80# Image Pixel depth 1 8 15 16 24 32
81>16	ubyte		x		x %d
82# X origin of image. 0 normal
83>8	uleshort	>0		+%d
84# Y origin of image. 0 normal; positive for top
85>10	uleshort	>0		+%d
86# Image descriptor: bits 3-0 give the alpha channel depth, bits 5-4 give direction
87>17	ubyte&0x0F	>0		- %d-bit alpha
88# bits 5-4 give direction. normal bottom left
89>17	ubyte		&0x20		- top
90#>17	ubyte		^0x20		- bottom
91>17	ubyte		&0x10		- right
92#>17	ubyte		^0x10		- left
93# some info say other bits 6-7 should be zero
94# but data storage interleave by http://www.fileformat.info/format/tga/corion.htm
95# 00 - no interleave;01 - even/odd interleave; 10 - four way interleave; 11 - reserved
96#>17	ubyte&0xC0	0x00		- no interleave
97>17	ubyte&0xC0	0x40		- interleave
98>17	ubyte&0xC0	0x80		- four way interleave
99>17	ubyte&0xC0	0xC0		- reserved
100# positive length implies identification field
101>0	ubyte		>0
102>>18	string		x		"%s"
103# last 18 bytes of newer tga file footer signature
104>18	search/4261301/s	TRUEVISION-XFILE.\0
105# extension area offset if not 0
106>>&-8		ulelong			>0
107# length of the extension area. normal 495 for version 2.0
108>>>(&-4.l)	uleshort		0x01EF
109# AuthorName[41]
110>>>>&0		string			>\0		- author "%-.40s"
111# Comment[324]=4 * 80 null terminated
112>>>>&41		string			>\0		- comment "%-.80s"
113# date
114>>>>&365	ubequad&0xffffFFFFffff0000	!0
115# Day
116>>>>>&-6		uleshort		x		%d
117# Month
118>>>>>&-8		uleshort		x		\b-%d
119# Year
120>>>>>&-4		uleshort		x		\b-%d
121# time
122>>>>&371	ubequad&0xffffFFFFffff0000	!0
123# hour
124>>>>>&-8		uleshort		x		%d
125# minutes
126>>>>>&-6		uleshort		x		\b:%.2d
127# second
128>>>>>&-4		uleshort		x		\b:%.2d
129# JobName[41]
130>>>>&377		string			>\0		- job "%-.40s"
131# JobHour Jobminute Jobsecond
132>>>>&418	ubequad&0xffffFFFFffff0000	!0
133>>>>>&-8		uleshort		x		%d
134>>>>>&-6		uleshort		x		\b:%.2d
135>>>>>&-4		uleshort		x		\b:%.2d
136# SoftwareId[41]
137>>>>&424		string			>\0		- %-.40s
138# SoftwareVersionNumber
139>>>>&424	ubyte				>0
140>>>>>&40		uleshort/100		x		%d
141>>>>>&40		uleshort%100		x		\b.%d
142# VersionLetter
143>>>>>&42		ubyte			>0x20		\b%c
144# KeyColor
145>>>>&468		ulelong			>0		- keycolor 0x%8.8x
146# Denominator of Pixel ratio. 0~no pixel aspect
147>>>>&474	uleshort			>0
148# Numerator
149>>>>>&-4		uleshort		>0		- aspect %d
150>>>>>&-2		uleshort		x		\b/%d
151# Denominator of Gamma ratio. 0~no Gamma value
152>>>>&478	uleshort			>0
153# Numerator
154>>>>>&-4		uleshort		>0		- gamma %d
155>>>>>&-2		uleshort		x		\b/%d
156# ColorOffset
157#>>>>&480	ulelong			x		- col offset 0x%8.8x
158# StampOffset
159#>>>>&484	ulelong			x		- stamp offset 0x%8.8x
160# ScanOffset
161#>>>>&488	ulelong			x		- scan offset 0x%8.8x
162# AttributesType
163#>>>>&492	ubyte			x		- Attributes 0x%x
164## EndOfTGA
165
166# PBMPLUS images
167# The next byte following the magic is always whitespace.
168# strength is changed to try these patterns before "x86 boot sector"
1690	name		netpbm
170>3	regex/s		=[0-9]{1,50}\ [0-9]{1,50}	Netpbm image data
171>>&0	regex		=[0-9]{1,50} 			\b, size = %s x
172>>>&0	regex		=[0-9]{1,50}			\b %s
173
1740	search/1	P1
175>0	regex/4		P1[\040\t\f\r\n]
176>>0	use		netpbm
177>>>0	string		x	\b, bitmap
178!:strength + 45
179!:mime	image/x-portable-bitmap
180
1810	search/1	P2
182>0	regex/4		P2[\040\t\f\r\n]
183>>0	use		netpbm
184>>>0	string		x	\b, greymap
185!:strength + 45
186!:mime	image/x-portable-greymap
187
1880	search/1	P3
189>0	regex/4		P3[\040\t\f\r\n]
190>>0	use		netpbm
191>>>0	string		x	\b, pixmap
192!:strength + 45
193!:mime	image/x-portable-pixmap
194
1950	string		P4
196>0	regex/4		P4[\040\t\f\r\n]
197>>0	use		netpbm
198>>>0	string		x	\b, rawbits, bitmap
199!:strength + 45
200!:mime	image/x-portable-bitmap
201
2020	string		P5
203>0	regex/4		P5[\040\t\f\r\n]
204>>0	use		netpbm
205>>>0	string		x	\b, rawbits, greymap
206!:strength + 45
207!:mime	image/x-portable-greymap
208
2090	string		P6
210>0	regex/4		P6[\040\t\f\r\n]
211>>0	use		netpbm
212>>>0	string		x	\b, rawbits, pixmap
213!:strength + 45
214!:mime	image/x-portable-pixmap
215
2160	string		P7		Netpbm PAM image file
217!:mime	image/x-portable-pixmap
218
219# From: bryanh@giraffe-data.com (Bryan Henderson)
2200	string		\117\072	Solitaire Image Recorder format
221>4	string		\013		MGI Type 11
222>4	string		\021		MGI Type 17
2230	string		.MDA		MicroDesign data
224>21	byte		48		version 2
225>21	byte		51		version 3
2260	string		.MDP		MicroDesign page data
227>21	byte		48		version 2
228>21	byte		51		version 3
229
230# NIFF (Navy Interchange File Format, a modification of TIFF) images
231# [GRR:  this *must* go before TIFF]
2320	string		IIN1		NIFF image data
233!:mime	image/x-niff
234
235# Canon RAW version 1 (CRW) files are a type of Canon Image File Format
236# (CIFF) file. These are apparently all little-endian.
237# From: Adam Buchbinder <adam.buchbinder@gmail.com>
238# URL: http://www.sno.phy.queensu.ca/~phil/exiftool/canon_raw.html
2390	string		II\x1a\0\0\0HEAPCCDR	Canon CIFF raw image data
240!:mime	image/x-canon-crw
241>16	leshort		x	\b, version %d.
242>14	leshort		x	\b%d
243
244# Canon RAW version 2 (CR2) files are a kind of TIFF with an extra magic
245# number. Put this above the TIFF test to make sure we detect them.
246# These are apparently all little-endian.
247# From: Adam Buchbinder <adam.buchbinder@gmail.com>
248# URL: http://libopenraw.freedesktop.org/wiki/Canon_CR2
2490	string		II\x2a\0\x10\0\0\0CR	Canon CR2 raw image data
250!:mime	image/x-canon-cr2
251>10	byte		x	\b, version %d.
252>11	byte		x	\b%d
253
254# Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
255# The second word of TIFF files is the TIFF version number, 42, which has
256# never changed.  The TIFF specification recommends testing for it.
2570	string		MM\x00\x2a	TIFF image data, big-endian
258!:strength +70
259!:mime	image/tiff
260>(4.L)	use		\^tiff_ifd
2610	string		II\x2a\x00	TIFF image data, little-endian
262!:mime	image/tiff
263!:strength +70
264>(4.l)	use		tiff_ifd
265
2660	name		tiff_ifd
267>0	leshort		x		\b, direntries=%d
268>2	use		tiff_entry
269
2700	name		tiff_entry
271# NewSubFileType
272>0	leshort		0xfe
273>>12	use		tiff_entry
274>0	leshort		0x100
275>>4	lelong		1
276>>>12	use		tiff_entry
277>>>8	leshort		x		\b, width=%d
278>0	leshort		0x101
279>>4	lelong		1
280>>>8	leshort		x		\b, height=%d
281>>>12	use		tiff_entry
282>0	leshort		0x102
283>>8	leshort		x		\b, bps=%d
284>>12	use		tiff_entry
285>0	leshort		0x103
286>>4	lelong		1		\b, compression=
287>>>8	leshort		1		\bnone
288>>>8	leshort		2		\bhuffman
289>>>8	leshort		3		\bbi-level group 3
290>>>8	leshort		4		\bbi-level group 4
291>>>8	leshort		5		\bLZW
292>>>8	leshort		6		\bJPEG (old)
293>>>8	leshort		7		\bJPEG
294>>>8	leshort		8		\bdeflate
295>>>8	leshort		9		\bJBIG, ITU-T T.85
296>>>8	leshort		0xa		\bJBIG, ITU-T T.43
297>>>8	leshort		0x7ffe		\bNeXT RLE 2-bit
298>>>8	leshort		0x8005		\bPackBits (Macintosh RLE)
299>>>8	leshort		0x8029		\bThunderscan RLE
300>>>8	leshort		0x807f		\bRasterPadding (CT or MP)
301>>>8	leshort		0x8080		\bRLE (Line Work)
302>>>8	leshort		0x8081		\bRLE (High-Res Cont-Tone)
303>>>8	leshort		0x8082		\bRLE (Binary Line Work)
304>>>8	leshort		0x80b2		\bDeflate (PKZIP)
305>>>8	leshort		0x80b3		\bKodak DCS
306>>>8	leshort		0x8765		\bJBIG
307>>>8	leshort		0x8798		\bJPEG2000
308>>>8	leshort		0x8799		\bNikon NEF Compressed
309>>>8	default		x
310>>>>8	leshort		x		\b(unknown 0x%x)
311>>>12	use		tiff_entry
312>0	leshort		0x106		\b, PhotometricIntepretation=
313>>8	clear		x
314>>8	leshort		0		\bWhiteIsZero
315>>8	leshort		1		\bBlackIsZero
316>>8	leshort		2		\bRGB
317>>8	leshort		3		\bRGB Palette
318>>8	leshort		4		\bTransparency Mask
319>>8	leshort		5		\bCMYK
320>>8	leshort		6		\bYCbCr
321>>8	leshort		8		\bCIELab
322>>8	default		x
323>>>8	leshort		x		\b(unknown=0x%x)
324>>12	use		tiff_entry
325# FillOrder
326>0	leshort		0x10a
327>>4	lelong		1
328>>>12	use		tiff_entry
329# DocumentName
330>0	leshort		0x10d
331>>(8.l)	string		x		\b, name=%s
332>>>12	use		tiff_entry
333# ImageDescription
334>0	leshort		0x10e
335>>(8.l)	string		x		\b, description=%s
336>>>12	use		tiff_entry
337# Make
338>0	leshort		0x10f
339>>(8.l)	string		x		\b, manufacturer=%s
340>>>12	use		tiff_entry
341# Model
342>0	leshort		0x110
343>>(8.l)	string		x		\b, model=%s
344>>>12	use		tiff_entry
345# StripOffsets
346>0	leshort		0x111
347>>12	use		tiff_entry
348# Orientation
349>0	leshort		0x112		\b, orientation=
350>>8	leshort		1		\bupper-left
351>>8	leshort		3		\blower-right
352>>8	leshort		6		\bupper-right
353>>8	leshort		8		\blower-left
354>>8	leshort		9		\bundefined
355>>8	default		x
356>>>8	leshort		x		\b[*%d*]
357>>12	use		tiff_entry
358# XResolution
359>0	leshort		0x11a
360>>8	lelong		x		\b, xresolution=%d
361>>12	use		tiff_entry
362# YResolution
363>0	leshort		0x11b
364>>8	lelong		x		\b, yresolution=%d
365>>12	use		tiff_entry
366# ResolutionUnit
367>0	leshort		0x128
368>>8	leshort		x		\b, resolutionunit=%d
369>>12	use		tiff_entry
370# Software
371>0	leshort		0x131
372>>(8.l)	string		x		\b, software=%s
373>>12	use		tiff_entry
374# Datetime
375>0	leshort		0x132
376>>(8.l)	string		x		\b, datetime=%s
377>>12	use		tiff_entry
378# HostComputer
379>0	leshort		0x13c
380>>(8.l)	string		x		\b, hostcomputer=%s
381>>12	use		tiff_entry
382# WhitePoint
383>0	leshort		0x13e
384>>12	use		tiff_entry
385# PrimaryChromaticities
386>0	leshort		0x13f
387>>12	use		tiff_entry
388# YCbCrCoefficients
389>0	leshort		0x211
390>>12	use		tiff_entry
391# YCbCrPositioning
392>0	leshort		0x213
393>>12	use		tiff_entry
394# ReferenceBlackWhite
395>0	leshort		0x214
396>>12	use		tiff_entry
397# Copyright
398>0	leshort		0x8298
399>>(8.l)	string		x		\b, copyright=%s
400>>12	use		tiff_entry
401# ExifOffset
402>0	leshort		0x8769
403>>12	use		tiff_entry
404# GPS IFD
405>0	leshort		0x8825		\b, GPS-Data
406>>12	use		tiff_entry
407
408#>0	leshort		x		\b, unknown=0x%x
409#>>12	use		tiff_entry
410
4110	string		MM\x00\x2b	Big TIFF image data, big-endian
412!:mime	image/tiff
4130	string		II\x2b\x00	Big TIFF image data, little-endian
414!:mime	image/tiff
415
416# PNG [Portable Network Graphics, or "PNG's Not GIF"] images
417# (Greg Roelofs, newt@uchicago.edu)
418# (Albert Cahalan, acahalan@cs.uml.edu)
419#
420# 137 P N G \r \n ^Z \n [4-byte length] I H D R [HEAD data] [HEAD crc] ...
421#
422
423# IHDR parser
4240	name		png-ihdr
425>0	belong		x		\b, %d x
426>4	belong		x		%d,
427>8	byte		x		%d-bit
428>9	byte		0		grayscale,
429>9	byte		2		\b/color RGB,
430>9	byte		3		colormap,
431>9	byte		4		gray+alpha,
432>9	byte		6		\b/color RGBA,
433#>10	byte		0		deflate/32K,
434>12	byte		0		non-interlaced
435>12	byte		1		interlaced
436
437# Standard PNG image.
4380	string		\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0DIHDR	PNG image data
439!:mime	image/png
440!:strength +10
441>16	use		png-ihdr
442
443# Apple CgBI PNG image.
4440	string		\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x04CgBI
445>24	string  	\x00\x00\x00\x0DIHDR	PNG image data (CgBI)
446!:mime	image/png
447!:strength +10
448>>32	use		png-ihdr
449
450# possible GIF replacements; none yet released!
451# (Greg Roelofs, newt@uchicago.edu)
452#
453# GRR 950115:  this was mine ("Zip GIF"):
4540	string		GIF94z		ZIF image (GIF+deflate alpha)
455!:mime	image/x-unknown
456#
457# GRR 950115:  this is Jeremy Wohl's Free Graphics Format (better):
458#
4590	string		FGF95a		FGF image (GIF+deflate beta)
460!:mime	image/x-unknown
461#
462# GRR 950115:  this is Thomas Boutell's Portable Bitmap Format proposal
463# (best; not yet implemented):
464#
4650	string		PBF		PBF image (deflate compression)
466!:mime	image/x-unknown
467
468# GIF
469# Strength set up to beat 0x55AA DOS/MBR signature word lookups (+65)
4700	string		GIF8		GIF image data
471!:strength +80
472!:mime	image/gif
473!:apple	8BIMGIFf
474>4	string		7a		\b, version 8%s,
475>4	string		9a		\b, version 8%s,
476>6	leshort		>0		%d x
477>8	leshort		>0		%d
478#>10	byte		&0x80		color mapped,
479#>10	byte&0x07	=0x00		2 colors
480#>10	byte&0x07	=0x01		4 colors
481#>10	byte&0x07	=0x02		8 colors
482#>10	byte&0x07	=0x03		16 colors
483#>10	byte&0x07	=0x04		32 colors
484#>10	byte&0x07	=0x05		64 colors
485#>10	byte&0x07	=0x06		128 colors
486#>10	byte&0x07	=0x07		256 colors
487
488# ITC (CMU WM) raster files.  It is essentially a byte-reversed Sun raster,
489# 1 plane, no encoding.
4900	string		\361\0\100\273	CMU window manager raster image data
491>4	lelong		>0		%d x
492>8	lelong		>0		%d,
493>12	lelong		>0		%d-bit
494
495# Magick Image File Format
4960	string		id=ImageMagick	MIFF image data
497
498# Artisan
4990	long		1123028772	Artisan image data
500>4	long		1		\b, rectangular 24-bit
501>4	long		2		\b, rectangular 8-bit with colormap
502>4	long		3		\b, rectangular 32-bit (24-bit with matte)
503
504# FIG (Facility for Interactive Generation of figures), an object-based format
5050	search/1	#FIG		FIG image text
506>5	string		x		\b, version %.3s
507
508# PHIGS
5090	string		ARF_BEGARF		PHIGS clear text archive
5100	string		@(#)SunPHIGS		SunPHIGS
511# version number follows, in the form m.n
512>40	string		SunBin			binary
513>32	string		archive			archive
514
515# GKS (Graphics Kernel System)
5160	string		GKSM		GKS Metafile
517>24	string		SunGKS		\b, SunGKS
518
519# CGM image files
5200	string		BEGMF		clear text Computer Graphics Metafile
521
522# MGR bitmaps  (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
5230	string	yz	MGR bitmap, modern format, 8-bit aligned
5240	string	zz	MGR bitmap, old format, 1-bit deep, 16-bit aligned
5250	string	xz	MGR bitmap, old format, 1-bit deep, 32-bit aligned
5260	string	yx	MGR bitmap, modern format, squeezed
527
528# Fuzzy Bitmap (FBM) images
5290	string		%bitmap\0	FBM image data
530>30	long		0x31		\b, mono
531>30	long		0x33		\b, color
532
533# facsimile data
5341	string		PC\ Research,\ Inc	group 3 fax data
535>29	byte		0		\b, normal resolution (204x98 DPI)
536>29	byte		1		\b, fine resolution (204x196 DPI)
537# From: Herbert Rosmanith <herp@wildsau.idv.uni.linz.at>
5380	string		Sfff		structured fax file
539
540# From: Joerg Jenderek <joerg.jen.der.ek@gmx.net>
541# most files with the extension .EPA and some with .BMP
5420	string		\x11\x06	Award BIOS Logo, 136 x 84
543!:mime	image/x-award-bioslogo
5440	string		\x11\x09	Award BIOS Logo, 136 x 126
545!:mime	image/x-award-bioslogo
546#0	string		\x07\x1f	BIOS Logo corrupted?
547# http://www.blackfiveservices.co.uk/awbmtools.shtml
548# http://biosgfx.narod.ru/v3/
549# http://biosgfx.narod.ru/abr-2/
5500	string		AWBM
551>4	leshort		<1981		Award BIOS bitmap
552!:mime	image/x-award-bmp
553# image width is a multiple of 4
554>>4	leshort&0x0003	0
555>>>4		leshort	x		\b, %d
556>>>6		leshort	x		x %d
557>>4	leshort&0x0003	>0		\b,
558>>>4	leshort&0x0003	=1
559>>>>4		leshort	x		%d+3
560>>>4	leshort&0x0003	=2
561>>>>4		leshort	x		%d+2
562>>>4	leshort&0x0003	=3
563>>>>4		leshort	x		%d+1
564>>>6		leshort	x		x %d
565# at offset 8 starts imagedata followed by "RGB " marker
566
567# PC bitmaps (OS/2, Windows BMP files)  (Greg Roelofs, newt@uchicago.edu)
568# http://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.\
569# 28bitmap_information_header.29
5700	string		BM
571>14	leshort		12		PC bitmap, OS/2 1.x format
572!:mime	image/x-ms-bmp
573>>18	leshort		x		\b, %d x
574>>20	leshort		x		%d
575>14	leshort		64		PC bitmap, OS/2 2.x format
576!:mime	image/x-ms-bmp
577>>18	leshort		x		\b, %d x
578>>20	leshort		x		%d
579>14	leshort		40		PC bitmap, Windows 3.x format
580!:mime	image/x-ms-bmp
581>>18	lelong		x		\b, %d x
582>>22	lelong		x		%d x
583>>28	leshort		x		%d
584>14	leshort		124		PC bitmap, Windows 98/2000 and newer format
585!:mime	image/x-ms-bmp
586>>18	lelong		x		\b, %d x
587>>22	lelong		x		%d x
588>>28	leshort		x		%d
589>14	leshort		108		PC bitmap, Windows 95/NT4 and newer format
590!:mime	image/x-ms-bmp
591>>18	lelong		x		\b, %d x
592>>22	lelong		x		%d x
593>>28	leshort		x		%d
594>14	leshort		128		PC bitmap, Windows NT/2000 format
595!:mime	image/x-ms-bmp
596>>18	lelong		x		\b, %d x
597>>22	lelong		x		%d x
598>>28	leshort		x		%d
599# Too simple - MPi
600#0	string		IC		PC icon data
601#0	string		PI		PC pointer image data
602#0	string		CI		PC color icon data
603#0	string		CP		PC color pointer image data
604# Conflicts with other entries [BABYL]
605#0	string		BA		PC bitmap array data
606
607# XPM icons (Greg Roelofs, newt@uchicago.edu)
6080	search/1	/*\ XPM\ */	X pixmap image text
609!:mime	image/x-xpmi
610
611# Utah Raster Toolkit RLE images (janl@ifi.uio.no)
6120	leshort		0xcc52		RLE image data,
613>6	leshort		x		%d x
614>8	leshort		x		%d
615>2	leshort		>0		\b, lower left corner: %d
616>4	leshort		>0		\b, lower right corner: %d
617>10	byte&0x1	=0x1		\b, clear first
618>10	byte&0x2	=0x2		\b, no background
619>10	byte&0x4	=0x4		\b, alpha channel
620>10	byte&0x8	=0x8		\b, comment
621>11	byte		>0		\b, %d color channels
622>12	byte		>0		\b, %d bits per pixel
623>13	byte		>0		\b, %d color map channels
624
625# image file format (Robert Potter, potter@cs.rochester.edu)
6260	string		Imagefile\ version-	iff image data
627# this adds the whole header (inc. version number), informative but longish
628>10	string		>\0		%s
629
630# Sun raster images, from Daniel Quinlan (quinlan@yggdrasil.com)
6310	belong		0x59a66a95	Sun raster image data
632>4	belong		>0		\b, %d x
633>8	belong		>0		%d,
634>12	belong		>0		%d-bit,
635#>16	belong		>0		%d bytes long,
636>20	belong		0		old format,
637#>20	belong		1		standard,
638>20	belong		2		compressed,
639>20	belong		3		RGB,
640>20	belong		4		TIFF,
641>20	belong		5		IFF,
642>20	belong		0xffff		reserved for testing,
643>24	belong		0		no colormap
644>24	belong		1		RGB colormap
645>24	belong		2		raw colormap
646#>28	belong		>0		colormap is %d bytes long
647
648# SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
649#
650# See
651#	http://reality.sgi.com/grafica/sgiimage.html
652#
6530	beshort		474		SGI image data
654#>2	byte		0		\b, verbatim
655>2	byte		1		\b, RLE
656#>3	byte		1		\b, normal precision
657>3	byte		2		\b, high precision
658>4	beshort		x		\b, %d-D
659>6	beshort		x		\b, %d x
660>8	beshort		x		%d
661>10	beshort		x		\b, %d channel
662>10	beshort		!1		\bs
663>80	string		>0		\b, "%s"
664
6650	string		IT01		FIT image data
666>4	belong		x		\b, %d x
667>8	belong		x		%d x
668>12	belong		x		%d
669#
6700	string		IT02		FIT image data
671>4	belong		x		\b, %d x
672>8	belong		x		%d x
673>12	belong		x		%d
674#
6752048	string		PCD_IPI		Kodak Photo CD image pack file
676>0xe02	byte&0x03	0x00		, landscape mode
677>0xe02	byte&0x03	0x01		, portrait mode
678>0xe02	byte&0x03	0x02		, landscape mode
679>0xe02	byte&0x03	0x03		, portrait mode
6800	string		PCD_OPA		Kodak Photo CD overview pack file
681
682# FITS format.  Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
683# FITS is the Flexible Image Transport System, the de facto standard for
684# data and image transfer, storage, etc., for the astronomical community.
685# (FITS floating point formats are big-endian.)
6860	string	SIMPLE\ \ =	FITS image data
687!:mime	image/fits
688!:ext	fits/fts
689>109	string	8		\b, 8-bit, character or unsigned binary integer
690>108	string	16		\b, 16-bit, two's complement binary integer
691>107	string	\ 32		\b, 32-bit, two's complement binary integer
692>107	string	-32		\b, 32-bit, floating point, single precision
693>107	string	-64		\b, 64-bit, floating point, double precision
694
695# other images
6960	string	This\ is\ a\ BitMap\ file	Lisp Machine bit-array-file
697
698# From SunOS 5.5.1 "/etc/magic" - appeared right before Sun raster image
699# stuff.
700#
7010	beshort		0x1010		PEX Binary Archive
702
703# DICOM medical imaging data
704# URL:		https://en.wikipedia.org/wiki/DICOM#Data_format
705# Note:		"dcm" is the official file name extension
706# 		XnView mention also "dc3" and "acr" as file name extension
707128	string	DICM			DICOM medical imaging data
708!:mime	application/dicom
709!:ext dcm/dicom/dic
710
711# XWD - X Window Dump file.
712#   As described in /usr/X11R6/include/X11/XWDFile.h
713#   used by the xwd program.
714#   Bradford Castalia, idaeim, 1/01
715#   updated by Adam Buchbinder, 2/09
716# The following assumes version 7 of the format; the first long is the length
717# of the header, which is at least 25 4-byte longs, and the one at offset 8
718# is a constant which is always either 1 or 2. Offset 12 is the pixmap depth,
719# which is a maximum of 32.
7200	belong	>100
721>8	belong	<3
722>>12	belong	<33
723>>>4	belong	7			XWD X Window Dump image data
724!:mime	image/x-xwindowdump
725>>>>100	string	>\0			\b, "%s"
726>>>>16	belong	x			\b, %dx
727>>>>20	belong	x			\b%dx
728>>>>12	belong	x			\b%d
729
730# PDS - Planetary Data System
731#   These files use Parameter Value Language in the header section.
732#   Unfortunately, there is no certain magic, but the following
733#   strings have been found to be most likely.
7340	string	NJPL1I00		PDS (JPL) image data
7352	string	NJPL1I			PDS (JPL) image data
7360	string	CCSD3ZF			PDS (CCSD) image data
7372	string	CCSD3Z			PDS (CCSD) image data
7380	string	PDS_			PDS image data
7390	string	LBLSIZE=		PDS (VICAR) image data
740
741# pM8x: ATARI STAD compressed bitmap format
742#
743# from Oskar Schirmer <schirmer@scara.com> Feb 2, 2001
744# p M 8 5/6 xx yy zz data...
745# Atari ST STAD bitmap is always 640x400, bytewise runlength compressed.
746# bytes either run horizontally (pM85) or vertically (pM86). yy is the
747# most frequent byte, xx and zz are runlength escape codes, where xx is
748# used for runs of yy.
749#
7500	string	pM85		Atari ST STAD bitmap image data (hor)
751>5	byte	0x00		(white background)
752>5	byte	0xFF		(black background)
7530	string	pM86		Atari ST STAD bitmap image data (vert)
754>5	byte	0x00		(white background)
755>5	byte	0xFF		(black background)
756
757# From: Alex Myczko <alex@aiei.ch>
758# http://www.atarimax.com/jindroush.atari.org/afmtatr.html
7590	leshort	0x0296		Atari ATR image
760
761# XXX:
762# This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
763# magic.
764# SGI RICE image file <mpruett@sgi.com>
765#0	beshort	0x5249		RICE image
766#>2	beshort	x		v%d
767#>4	beshort	x		(%d x
768#>6	beshort	x		%d)
769#>8	beshort	0		8 bit
770#>8	beshort	1		10 bit
771#>8	beshort	2		12 bit
772#>8	beshort	3		13 bit
773#>10	beshort	0		4:2:2
774#>10	beshort	1		4:2:2:4
775#>10	beshort	2		4:4:4
776#>10	beshort	3		4:4:4:4
777#>12	beshort	1		RGB
778#>12	beshort	2		CCIR601
779#>12	beshort	3		RP175
780#>12	beshort	4		YUV
781
782# PCX image files
783# From: Dan Fandrich <dan@coneharvesters.com>
784# updated by Joerg Jenderek at Feb 2013 by http://de.wikipedia.org/wiki/PCX
785# http://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
786# GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
787# 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
7880	ubelong&0xffF8fe00	0x0a000000
789# for PCX bit depth > 0
790>3	ubyte		>0
791# test for valid versions
792>>1	ubyte		<6
793>>>1	ubyte		!1	PCX
794!:mime	image/x-pcx
795#!:mime	image/pcx
796>>>>1	ubyte		0	ver. 2.5 image data
797>>>>1	ubyte		2	ver. 2.8 image data, with palette
798>>>>1	ubyte		3	ver. 2.8 image data, without palette
799>>>>1	ubyte		4	for Windows image data
800>>>>1	ubyte		5	ver. 3.0 image data
801>>>>4	uleshort	x	bounding box [%d,
802>>>>6	uleshort	x	%d] -
803>>>>8	uleshort	x	[%d,
804>>>>10	uleshort	x	%d],
805>>>>65	ubyte		>1	%d planes each of
806>>>>3	ubyte		x	%d-bit
807>>>>68	byte		1	colour,
808>>>>68	byte		2	grayscale,
809# this should not happen
810>>>>68	default		x	image,
811>>>>12	leshort		>0	%d x
812>>>>>14	uleshort	x	%d dpi,
813>>>>2	byte		0	uncompressed
814>>>>2	byte		1	RLE compressed
815
816# Adobe Photoshop
817# From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
8180	string		8BPS Adobe Photoshop Image
819!:mime	image/vnd.adobe.photoshop
820>4   beshort 2 (PSB)
821>18  belong  x \b, %d x
822>14  belong  x %d,
823>24  beshort 0 bitmap
824>24  beshort 1 grayscale
825>>12 beshort 2 with alpha
826>24  beshort 2 indexed
827>24  beshort 3 RGB
828>>12 beshort 4 \bA
829>24  beshort 4 CMYK
830>>12 beshort 5 \bA
831>24  beshort 7 multichannel
832>24  beshort 8 duotone
833>24  beshort 9 lab
834>12  beshort > 1
835>>12  beshort x \b, %dx
836>12  beshort 1 \b,
837>22  beshort x %d-bit channel
838>12  beshort > 1 \bs
839
840# XV thumbnail indicator (ThMO)
8410	string		P7\ 332		XV thumbnail image data
842
843# NITF is defined by United States MIL-STD-2500A
8440	string	NITF	National Imagery Transmission Format
845>25	string	>\0	dated %.14s
846
847# GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
848# Format variations from: Bernd Nuernberger <bernd.nuernberger@web.de>
849# Update: Joerg Jenderek
850# See http://fileformats.archiveteam.org/wiki/GEM_Raster
851# For variations, also see:
852#    http://www.seasip.info/Gem/ff_img.html (Ventura)
853#    http://www.atari-wiki.com/?title=IMG_file (XIMG, STTT)
854#    http://www.fileformat.info/format/gemraster/spec/index.htm (XIMG, STTT)
855#    http://sylvana.net/1stguide/1STGUIDE.ENG (TIMG)
8560       beshort     0x0001
857# header_size
858>2      beshort     0x0008
859>>0     use gem_info
860>2      beshort     0x0009
861>>0     use gem_info
862# no example for NOSIG
863>2      beshort     24
864>>0     use gem_info
865# no example for HYPERPAINT
866>2      beshort     25
867>>0     use gem_info
86816      string      XIMG\0
869>0      use gem_info
870# no example
87116      string      STTT\0\x10
872>0      use gem_info
873# no example or description
87416      string      TIMG\0
875>0      use gem_info
876
8770   name        gem_info
878# version is 2 for some XIMG and 1 for all others
879>0	beshort		<0x0003		GEM
880# http://www.snowstone.org.uk/riscos/mimeman/mimemap.txt
881!:mime	image/x-gem
882# header_size 24 25 27 59 779 words for colored bitmaps
883>>2	beshort		>9
884>>>16	string		STTT\0\x10	STTT
885>>>16	string		TIMG\0		TIMG
886# HYPERPAINT or NOSIG variant
887>>>16	string		\0\x80
888>>>>2	beshort		=24		NOSIG
889>>>>2	beshort		!24		HYPERPAINT
890# NOSIG or XIMG variant
891>>>16	default		x
892>>>>16	string		!XIMG\0		NOSIG
893>>16	string		=XIMG\0		XIMG Image data
894!:ext	img/ximg
895# to avoid Warning: Current entry does not yet have a description for adding a EXTENSION type
896>>16	string		!XIMG\0		Image data
897!:ext	img
898# header_size is 9 for Ventura files and 8 for other GEM Paint files
899>>2	beshort		9		(Ventura)
900#>>2	beshort		8		(Paint)
901>>12	beshort		x		%d x
902>>14	beshort		x		%d,
903# 1 4 8
904>>4	beshort		x		%d planes,
905# in tenths of a millimetre
906>>8	beshort		x		%d x
907>>10	beshort		x		%d pixelsize
908# pattern_size 1-8. 2 for GEM Paint
909>>6	beshort		!2		\b, pattern size %d
910
911# GEM Metafile (Wolfram Kleff)
9120	lelong		0x0018FFFF	GEM Metafile data
913>4	leshort		x		version %d
914
915#
916# SMJPEG. A custom Motion JPEG format used by Loki Entertainment
917# Software Torbjorn Andersson <d91tan@Update.UU.SE>.
918#
9190	string	\0\nSMJPEG	SMJPEG
920>8	belong	x		%d.x data
921# According to the specification you could find any number of _TXT
922# headers here, but I can't think of any way of handling that. None of
923# the SMJPEG files I tried it on used this feature. Even if such a
924# file is encountered the output should still be reasonable.
925>16	string	_SND		\b,
926>>24	beshort	>0		%d Hz
927>>26	byte	8		8-bit
928>>26	byte	16		16-bit
929>>28	string	NONE		uncompressed
930# >>28	string	APCM		ADPCM compressed
931>>27	byte	1		mono
932>>28	byte	2		stereo
933# Help! Isn't there any way to avoid writing this part twice?
934>>32	string	_VID		\b,
935# >>>48	string	JFIF		JPEG
936>>>40	belong	>0		%d frames
937>>>44	beshort	>0		(%d x
938>>>46	beshort	>0		%d)
939>16	string	_VID		\b,
940# >>32	string	JFIF		JPEG
941>>24	belong	>0		%d frames
942>>28	beshort	>0		(%d x
943>>30	beshort	>0		%d)
944
9450	string	Paint\ Shop\ Pro\ Image\ File	Paint Shop Pro Image File
946
947# "thumbnail file" (icon)
948# descended from "xv", but in use by other applications as well (Wolfram Kleff)
9490       string          P7\ 332         XV "thumbnail file" (icon) data
950
951# taken from fkiss: (<yav@mte.biglobe.ne.jp> ?)
9520       string          KiSS            KISS/GS
953>4      byte            16              color
954>>5     byte            x               %d bit
955>>8     leshort         x               %d colors
956>>10    leshort         x               %d groups
957>4      byte            32              cell
958>>5     byte            x               %d bit
959>>8     leshort         x               %d x
960>>10    leshort         x               %d
961>>12    leshort         x               +%d
962>>14    leshort         x               +%d
963
964# Webshots (www.webshots.com), by John Harrison
9650       string          C\253\221g\230\0\0\0 Webshots Desktop .wbz file
966
967# Hercules DASD image files
968# From Jan Jaeger <jj@septa.nl>
9690       string  CKD_P370        Hercules CKD DASD image file
970>8      long    x               \b, %d heads per cylinder
971>12     long    x               \b, track size %d bytes
972>16     byte    x               \b, device type 33%2.2X
973
9740       string  CKD_C370        Hercules compressed CKD DASD image file
975>8      long    x               \b, %d heads per cylinder
976>12     long    x               \b, track size %d bytes
977>16     byte    x               \b, device type 33%2.2X
978
9790       string  CKD_S370        Hercules CKD DASD shadow file
980>8      long    x               \b, %d heads per cylinder
981>12     long    x               \b, track size %d bytes
982>16     byte    x               \b, device type 33%2.2X
983
984# Squeak images and programs - etoffi@softhome.net
9850	string		\146\031\0\0	Squeak image data
9860	search/1	'From\040Squeak	Squeak program text
987
988# partimage: file(1) magic for PartImage files (experimental, incomplete)
989# Author: Hans-Joachim Baader <hjb@pro-linux.de>
9900		string	PaRtImAgE-VoLuMe	PartImage
991>0x0020		string	0.6.1		file version %s
992>>0x0060	lelong	>-1		volume %d
993#>>0x0064 8 byte identifier
994#>>0x007c reserved
995>>0x0200	string	>\0		type %s
996>>0x1400	string	>\0		device %s,
997>>0x1600	string	>\0		original filename %s,
998# Some fields omitted
999>>0x2744	lelong	0		not compressed
1000>>0x2744	lelong	1		gzip compressed
1001>>0x2744	lelong	2		bzip2 compressed
1002>>0x2744	lelong	>2		compressed with unknown algorithm
1003>0x0020		string	>0.6.1		file version %s
1004>0x0020		string	<0.6.1		file version %s
1005
1006# DCX is multi-page PCX, using a simple header of up to 1024
1007# offsets for the respective PCX components.
1008# From: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
10090	lelong	987654321	DCX multi-page PCX image data
1010
1011# Simon Walton <simonw@matteworld.com>
1012# Kodak Cineon format for scanned negatives
1013# http://www.kodak.com/US/en/motion/support/dlad/
10140	lelong  0xd75f2a80	Cineon image data
1015>200	belong  >0		\b, %d x
1016>204	belong  >0		%d
1017
1018
1019# Bio-Rad .PIC is an image format used by microscope control systems
1020# and related image processing software used by biologists.
1021# From: Vebjorn Ljosa <vebjorn@ljosa.com>
1022# BOOL values are two-byte integers; use them to rule out false positives.
1023# http://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
1024# Samples: http://www.loci.wisc.edu/software/sample-data
102514	leshort <2
1026>62	leshort <2
1027>>54	leshort 12345		Bio-Rad .PIC Image File
1028>>>0	leshort >0		%d x
1029>>>2	leshort >0		%d,
1030>>>4	leshort =1		1 image in file
1031>>>4	leshort >1		%d images in file
1032
1033# From Jan "Yenya" Kasprzak <kas@fi.muni.cz>
1034# The description of *.mrw format can be found at
1035# http://www.dalibor.cz/minolta/raw_file_format.htm
10360	string	\000MRM			Minolta Dimage camera raw image data
1037
1038# Summary: DjVu image / document
1039# Extension: .djvu
1040# Reference: http://djvu.org/docs/DjVu3Spec.djvu
1041# Submitted by: Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
1042# Modified by (1): Abel Cheung <abelcheung@gmail.com>
10430	string	AT&TFORM
1044>12	string	DJVM		DjVu multiple page document
1045!:mime	image/vnd.djvu
1046>12	string	DJVU		DjVu image or single page document
1047!:mime	image/vnd.djvu
1048>12	string	DJVI		DjVu shared document
1049!:mime	image/vnd.djvu
1050>12	string	THUM		DjVu page thumbnails
1051!:mime	image/vnd.djvu
1052
1053# Originally by Marc Espie
1054# Modified by Robert Minsk <robertminsk at yahoo.com>
1055# http://www.openexr.com/openexrfilelayout.pdf
10560	lelong		20000630	OpenEXR image data,
1057!:mime image/x-exr
1058>4	lelong&0x000000ff x		version %d,
1059>4	lelong		^0x00000200	storage: scanline
1060>4	lelong		&0x00000200	storage: tiled
1061>8	search/0x1000	compression\0	\b, compression:
1062>>&16	byte		0		none
1063>>&16	byte		1		rle
1064>>&16	byte		2		zips
1065>>&16	byte		3		zip
1066>>&16	byte		4		piz
1067>>&16	byte		5		pxr24
1068>>&16	byte		6		b44
1069>>&16	byte		7		b44a
1070>>&16	byte		8		dwaa
1071>>&16	byte		9		dwab
1072>>&16	byte		>9		unknown
1073>8	 search/0x1000	dataWindow\0	\b, dataWindow:
1074>>&10	lelong		x		(%d
1075>>&14	lelong		x		%d)-
1076>>&18	lelong		x		\b(%d
1077>>&22	lelong		x		%d)
1078>8	search/0x1000	displayWindow\0	\b, displayWindow:
1079>>&10	lelong		x		(%d
1080>>&14	lelong		x		%d)-
1081>>&18	lelong		x		\b(%d
1082>>&22	lelong		x		%d)
1083>8	search/0x1000	lineOrder\0	 \b, lineOrder:
1084>>&14	byte		0		increasing y
1085>>&14	byte		1		decreasing y
1086>>&14	byte		2		random y
1087>>&14	byte		>2		unknown
1088
1089# SMPTE Digital Picture Exchange Format, SMPTE DPX
1090#
1091# ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
1092# Moving-Picture Exchange (DPX), v1.0, 18 February 1994
1093# Robert Minsk <robertminsk at yahoo.com>
1094# Modified by Harry Mallon <hjmallon at gmail.com>
10950	string		SDPX	DPX image data, big-endian,
1096!:mime image/x-dpx
1097>0	use		dpx_info
10980	string		XPDS	DPX image data, little-endian,
1099!:mime image/x-dpx
1100>0	use		\^dpx_info
1101
11020	name		dpx_info
1103>768	beshort		<4
1104>>772	belong		x	%dx
1105>>776	belong		x	\b%d,
1106>768	beshort		>3
1107>>776	belong		x	%dx
1108>>772	belong		x	\b%d,
1109>768	beshort		0	left to right/top to bottom
1110>768	beshort		1	right to left/top to bottom
1111>768	beshort		2	left to right/bottom to top
1112>768	beshort		3	right to left/bottom to top
1113>768	beshort		4	top to bottom/left to right
1114>768	beshort		5	top to bottom/right to left
1115>768	beshort		6	bottom to top/left to right
1116>768	beshort		7	bottom to top/right to left
1117
1118# From: Tom Hilinski <tom.hilinski@comcast.net>
1119# http://www.unidata.ucar.edu/packages/netcdf/
11200	string	CDF\001			NetCDF Data Format data
1121
1122#-----------------------------------------------------------------------
1123# Hierarchical Data Format, used to facilitate scientific data exchange
1124# specifications at http://hdf.ncsa.uiuc.edu/
11250	belong	0x0e031301	Hierarchical Data Format (version 4) data
1126!:mime	application/x-hdf
11270	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) data
1128!:mime	application/x-hdf
1129512	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 512 bytes user block
1130!:mime	application/x-hdf
11311024	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 1k user block
1132!:mime	application/x-hdf
11332048	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 2k user block
1134!:mime	application/x-hdf
11354096	string	\211HDF\r\n\032\n	Hierarchical Data Format (version 5) with 4k user block
1136!:mime	application/x-hdf
1137
1138
1139# From: Tobias Burnus <burnus@net-b.de>
1140# Xara (for a while: Corel Xara) is a graphic package, see
1141# http://www.xara.com/ for Windows and as GPL application for Linux
11420	string	XARA\243\243	Xara graphics file
1143
1144# http://www.cartesianinc.com/Tech/
11450	string	CPC\262		Cartesian Perceptual Compression image
1146!:mime	image/x-cpi
1147
1148# From Albert Cahalan <acahalan@gmail.com>
1149# puredigital used it for the CVS disposable camcorder
1150#8       lelong  4       ZBM bitmap image data
1151#>4      leshort x       %u x
1152#>6      leshort x       %u
1153
1154# From Albert Cahalan <acahalan@gmail.com>
1155# uncompressed 5:6:5 HighColor image for OLPC XO firmware icons
11560       string C565     OLPC firmware icon image data
1157>4      leshort x       %u x
1158>6      leshort x       %u
1159
1160# Applied Images - Image files from Cytovision
1161# Gustavo Junior Alves <gjalves@gjalves.com.br>
11620	string	\xce\xda\xde\xfa	Cytovision Metaphases file
11630	string	\xed\xad\xef\xac	Cytovision Karyotype file
11640	string	\x0b\x00\x03\x00	Cytovision FISH Probe file
11650	string	\xed\xfe\xda\xbe	Cytovision FLEX file
11660	string	\xed\xab\xed\xfe	Cytovision FLEX file
11670	string	\xad\xfd\xea\xad	Cytovision RATS file
1168
1169# Wavelet Scalar Quantization format used in gray-scale fingerprint images
1170# From Tano M Fotang <mfotang@quanteq.com>
11710	string	\xff\xa0\xff\xa8\x00	Wavelet Scalar Quantization image data
1172
1173# Type:		PCO B16 image files
1174# URL:		http://www.pco.de/fileadmin/user_upload/db/download/MA_CWDCOPIE_0412b.pdf
1175# From:		Florian Philipp <florian.philipp@binarywings.net>
1176# Extension:	.b16
1177# Description:	Pixel image format produced by PCO Camware, typically used
1178#		together with PCO cameras.
1179# Note:		Different versions exist for e.g. 8 bit and 16 bit images.
1180#		Documentation is incomplete.
11810	string/b	PCO-	PCO B16 image data
1182>12	lelong		x	\b, %dx
1183>16	lelong		x	\b%d
1184>20	lelong		0	\b, short header
1185>20	lelong		-1	\b, extended header
1186>>24	lelong		0	\b, grayscale
1187>>>36	lelong		0	linear LUT
1188>>>36	lelong		1	logarithmic LUT
1189>>>28	lelong		x	[%d
1190>>>32	lelong		x	\b,%d]
1191>>24	lelong		1	\b, color
1192>>>64	lelong		0	linear LUT
1193>>>64	lelong		1	logarithmic LUT
1194>>>40	lelong		x	r[%d
1195>>>44	lelong		x	\b,%d]
1196>>>48	lelong		x	g[%d
1197>>>52	lelong		x	\b,%d]
1198>>>56	lelong		x	b[%d
1199>>>60	lelong		x	\b,%d]
1200
1201# Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
1202# From: Markus Heidelberg <markus.heidelberg at web.de>
12030	string/t	[BitmapInfo2]	Polar Monitor Bitmap text
1204!:mime	image/x-polar-monitor-bitmap
1205
1206# From: Rick Richardson <rickrich@gmail.com>
1207# updated by: Joerg Jenderek
1208# URL: http://techmods.net/nuvi/
12090	string	GARMIN\ BITMAP\ 01	Garmin Bitmap file
1210# extension is also used for
1211# Sony SRF raw image (image/x-sony-srf)
1212# SRF map
1213# Terragen Surface Map (http://www.planetside.co.uk/terragen)
1214# FileLocator Pro search criteria file (http://www.mythicsoft.com/filelocatorpro)
1215!:ext srf
1216#!:mime	image/x-garmin-srf
1217# version 1.00,2.00,2.10,2.40,2.50
1218>0x2f	string		>0		\b, version %4.4s
1219# width (2880,2881,3240)
1220>0x55	uleshort	>0		\b, %dx
1221# height (80,90)
1222>>0x53	uleshort	x		\b%d
1223
1224# Type:	Ulead Photo Explorer5 (.pe5)
1225# URL:	http://www.jisyo.com/cgibin/view.cgi?EXT=pe5 (Japanese)
1226# From:	Simon Horman <horms@debian.org>
12270	string	IIO2H			Ulead Photo Explorer5
1228
1229# Type:	X11 cursor
1230# URL:	http://webcvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?view=markup
1231# From:	Mathias Brodala <info@noctus.net>
12320	string	Xcur			X11 cursor
1233
1234# Type:	Olympus ORF raw images.
1235# URL:	http://libopenraw.freedesktop.org/wiki/Olympus_ORF
1236# From:	Adam Buchbinder <adam.buchbinder@gmail.com>
12370	string		MMOR		Olympus ORF raw image data, big-endian
1238!:mime	image/x-olympus-orf
12390	string		IIRO		Olympus ORF raw image data, little-endian
1240!:mime	image/x-olympus-orf
12410	string		IIRS		Olympus ORF raw image data, little-endian
1242!:mime	image/x-olympus-orf
1243
1244# Type: files used in modern AVCHD camcoders to store clip information
1245# Extension: .cpi
1246# From: Alexander Danilov <alexander.a.danilov@gmail.com>
12470	string	HDMV0100	AVCHD Clip Information
1248
1249# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1250# URL: http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
1251# Radiance HDR; usually has .pic or .hdr extension.
12520	string	#?RADIANCE\n	Radiance HDR image data
1253#!mime	image/vnd.radiance
1254
1255# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1256# URL: http://www.mpi-inf.mpg.de/resources/pfstools/pfs_format_spec.pdf
1257# Used by the pfstools packages. The regex matches for the image size could
1258# probably use some work. The MIME type is made up; if there's one in
1259# actual common use, it should replace the one below.
12600	string	PFS1\x0a	PFS HDR image data
1261#!mime	image/x-pfs
1262>1	regex	[0-9]*\ 		\b, %s
1263>>1	regex	\ [0-9]{4}		\bx%s
1264
1265# Type: Foveon X3F
1266# URL:  http://www.photofo.com/downloads/x3f-raw-format.pdf
1267# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1268# Note that the MIME type isn't defined anywhere that I can find; if
1269# there's a canonical type for this format, it should replace this one.
12700	string	FOVb	Foveon X3F raw image data
1271!:mime	image/x-x3f
1272>6	leshort	x	\b, version %d.
1273>4	leshort	x	\b%d
1274>28	lelong	x	\b, %dx
1275>32	lelong	x	\b%d
1276
1277# Paint.NET file
1278# From Adam Buchbinder <adam.buchbinder@gmail.com>
12790	string	PDN3	Paint.NET image data
1280!:mime	image/x-paintnet
1281
1282# Not really an image.
1283# From: "Tano M. Fotang" <mfotang@quanteq.com>
12840	string	\x46\x4d\x52\x00	ISO/IEC 19794-2 Format Minutiae Record (FMR)
1285
1286# doc: http://www.shikino.co.jp/eng/products/images/FLOWER.jpg.zip
1287# example: http://www.shikino.co.jp/eng/products/images/FLOWER.wdp.zip
128890	bequad		0x574D50484F544F00	JPEG-XR Image
1289>98	byte&0x08	=0x08			\b, hard tiling
1290>99	byte&0x80	=0x80			\b, tiling present
1291>99	byte&0x40	=0x40			\b, codestream present
1292>99	byte&0x38	x			\b, spatial xform=
1293>99	byte&0x38	0x00			\bTL
1294>99	byte&0x38	0x08			\bBL
1295>99	byte&0x38	0x10			\bTR
1296>99	byte&0x38	0x18			\bBR
1297>99	byte&0x38	0x20			\bBT
1298>99	byte&0x38	0x28			\bRB
1299>99	byte&0x38	0x30			\bLT
1300>99	byte&0x38	0x38			\bLB
1301>100	byte&0x80	=0x80			\b, short header
1302>>102	beshort+1	x			\b, %d
1303>>104	beshort+1	x			\bx%d
1304>100	byte&0x80	=0x00			\b, long header
1305>>102	belong+1	x			\b, %x
1306>>106	belong+1	x			\bx%x
1307>101	beshort&0xf	x			\b, bitdepth=
1308>>101	beshort&0xf	0x0			\b1-WHITE=1
1309>>101	beshort&0xf	0x1			\b8
1310>>101	beshort&0xf	0x2			\b16
1311>>101	beshort&0xf	0x3			\b16-SIGNED
1312>>101	beshort&0xf	0x4			\b16-FLOAT
1313>>101	beshort&0xf	0x5			\b(reserved 5)
1314>>101	beshort&0xf	0x6			\b32-SIGNED
1315>>101	beshort&0xf	0x7			\b32-FLOAT
1316>>101	beshort&0xf	0x8			\b5
1317>>101	beshort&0xf	0x9			\b10
1318>>101	beshort&0xf	0xa			\b5-6-5
1319>>101	beshort&0xf	0xb			\b(reserved %d)
1320>>101	beshort&0xf	0xc			\b(reserved %d)
1321>>101	beshort&0xf	0xd			\b(reserved %d)
1322>>101	beshort&0xf	0xe			\b(reserved %d)
1323>>101	beshort&0xf	0xf			\b1-BLACK=1
1324>101	beshort&0xf0	x			\b, colorfmt=
1325>>101	beshort&0xf0	0x00			\bYONLY
1326>>101	beshort&0xf0	0x10			\bYUV240
1327>>101	beshort&0xf0	0x20			\bYWV422
1328>>101	beshort&0xf0	0x30			\bYWV444
1329>>101	beshort&0xf0	0x40			\bCMYK
1330>>101	beshort&0xf0	0x50			\bCMYKDIRECT
1331>>101	beshort&0xf0	0x60			\bNCOMPONENT
1332>>101	beshort&0xf0	0x70			\bRGB
1333>>101	beshort&0xf0	0x80			\bRGBE
1334>>101	beshort&0xf0	>0x80			\b(reserved 0x%x)
1335
1336# From: Johan van der Knijff <johan.vanderknijff@kb.nl>
1337#
1338# BPG (Better Portable Graphics) format
1339# http://bellard.org/bpg/
1340# http://fileformats.archiveteam.org/wiki/BPG
1341#
13420	string	\x42\x50\x47\xFB	BPG (Better Portable Graphics)
1343!:mime  image/bpg
1344
1345# From: Joerg Jenderek
1346# URL: https://en.wikipedia.org/wiki/Apple_Icon_Image_format
13470	string		icns		Mac OS X icon
1348!:mime	image/x-icns
1349!:apple	????icns
1350!:ext icns
1351>4	ubelong		>0
1352# file size
1353>>4	ubelong		x		\b, %d bytes
1354# icon type
1355>>8	string		x		\b, "%4.4s" type
1356
1357# TIM images
13580		lelong		0x00000010	TIM image,
1359>4		lelong  	0x8		4-Bit,
1360>4		lelong  	0x9		8-Bit,
1361>4		lelong  	0x2		15-Bit,
1362>4		lelong  	0x3		24-Bit,
1363>4		lelong 		&8
1364>>(8.l+12)	leshort		x		Pixel at (%d,
1365>>(8.l+14)	leshort		x		\b%d)
1366>>(8.l+16)	leshort		x		Size=%dx
1367>>(8.l+18)	leshort		x		\b%d,
1368>>4		lelong 		0x8		16 CLUT Entries at
1369>>4		lelong 		0x9		256 CLUT Entries at
1370>>12		leshort		x		(%d,
1371>>14		leshort		x		\b%d)
1372>4		lelong		^8
1373>>12		leshort		x		Pixel at (%d,
1374>>14		leshort		x		\b%d)
1375>>16		leshort		x		Size=%dx
1376>>18		leshort		x		\b%d
1377
1378# MDEC streams
13790		lelong		0x80010160	MDEC video stream,
1380>16		leshort		x		%dx
1381>18		leshort		x		\b%d
1382#>8		lelong		x		%d frames
1383#>4		leshort		x		secCount=%d;
1384#>6		leshort		x		nSectors=%d;
1385#>12		lelong		x		frameSize=%d;
1386
1387# BS encoded bitstreams
13882		leshort		0x3800		BS image,
1389>6		leshort		x		Version %d,
1390>4		leshort		x		Quantization %d,
1391>0		leshort		x		(Decompresses to %d words)
1392
1393# Type: farbfeld image.
1394# Url: http://tools.suckless.org/farbfeld/
1395# From: Ian D. Scott <ian@iandouglasscott.com>
1396#
13970		string		farbfeld	farbfeld image data,
1398>8		ubelong		x		%dx
1399>12		ubelong		x		\b%d
1400
1401# Type: Microsoft DirectDraw Surface (common data)
1402# URL:	http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
1403# From: Morten Hustveit <morten@debian.org>
1404# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
14050	name	ms-directdraw-surface
1406>0x10	ulelong	x			%u x
1407>0x0C	ulelong	x			%u
1408# Color depth.
1409>0x58	ulelong	>0			\b, %u-bit color
1410# Determine the pixel format.
1411>0x50	ulelong&0x4	4
1412# FIXME: Handle DX10 and XBOX formats.
1413>>0x54	string	x			\b, compressed using %.4s
1414>0x50	ulelong&0x2	0x2		\b, alpha only
1415>0x50	ulelong&0x200	0x200		\b, YUV
1416>0x50	ulelong&0x20000	0x20000		\b, luminance
1417# RGB pixel format
1418>0x50	ulelong&0x40	0x40
1419
1420# Determine the RGB format using the color masks.
1421# ulequad order: 0xGGGGGGGGRRRRRRRR, 0xAAAAAAAABBBBBBBB
1422
1423>>0x58		ulelong	16
1424
1425# NOTE: 15-bit color formats usually have 16-bit listed as the color depth.
1426>>>0x5C		ulequad	0x000003E000007C00
1427>>>>0x64	ulequad 0x000000000000001F	\b, RGB555
1428>>>0x5C		ulequad	0x000003E000001F00
1429>>>>0x64	ulequad 0x000000000000007C	\b, BGR555
1430
1431>>>0x5C		ulequad	0x000007E00000F800
1432>>>>0x64	ulequad 0x000000000000001F	\b, RGB565
1433>>>0x5C		ulequad	0x000007E000001F00
1434>>>>0x64	ulequad 0x00000000000000F8	\b, BGR565
1435
1436>>>0x5C		ulequad	0x000000F000000F00
1437>>>>0x64	ulequad 0x0000F0000000000F	\b, ARGB4444
1438>>>0x5C		ulequad	0x000000F00000000F
1439>>>>0x64	ulequad 0x0000F00000000F00	\b, ABGR4444
1440
1441>>>0x5C		ulequad	0x00000F000000F000
1442>>>>0x64	ulequad 0x0000000F000000F0	\b, RGBA4444
1443>>>0x5C		ulequad	0x00000F00000000F0
1444>>>>0x64	ulequad 0x0000000F0000F000	\b, BGRA4444
1445
1446>>>0x5C		ulequad	0x000000F000000F00
1447>>>>0x64	ulequad 0x000000000000000F	\b, xRGB4444
1448>>>0x5C		ulequad	0x000000F00000000F
1449>>>>0x64	ulequad 0x0000000000000F00	\b, xBGR4444
1450
1451>>>0x5C		ulequad	0x00000F000000F000
1452>>>>0x64	ulequad 0x00000000000000F0	\b, RGBx4444
1453>>>0x5C		ulequad	0x00000F00000000F0
1454>>>>0x64	ulequad 0x000000000000F000	\b, BGRx4444
1455
1456>>>0x5C		ulequad	0x000003E000007C00
1457>>>>0x64	ulequad 0x000080000000001F	\b, ARGB1555
1458>>>0x5C		ulequad	0x000003E000001F00
1459>>>>0x64	ulequad 0x000080000000007C	\b, ABGR1555
1460>>>0x5C		ulequad	0x000007C00000F800
1461>>>>0x64	ulequad 0x000000010000003E	\b, RGBA5551
1462>>>0x5C		ulequad	0x000007C00000003E
1463>>>>0x64	ulequad 0x000000010000F800	\b, BGRA5551
1464
1465>>88		ulelong 24
1466>>>0x5C		ulequad	0x0000FF0000FF0000
1467>>>>0x64	ulequad 0x00000000000000FF	\b, RGB888
1468>>>0x5C		ulequad	0x0000FF00000000FF
1469>>>>0x64	ulequad 0x0000000000FF0000	\b, BGR888
1470
1471>>88		ulelong 32
1472>>>0x5C		ulequad	0x0000FF0000FF0000
1473>>>>0x64	ulequad 0xFF000000000000FF	\b, ARGB8888
1474>>>0x5C		ulequad	0x0000FF00000000FF
1475>>>>0x64	ulequad 0xFF00000000FF0000	\b, ABGR8888
1476
1477>>>0x5C		ulequad	0x00FF0000FF000000
1478>>>>0x64	ulequad 0x000000FF0000FF00	\b, RGBA8888
1479>>>0x5C		ulequad	0x00FF00000000FF00
1480>>>>0x64	ulequad 0x000000FFFF000000	\b, BGBA8888
1481
1482>>>0x5C		ulequad	0x0000FF0000FF0000
1483>>>>0x64	ulequad 0x00000000000000FF	\b, xRGB8888
1484>>>0x5C		ulequad	0x0000FF00000000FF
1485>>>>0x64	ulequad 0x0000000000FF0000	\b, xBGR8888
1486
1487>>>0x5C		ulequad	0x00FF0000FF000000
1488>>>>0x64	ulequad 0x000000000000FF00	\b, RGBx8888
1489>>>0x5C		ulequad	0x00FF00000000FF00
1490>>>>0x64	ulequad 0x00000000FF000000	\b, BGBx8888
1491
1492# Less common 32-bit color formats.
1493>>>0x5C		ulequad	0xFFFF00000000FFFF
1494>>>>0x64	ulequad 0x0000000000000000	\b, G16R16
1495>>>0x5C		ulequad	0x0000FFFFFFFF0000
1496>>>>0x64	ulequad 0x0000000000000000	\b, R16G16
1497
1498>>>0x5C		ulequad	0x000FFC003FF00000
1499>>>>0x64	ulequad 0xC0000000000003FF	\b, A2R10G10B10
1500>>>0x5C		ulequad	0x000FFC00000003FF
1501>>>>0x64	ulequad 0xC00000003FF00000	\b, A2B10G10R10
1502
1503# Type: Microsoft DirectDraw Surface
1504# URL:	http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/DDSFileReference/ddsfileformat.asp
1505# From: Morten Hustveit <morten@debian.org>
1506# Updated by: David Korth <gerbilsoft@gerbilsoft.com>
15070	string/b	DDS\040\174\000\000\000 Microsoft DirectDraw Surface (DDS):
1508>0	use	ms-directdraw-surface
1509
1510# Type: Sega PVR image.
1511# From: David Korth <gerbilsoft@gerbilsoft.com>
1512# References:
1513# - http://fabiensanglard.net/Mykaruga/tools/segaPVRFormat.txt
1514# - https://github.com/yazgoo/pvrx2png
1515# - https://github.com/nickworonekin/puyotools
1516
1517# Sega PVR header.
15180	name	sega-pvr-image-header
1519>0x0C	leshort	x	%u x
1520>0x0E	leshort	x	%u
1521# Image format.
1522>0x08	byte	0	\b, ARGB1555
1523>0x08	byte	1	\b, RGB565
1524>0x08	byte	2	\b, ARGB4444
1525>0x08	byte	3	\b, YUV442
1526>0x08	byte	4	\b, Bump
1527>0x08	byte	5	\b, 4bpp
1528>0x08	byte	6	\b, 8bpp
1529# Image data type.
1530>0x09	byte	0x01	\b, square twiddled
1531>0x09	byte	0x02	\b, square twiddled & mipmap
1532>0x09	byte	0x03	\b, VQ
1533>0x09	byte	0x04	\b, VQ & mipmap
1534>0x09	byte	0x05	\b, 8-bit CLUT twiddled
1535>0x09	byte	0x06	\b, 4-bit CLUT twiddled
1536>0x09	byte	0x07	\b, 8-bit direct twiddled
1537>0x09	byte	0x08	\b, 4-bit direct twiddled
1538>0x09	byte	0x09	\b, rectangle
1539>0x09	byte	0x0B	\b, rectangular stride
1540>0x09	byte	0x0D	\b, rectangular twiddled
1541>0x09	byte	0x10	\b, small VQ
1542>0x09	byte	0x11	\b, small VQ & mipmap
1543>0x09	byte	0x12	\b, square twiddled & mipmap
1544
1545# Sega PVR image.
15460	string	PVRT
1547>0x10	string	DDS\040\174\000\000\000 Sega PVR (Xbox) image:
1548>>0x20	use	ms-directdraw-surface
1549>0x10	belong	!0x44445320		Sega PVR image:
1550>>0	use	sega-pvr-image-header
1551
1552# Sega PVR image with GBIX.
15530	string	GBIX
1554>0x10	string	PVRT
1555>>0x10	string	DDS\040\174\000\000\000 Sega PVR (Xbox) image:
1556>>0x20	use	ms-directdraw-surface
1557>>0x10	belong	!0x44445320		Sega PVR image:
1558>>>0x10	use	sega-pvr-image-header
1559>>0x08	lelong	x	\b, global index = %u
1560
1561# Sega GVR header.
15620	name	sega-gvr-image-header
1563>0x0C	beshort	x	%u x
1564>0x0E	beshort	x	%u
1565# Image data format.
1566>0x0B	byte	0	\b, I4
1567>0x0B	byte	1	\b, I8
1568>0x0B	byte	2	\b, IA4
1569>0x0B	byte	3	\b, IA8
1570>0x0B	byte	4	\b, RGB565
1571>0x0B	byte	5	\b, RGB5A3
1572>0x0B	byte	6	\b, ARGB8888
1573>0x0B	byte	8	\b, CI4
1574>0x0B	byte	9	\b, CI8
1575>0x0B	byte	14	\b, DXT1
1576
1577# Sega GVR image.
15780	string	GVRT	Sega GVR image:
1579>0x10	use	sega-gvr-image-header
1580
1581# Sega GVR image with GBIX.
15820	string	GBIX
1583>0x10	string	GVRT	Sega GVR image:
1584>>0x10	use	sega-gvr-image-header
1585>>0x08	belong	x	\b, global index = %u
1586
1587# Sega GVR image with GCIX. (Wii)
15880	string	GCIX
1589>0x10	string	GVRT	Sega GVR image:
1590>>0x10	use	sega-gvr-image-header
1591>>0x08	belong	x	\b, global index = %u
1592
1593# Light Field Picture
1594# Documentation: http://optics.miloush.net/lytro/TheFileFormat.aspx
1595# Typical file extensions: .lfp .lfr .lfx
1596
15970	belong	0x894C4650
1598>4	belong	0x0D0A1A0A
1599>12	belong	0x00000000	Lytro Light Field Picture
1600>8	belong	x		\b, version %d
1601
1602# Type: Vision Research Phantom CINE Format
1603# URL: https://www.phantomhighspeed.com/
1604# URL2: http://phantomhighspeed.force.com/vriknowledge/servlet/fileField?id=0BEU0000000Cfyk
1605# From: Harry Mallon <hjmallon at gmail.com>
1606#
1607# This has a short "CI" code but the 44 is the size of the struct which is
1608# stable
16090	string	CI
1610>2	leshort 44		Vision Research CINE Video,
1611>>4	leshort	0		Grayscale,
1612>>4	leshort 1		JPEG Compressed,
1613>>4	leshort 2		RAW,
1614>>6	leshort x		version %d,
1615>>20	lelong	x		%d frames,
1616>>48	lelong	x		%dx
1617>>52	lelong	x		\b%d
1618
1619# Type: ARRI Raw Image
1620# Info: SMPTE RDD30:2014
1621# From: Harry Mallon <hjmallon at gmail.com>
16220	string ARRI		ARRI ARI image data,
1623>4	lelong 0x78563412	little-endian,
1624>4 	lelong 0x12345678	big-endian,
1625>12	lelong x		version %d,
1626>20	lelong x 		%dx
1627>24	lelong x		\b%d
1628
1629# Type: Khronos KTX texture.
1630# From: David Korth <gerbilsoft@gerbilsoft.com>
1631# References:
1632# - https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
1633
1634# glEnum decoding.
1635# NOTE: Only the most common formats are listed here.
16360	name	khronos-ktx-glEnum
1637>0	lelong	0x1907	\b, RGB
1638>0	lelong	0x1908	\b, RGBA
1639>0	lelong	0x1909	\b, LUMINANCE
1640>0	lelong	0x190A	\b, LUMINANCE_ALPHA
1641>0	lelong	0x80E1	\b, BGR
1642>0	lelong	0x80E2	\b, BGRA
1643>0	lelong	0x83A0	\b, RGB_S3TC
1644>0	lelong	0x83A1	\b, RGB4_S3TC
1645>0	lelong	0x83A2	\b, RGBA_S3TC
1646>0	lelong	0x83A3	\b, RGBA4_S3TC
1647>0	lelong	0x83A4	\b, RGBA_DXT5_S3TC
1648>0	lelong	0x83A5	\b, RGBA4_DXT5_S3TC
1649>0	lelong	0x8D64	\b, ETC1_RGB8_OES
1650>0	lelong	0x9270	\b, COMPRESSED_R11_EAC
1651>0	lelong	0x9271	\b, COMPRESSED_SIGNED_R11_EAC
1652>0	lelong	0x9272	\b, COMPRESSED_RG11_EAC
1653>0	lelong	0x9273	\b, COMPRESSED_SIGNED_RG11_EAC
1654>0	lelong	0x9274	\b, COMPRESSED_RGB8_ETC2
1655>0	lelong	0x9275	\b, COMPRESSED_SRGB8_ETC2
1656>0	lelong	0x9276	\b, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
1657>0	lelong	0x9277	\b, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
1658>0	lelong	0x9278	\b, COMPRESSED_RGBA2_ETC2_EAC
1659>0	lelong	0x9279	\b, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
1660>0	lelong	0x93B0	\b, COMPRESSED_RGBA_ASTC_4x4_KHR
1661>0	lelong	0x93B1	\b, COMPRESSED_RGBA_ASTC_5x4_KHR
1662>0	lelong	0x93B2	\b, COMPRESSED_RGBA_ASTC_5x5_KHR
1663>0	lelong	0x93B3	\b, COMPRESSED_RGBA_ASTC_6x5_KHR
1664>0	lelong	0x93B4	\b, COMPRESSED_RGBA_ASTC_6x6_KHR
1665>0	lelong	0x93B5	\b, COMPRESSED_RGBA_ASTC_8x5_KHR
1666>0	lelong	0x93B6	\b, COMPRESSED_RGBA_ASTC_8x6_KHR
1667>0	lelong	0x93B7	\b, COMPRESSED_RGBA_ASTC_8x8_KHR
1668>0	lelong	0x93B8	\b, COMPRESSED_RGBA_ASTC_10x5_KHR
1669>0	lelong	0x93B9	\b, COMPRESSED_RGBA_ASTC_10x6_KHR
1670>0	lelong	0x93BA	\b, COMPRESSED_RGBA_ASTC_10x8_KHR
1671>0	lelong	0x93BB	\b, COMPRESSED_RGBA_ASTC_10x10_KHR
1672>0	lelong	0x93BC	\b, COMPRESSED_RGBA_ASTC_12x10_KHR
1673>0	lelong	0x93BD	\b, COMPRESSED_RGBA_ASTC_12x12_KHR
1674>0	lelong	0x93D0	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
1675>0	lelong	0x93D1	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
1676>0	lelong	0x93D2	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
1677>0	lelong	0x93D3	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
1678>0	lelong	0x93D4	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
1679>0	lelong	0x93D5	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
1680>0	lelong	0x93D6	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
1681>0	lelong	0x93D7	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
1682>0	lelong	0x93D8	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
1683>0	lelong	0x93D9	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
1684>0	lelong	0x93DA	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
1685>0	lelong	0x93DB	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
1686>0	lelong	0x93DC	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
1687>0	lelong	0x93DD	\b, COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
1688
1689# Endian-specific KTX header.
1690# TODO: glType (all textures I've seen so far are GL_UNSIGNED_BYTE)
16910	name	khronos-ktx-endian-header
1692>20	lelong	x	\b, %u
1693>24	lelong	>1	x %u
1694>28	lelong	>1	x %u
1695>8	lelong	>0
1696>>8	use	khronos-ktx-glEnum
1697>8	lelong	0
1698>>12	use	khronos-ktx-glEnum
1699
1700# Main KTX header.
1701# Determine endianness, then check the rest of the header.
17020	string	\xABKTX\ 11\xBB\r\n\x1A\n	Khronos KTX texture
1703>12	lelong	0x04030201			(little-endian)
1704>>16	use	khronos-ktx-endian-header
1705>12	belong	0x04030201			(big-endian)
1706>>16	use	^khronos-ktx-endian-header
1707
1708# Type: Valve VTF texture.
1709# From: David Korth <gerbilsoft@gerbilsoft.com>
1710# References:
1711# - https://developer.valvesoftware.com/wiki/Valve_Texture_Format
1712
1713# VTF image formats.
17140	name	vtf-image-format
1715>0	lelong	0	RGBA8888
1716>0	lelong	1	ABGR8888
1717>0	lelong	2	RGB888
1718>0	lelong	3	BGR888
1719>0	lelong	4	RGB565
1720>0	lelong	5	I8
1721>0	lelong	6	IA88
1722>0	lelong	7	P8
1723>0	lelong	8	A8
1724>0	lelong	9	RGB888 (bluescreen)
1725>0	lelong	10	BGR888 (bluescreen)
1726>0	lelong	11	ARGB8888
1727>0	lelong	12	BGRA8888
1728>0	lelong	13	DXT1
1729>0	lelong	14	DXT3
1730>0	lelong	15	DXT5
1731>0	lelong	16	BGRx8888
1732>0	lelong	17	BGR565
1733>0	lelong	18	BGRx5551
1734>0	lelong	19	BGRA4444
1735>0	lelong	20	DXT1+A1
1736>0	lelong	21	BGRA5551
1737>0	lelong	22	UV88
1738>0	lelong	23	UVWQ8888
1739>0	lelong	24	RGBA16161616F
1740>0	lelong	25	RGBA16161616
1741>0	lelong	26	UVLX8888
1742
1743# Main VTF header.
17440	string	VTF\0				Valve Texture Format
1745>4	lelong	x				v%u
1746>8	lelong	x				\b.%u
1747>0x10	leshort	x				\b, %u
1748>0x12	leshort	>1				x %u
1749>4	lequad	0x0000000700000002
1750>>0x3F	leshort	>1				x %u
1751>0x18	leshort	>1				\b, %u frames
1752>0x38	byte	x				\b, mipmaps: %u
1753>0x34	lelong	>-1				\b,
1754>>0x34	use	vtf-image-format
1755
1756# Type: Valve VTF3 (PS3) texture.
1757# From: David Korth <gerbilsoft@gerbilsoft.com>
17580	string		VTF3	Valve Texture Format (PS3)
1759>0x14	beshort		x	\b, %u
1760>0x16	beshort		x	\b x %u
1761>0x10	belong&0x2000	0	\b, DXT1
1762>0x10	belong&0x2000	0x2000	\b, DXT5
1763
1764# Type: ASTC texture.
1765# From: David Korth <gerbilsoft@gerbilsoft.com>
1766# References:
1767# - https://stackoverflow.com/questions/22600678/determine-internal-format-of-given-astc-compressed-image-through-its-header
1768# - https://stackoverflow.com/a/22682244
17690	lelong	0x5ca1ab13			ASTC
1770>4	byte	x				%u
1771>5	byte	x				\bx%u
1772>6	byte	>1				\bx%u
1773# X, Y, and Z dimensions are stored as 24-bit LE.
1774# Pretend it's 32-bit and mask off the high byte.
1775>7	lelong&0x00FFFFFF	x		texture, %u
1776>10	lelong&0x00FFFFFF	x		x %u
1777>13	lelong&0x00FFFFFF	>1		x %u
1778
1779# Zebra Metafile graphic
1780# http://www.fileformat.info/format/zbr/egff.htm
17810	beshort	0x9a02	Zebra Metafile graphic
1782>2	leshort 1	(version 1.x)
1783>2	leshort	2	(version 1.1x or 1.2x)
1784>2	leshort	3	(version 1.49)
1785>2	leshort	4	(version 1.50)
1786>4	string	x	(comment = %s)
1787
1788# Microsoft Paint graphic
1789# http://www.fileformat.info/format/mspaint/egff.htm
17900	string	DanM 	icrosoft Paint image data (version 1.x)
1791>4	leshort	x	(%d
1792>>6	leshort	x	x %d)
17930	string	LinS 	Microsoft Paint image data (version 2.0)
1794>4	leshort	x	(%d
1795>>6	leshort	x	x %d)
1796