images 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467
  1. #------------------------------------------------------------------------------
  2. # $File: images,v 1.121 2016/12/01 16:20:13 christos Exp $
  3. # images: file(1) magic for image formats (see also "iff", and "c-lang" for
  4. # XPM bitmaps)
  5. #
  6. # originally from jef@helios.ee.lbl.gov (Jef Poskanzer),
  7. # additions by janl@ifi.uio.no as well as others. Jan also suggested
  8. # merging several one- and two-line files into here.
  9. #
  10. # little magic: PCX (first byte is 0x0a)
  11. # Targa - matches `povray', `ppmtotga' and `xv' outputs
  12. # by Philippe De Muyter <phdm@macqel.be>
  13. # URL: http://justsolve.archiveteam.org/wiki/TGA
  14. # Reference: http://www.dca.fee.unicamp.br/~martino/disciplinas/ea978/tgaffs.pdf
  15. # Update: Joerg Jenderek
  16. # at 2, byte ImgType must be 1, 2, 3, 9, 10 or 11
  17. # ,32 or 33 (both not observed)
  18. # at 1, byte CoMapType must be 1 if ImgType is 1 or 9, 0 otherwise
  19. # or theoretically 2-128 reserved for use by Truevision or 128-255 may be used for developer applications
  20. # at 3, leshort Index is 0 for povray, ppmtotga and xv outputs
  21. # `xv' recognizes only a subset of the following (RGB with pixelsize = 24)
  22. # `tgatoppm' recognizes a superset (Index may be anything)
  23. #
  24. # test of Color Map Type 0~no 1~color map
  25. # and Image Type 1 2 3 9 10 11 32 33
  26. # and Color Map Entry Size 0 15 16 24 32
  27. 0 ubequad&0x00FeC400000000C0 0
  28. # skip more garbage by looking for positive image type
  29. >2 ubyte >0
  30. # skip some compiled terminfo by looking for image type less equal 33
  31. >>2 ubyte <34
  32. # skip arches.3200 , Finder.Root , Slp.1 by looking for low pixel sizes 15 16 24 32
  33. >>>16 ubyte <33
  34. # skip more by looking for pixel size 0Fh 10h 18h 20h
  35. >>>>16 ubyte&0xC0 0x00
  36. # skip 260-16.ico by looking for no color map
  37. >>>>>1 ubyte 0
  38. # implies no first map entry
  39. >>>>>>3 uleshort 0
  40. >>>>>>>0 use tga-image
  41. # Color Map
  42. >>>>>1 belong&0xfff7ffff 0x01010000
  43. >>>>>>0 use tga-image
  44. >>>>>1 belong&0xfff7ffff 0x00020000
  45. >>>>>>0 use tga-image
  46. >>>>>1 belong&0xfff7ffff 0x00030000
  47. >>>>>>0 use tga-image
  48. # display tga bitmap image information
  49. 0 name tga-image
  50. >2 ubyte <34 Targa image data
  51. !:mime image/x-tga
  52. !:apple ????TPIC
  53. # normal extension .tga but some Truevision products used others:
  54. # tpic (Apple),icb (Image Capture Board),vda (Video Display Adapter),vst (NuVista),win (UNSURE about that)
  55. !:ext tga/tpic/icb/vda/vst
  56. # image type 1 2 3 9 10 11 32 33
  57. >2 ubyte&0xF7 1 - Map
  58. >2 ubyte&0xF7 2 - RGB
  59. # alpha channel
  60. >>17 ubyte&0x0F >0 \bA
  61. >2 ubyte&0xF7 3 - Mono
  62. # type not found, but by http://www.fileformat.info/format/tga/corion.htm
  63. # Compressed color-mapped data, using Huffman, Delta, and runlength encoding
  64. >2 ubyte 32 - Color
  65. # Compressed color-mapped data, using Huffman, Delta, and RLE. 4-pass quadtree- type process
  66. >2 ubyte 33 - Color
  67. # Color Map Type 0~no 1~color map
  68. >1 ubyte 1 (
  69. # first color map entry, 0 normal
  70. >>3 uleshort >0 \b%d-
  71. # color map length 0 2 1dh 3bh d9h 100h
  72. >>5 uleshort x \b%d)
  73. # 8~run length encoding bit
  74. >2 ubyte&0x08 8 - RLE
  75. # gimp can create big pictures!
  76. >12 uleshort >0 %d x
  77. >12 uleshort =0 65536 x
  78. # image height. 0 interpreted as 65536
  79. >14 uleshort >0 %d
  80. >14 uleshort =0 65536
  81. # Image Pixel Size 15 16 24 32
  82. >16 ubyte x x %d
  83. # X origin of image. 0 normal
  84. >8 uleshort >0 +%d
  85. # Y origin of image. 0 normal; positive for top
  86. >10 uleshort >0 +%d
  87. # Image descriptor: bits 3-0 give the alpha channel depth, bits 5-4 give direction
  88. >17 ubyte&0x0F >0 - %d-bit alpha
  89. # bits 5-4 give direction. normal bottom left
  90. >17 ubyte &0x20 - top
  91. #>17 ubyte ^0x20 - bottom
  92. >17 ubyte &0x10 - right
  93. #>17 ubyte ^0x10 - left
  94. # some info say other bits 6-7 should be zero
  95. # but data storage interleave by http://www.fileformat.info/format/tga/corion.htm
  96. # 00 - no interleave;01 - even/odd interleave; 10 - four way interleave; 11 - reserved
  97. #>17 ubyte&0xC0 0x00 - no interleave
  98. >17 ubyte&0xC0 0x40 - interleave
  99. >17 ubyte&0xC0 0x80 - four way interleave
  100. >17 ubyte&0xC0 0xC0 - reserved
  101. # positive length implies identification field
  102. >0 ubyte >0
  103. >>18 string x "%s"
  104. # last 18 bytes of newer tga file footer signature
  105. >18 search/4261301/s TRUEVISION-XFILE.\0
  106. # extension area offset if not 0
  107. >>&-8 ulelong >0
  108. # length of the extension area. normal 495 for version 2.0
  109. >>>(&-4.l) uleshort 0x01EF
  110. # AuthorName[41]
  111. >>>>&0 string >\0 - author "%-.40s"
  112. # Comment[324]=4 * 80 null terminated
  113. >>>>&41 string >\0 - comment "%-.80s"
  114. # date
  115. >>>>&365 ubequad&0xffffFFFFffff0000 !0
  116. # Day
  117. >>>>>&-6 uleshort x %d
  118. # Month
  119. >>>>>&-8 uleshort x \b-%d
  120. # Year
  121. >>>>>&-4 uleshort x \b-%d
  122. # time
  123. >>>>&371 ubequad&0xffffFFFFffff0000 !0
  124. # hour
  125. >>>>>&-8 uleshort x %d
  126. # minutes
  127. >>>>>&-6 uleshort x \b:%.2d
  128. # second
  129. >>>>>&-4 uleshort x \b:%.2d
  130. # JobName[41]
  131. >>>>&377 string >\0 - job "%-.40s"
  132. # JobHour Jobminute Jobsecond
  133. >>>>&418 ubequad&0xffffFFFFffff0000 !0
  134. >>>>>&-8 uleshort x %d
  135. >>>>>&-6 uleshort x \b:%.2d
  136. >>>>>&-4 uleshort x \b:%.2d
  137. # SoftwareId[41]
  138. >>>>&424 string >\0 - %-.40s
  139. # SoftwareVersionNumber
  140. >>>>&424 ubyte >0
  141. >>>>>&40 uleshort/100 x %d
  142. >>>>>&40 uleshort%100 x \b.%d
  143. # VersionLetter
  144. >>>>>&42 ubyte >0x20 \b%c
  145. # KeyColor
  146. >>>>&468 ulelong >0 - keycolor 0x%8.8x
  147. # Denominator of Pixel ratio. 0~no pixel aspect
  148. >>>>&474 uleshort >0
  149. # Numerator
  150. >>>>>&-4 uleshort >0 - aspect %d
  151. >>>>>&-2 uleshort x \b/%d
  152. # Denominator of Gamma ratio. 0~no Gamma value
  153. >>>>&478 uleshort >0
  154. # Numerator
  155. >>>>>&-4 uleshort >0 - gamma %d
  156. >>>>>&-2 uleshort x \b/%d
  157. # ColorOffset
  158. #>>>>&480 ulelong x - col offset 0x%8.8x
  159. # StampOffset
  160. #>>>>&484 ulelong x - stamp offset 0x%8.8x
  161. # ScanOffset
  162. #>>>>&488 ulelong x - scan offset 0x%8.8x
  163. # AttributesType
  164. #>>>>&492 ubyte x - Attributes 0x%x
  165. ## EndOfTGA
  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"
  169. 0 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. 0 search/1 P1
  174. >0 regex/4 P1\\s
  175. >>0 use netpbm
  176. >>>0 string x \b, bitmap
  177. !:strength + 45
  178. !:mime image/x-portable-bitmap
  179. 0 search/1 P2
  180. >0 regex/4 P2\\s
  181. >>0 use netpbm
  182. >>>0 string x \b, greymap
  183. !:strength + 45
  184. !:mime image/x-portable-greymap
  185. 0 search/1 P3
  186. >0 regex/4 P3\\s
  187. >>0 use netpbm
  188. >>>0 string x \b, pixmap
  189. !:strength + 45
  190. !:mime image/x-portable-pixmap
  191. 0 string P4
  192. >0 regex/4 P4\\s
  193. >>0 use netpbm
  194. >>>0 string x \b, rawbits, bitmap
  195. !:strength + 45
  196. !:mime image/x-portable-bitmap
  197. 0 string P5
  198. >0 regex/4 P5\\s
  199. >>0 use netpbm
  200. >>>0 string x \b, rawbits, greymap
  201. !:strength + 45
  202. !:mime image/x-portable-greymap
  203. 0 string P6
  204. >0 regex/4 P6\\s
  205. >>0 use netpbm
  206. >>>0 string x \b, rawbits, pixmap
  207. !:strength + 45
  208. !:mime image/x-portable-pixmap
  209. 0 string P7 Netpbm PAM image file
  210. !:mime image/x-portable-pixmap
  211. # From: bryanh@giraffe-data.com (Bryan Henderson)
  212. 0 string \117\072 Solitaire Image Recorder format
  213. >4 string \013 MGI Type 11
  214. >4 string \021 MGI Type 17
  215. 0 string .MDA MicroDesign data
  216. >21 byte 48 version 2
  217. >21 byte 51 version 3
  218. 0 string .MDP MicroDesign page data
  219. >21 byte 48 version 2
  220. >21 byte 51 version 3
  221. # NIFF (Navy Interchange File Format, a modification of TIFF) images
  222. # [GRR: this *must* go before TIFF]
  223. 0 string IIN1 NIFF image data
  224. !:mime image/x-niff
  225. # Canon RAW version 1 (CRW) files are a type of Canon Image File Format
  226. # (CIFF) file. These are apparently all little-endian.
  227. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  228. # URL: http://www.sno.phy.queensu.ca/~phil/exiftool/canon_raw.html
  229. 0 string II\x1a\0\0\0HEAPCCDR Canon CIFF raw image data
  230. !:mime image/x-canon-crw
  231. >16 leshort x \b, version %d.
  232. >14 leshort x \b%d
  233. # Canon RAW version 2 (CR2) files are a kind of TIFF with an extra magic
  234. # number. Put this above the TIFF test to make sure we detect them.
  235. # These are apparently all little-endian.
  236. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  237. # URL: http://libopenraw.freedesktop.org/wiki/Canon_CR2
  238. 0 string II\x2a\0\x10\0\0\0CR Canon CR2 raw image data
  239. !:mime image/x-canon-cr2
  240. >10 byte x \b, version %d.
  241. >11 byte x \b%d
  242. # Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
  243. # The second word of TIFF files is the TIFF version number, 42, which has
  244. # never changed. The TIFF specification recommends testing for it.
  245. 0 string MM\x00\x2a TIFF image data, big-endian
  246. !:mime image/tiff
  247. >(4.L) use \^tiff_ifd
  248. 0 string II\x2a\x00 TIFF image data, little-endian
  249. !:mime image/tiff
  250. >(4.l) use tiff_ifd
  251. 0 name tiff_ifd
  252. >0 leshort x \b, direntries=%d
  253. >2 use tiff_entry
  254. 0 name tiff_entry
  255. # NewSubFileType
  256. >0 leshort 0xfe
  257. >>12 use tiff_entry
  258. >0 leshort 0x100
  259. >>4 lelong 1
  260. >>>12 use tiff_entry
  261. >>>8 leshort x \b, width=%d
  262. >0 leshort 0x101
  263. >>4 lelong 1
  264. >>>8 leshort x \b, height=%d
  265. >>>12 use tiff_entry
  266. >0 leshort 0x102
  267. >>8 leshort x \b, bps=%d
  268. >>12 use tiff_entry
  269. >0 leshort 0x103
  270. >>4 lelong 1 \b, compression=
  271. >>>8 leshort 1 \bnone
  272. >>>8 leshort 2 \bhuffman
  273. >>>8 leshort 3 \bbi-level group 3
  274. >>>8 leshort 4 \bbi-level group 4
  275. >>>8 leshort 5 \bLZW
  276. >>>8 leshort 6 \bJPEG (old)
  277. >>>8 leshort 7 \bJPEG
  278. >>>8 leshort 8 \bdeflate
  279. >>>8 leshort 9 \bJBIG, ITU-T T.85
  280. >>>8 leshort 0xa \bJBIG, ITU-T T.43
  281. >>>8 leshort 0x7ffe \bNeXT RLE 2-bit
  282. >>>8 leshort 0x8005 \bPackBits (Macintosh RLE)
  283. >>>8 leshort 0x8029 \bThunderscan RLE
  284. >>>8 leshort 0x807f \bRasterPadding (CT or MP)
  285. >>>8 leshort 0x8080 \bRLE (Line Work)
  286. >>>8 leshort 0x8081 \bRLE (High-Res Cont-Tone)
  287. >>>8 leshort 0x8082 \bRLE (Binary Line Work)
  288. >>>8 leshort 0x80b2 \bDeflate (PKZIP)
  289. >>>8 leshort 0x80b3 \bKodak DCS
  290. >>>8 leshort 0x8765 \bJBIG
  291. >>>8 leshort 0x8798 \bJPEG2000
  292. >>>8 leshort 0x8799 \bNikon NEF Compressed
  293. >>>8 default x
  294. >>>>8 leshort x \b(unknown 0x%x)
  295. >>>12 use tiff_entry
  296. >0 leshort 0x106 \b, PhotometricIntepretation=
  297. >>8 clear x
  298. >>8 leshort 0 \bWhiteIsZero
  299. >>8 leshort 1 \bBlackIsZero
  300. >>8 leshort 2 \bRGB
  301. >>8 leshort 3 \bRGB Palette
  302. >>8 leshort 4 \bTransparency Mask
  303. >>8 leshort 5 \bCMYK
  304. >>8 leshort 6 \bYCbCr
  305. >>8 leshort 8 \bCIELab
  306. >>8 default x
  307. >>>8 leshort x \b(unknown=0x%x)
  308. >>12 use tiff_entry
  309. # FillOrder
  310. >0 leshort 0x10a
  311. >>4 lelong 1
  312. >>>12 use tiff_entry
  313. # DocumentName
  314. >0 leshort 0x10d
  315. >>(8.l) string x \b, name=%s
  316. >>>12 use tiff_entry
  317. # ImageDescription
  318. >0 leshort 0x10e
  319. >>(8.l) string x \b, description=%s
  320. >>>12 use tiff_entry
  321. # Make
  322. >0 leshort 0x10f
  323. >>(8.l) string x \b, manufacturer=%s
  324. >>>12 use tiff_entry
  325. # Model
  326. >0 leshort 0x110
  327. >>(8.l) string x \b, model=%s
  328. >>>12 use tiff_entry
  329. # StripOffsets
  330. >0 leshort 0x111
  331. >>12 use tiff_entry
  332. # Orientation
  333. >0 leshort 0x112 \b, orientation=
  334. >>8 leshort 1 \bupper-left
  335. >>8 leshort 3 \blower-right
  336. >>8 leshort 6 \bupper-right
  337. >>8 leshort 8 \blower-left
  338. >>8 leshort 9 \bundefined
  339. >>8 default x
  340. >>>8 leshort x \b[*%d*]
  341. >>12 use tiff_entry
  342. # XResolution
  343. >0 leshort 0x11a
  344. >>8 lelong x \b, xresolution=%d
  345. >>12 use tiff_entry
  346. # YResolution
  347. >0 leshort 0x11b
  348. >>8 lelong x \b, yresolution=%d
  349. >>12 use tiff_entry
  350. # ResolutionUnit
  351. >0 leshort 0x128
  352. >>8 leshort x \b, resolutionunit=%d
  353. >>12 use tiff_entry
  354. # Software
  355. >0 leshort 0x131
  356. >>(8.l) string x \b, software=%s
  357. >>12 use tiff_entry
  358. # Datetime
  359. >0 leshort 0x132
  360. >>(8.l) string x \b, datetime=%s
  361. >>12 use tiff_entry
  362. # HostComputer
  363. >0 leshort 0x13c
  364. >>(8.l) string x \b, hostcomputer=%s
  365. >>12 use tiff_entry
  366. # WhitePoint
  367. >0 leshort 0x13e
  368. >>12 use tiff_entry
  369. # PrimaryChromaticities
  370. >0 leshort 0x13f
  371. >>12 use tiff_entry
  372. # YCbCrCoefficients
  373. >0 leshort 0x211
  374. >>12 use tiff_entry
  375. # YCbCrPositioning
  376. >0 leshort 0x213
  377. >>12 use tiff_entry
  378. # ReferenceBlackWhite
  379. >0 leshort 0x214
  380. >>12 use tiff_entry
  381. # Copyright
  382. >0 leshort 0x8298
  383. >>(8.l) string x \b, copyright=%s
  384. >>12 use tiff_entry
  385. # ExifOffset
  386. >0 leshort 0x8769
  387. >>12 use tiff_entry
  388. # GPS IFD
  389. >0 leshort 0x8825 \b, GPS-Data
  390. >>12 use tiff_entry
  391. #>0 leshort x \b, unknown=0x%x
  392. #>>12 use tiff_entry
  393. 0 string MM\x00\x2b Big TIFF image data, big-endian
  394. !:mime image/tiff
  395. 0 string II\x2b\x00 Big TIFF image data, little-endian
  396. !:mime image/tiff
  397. # PNG [Portable Network Graphics, or "PNG's Not GIF"] images
  398. # (Greg Roelofs, newt@uchicago.edu)
  399. # (Albert Cahalan, acahalan@cs.uml.edu)
  400. #
  401. # 137 P N G \r \n ^Z \n [4-byte length] H E A D [HEAD data] [HEAD crc] ...
  402. #
  403. 0 string \x89PNG\x0d\x0a\x1a\x0a PNG image data
  404. !:mime image/png
  405. !:strength +10
  406. >16 belong x \b, %d x
  407. >20 belong x %d,
  408. >24 byte x %d-bit
  409. >25 byte 0 grayscale,
  410. >25 byte 2 \b/color RGB,
  411. >25 byte 3 colormap,
  412. >25 byte 4 gray+alpha,
  413. >25 byte 6 \b/color RGBA,
  414. #>26 byte 0 deflate/32K,
  415. >28 byte 0 non-interlaced
  416. >28 byte 1 interlaced
  417. # possible GIF replacements; none yet released!
  418. # (Greg Roelofs, newt@uchicago.edu)
  419. #
  420. # GRR 950115: this was mine ("Zip GIF"):
  421. 0 string GIF94z ZIF image (GIF+deflate alpha)
  422. !:mime image/x-unknown
  423. #
  424. # GRR 950115: this is Jeremy Wohl's Free Graphics Format (better):
  425. #
  426. 0 string FGF95a FGF image (GIF+deflate beta)
  427. !:mime image/x-unknown
  428. #
  429. # GRR 950115: this is Thomas Boutell's Portable Bitmap Format proposal
  430. # (best; not yet implemented):
  431. #
  432. 0 string PBF PBF image (deflate compression)
  433. !:mime image/x-unknown
  434. # GIF
  435. 0 string GIF8 GIF image data
  436. !:mime image/gif
  437. !:apple 8BIMGIFf
  438. >4 string 7a \b, version 8%s,
  439. >4 string 9a \b, version 8%s,
  440. >6 leshort >0 %d x
  441. >8 leshort >0 %d
  442. #>10 byte &0x80 color mapped,
  443. #>10 byte&0x07 =0x00 2 colors
  444. #>10 byte&0x07 =0x01 4 colors
  445. #>10 byte&0x07 =0x02 8 colors
  446. #>10 byte&0x07 =0x03 16 colors
  447. #>10 byte&0x07 =0x04 32 colors
  448. #>10 byte&0x07 =0x05 64 colors
  449. #>10 byte&0x07 =0x06 128 colors
  450. #>10 byte&0x07 =0x07 256 colors
  451. # ITC (CMU WM) raster files. It is essentially a byte-reversed Sun raster,
  452. # 1 plane, no encoding.
  453. 0 string \361\0\100\273 CMU window manager raster image data
  454. >4 lelong >0 %d x
  455. >8 lelong >0 %d,
  456. >12 lelong >0 %d-bit
  457. # Magick Image File Format
  458. 0 string id=ImageMagick MIFF image data
  459. # Artisan
  460. 0 long 1123028772 Artisan image data
  461. >4 long 1 \b, rectangular 24-bit
  462. >4 long 2 \b, rectangular 8-bit with colormap
  463. >4 long 3 \b, rectangular 32-bit (24-bit with matte)
  464. # FIG (Facility for Interactive Generation of figures), an object-based format
  465. 0 search/1 #FIG FIG image text
  466. >5 string x \b, version %.3s
  467. # PHIGS
  468. 0 string ARF_BEGARF PHIGS clear text archive
  469. 0 string @(#)SunPHIGS SunPHIGS
  470. # version number follows, in the form m.n
  471. >40 string SunBin binary
  472. >32 string archive archive
  473. # GKS (Graphics Kernel System)
  474. 0 string GKSM GKS Metafile
  475. >24 string SunGKS \b, SunGKS
  476. # CGM image files
  477. 0 string BEGMF clear text Computer Graphics Metafile
  478. # MGR bitmaps (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
  479. 0 string yz MGR bitmap, modern format, 8-bit aligned
  480. 0 string zz MGR bitmap, old format, 1-bit deep, 16-bit aligned
  481. 0 string xz MGR bitmap, old format, 1-bit deep, 32-bit aligned
  482. 0 string yx MGR bitmap, modern format, squeezed
  483. # Fuzzy Bitmap (FBM) images
  484. 0 string %bitmap\0 FBM image data
  485. >30 long 0x31 \b, mono
  486. >30 long 0x33 \b, color
  487. # facsimile data
  488. 1 string PC\ Research,\ Inc group 3 fax data
  489. >29 byte 0 \b, normal resolution (204x98 DPI)
  490. >29 byte 1 \b, fine resolution (204x196 DPI)
  491. # From: Herbert Rosmanith <herp@wildsau.idv.uni.linz.at>
  492. 0 string Sfff structured fax file
  493. # From: Joerg Jenderek <joerg.jen.der.ek@gmx.net>
  494. # most files with the extension .EPA and some with .BMP
  495. 0 string \x11\x06 Award BIOS Logo, 136 x 84
  496. !:mime image/x-award-bioslogo
  497. 0 string \x11\x09 Award BIOS Logo, 136 x 126
  498. !:mime image/x-award-bioslogo
  499. #0 string \x07\x1f BIOS Logo corrupted?
  500. # http://www.blackfiveservices.co.uk/awbmtools.shtml
  501. # http://biosgfx.narod.ru/v3/
  502. # http://biosgfx.narod.ru/abr-2/
  503. 0 string AWBM
  504. >4 leshort <1981 Award BIOS bitmap
  505. !:mime image/x-award-bmp
  506. # image width is a multiple of 4
  507. >>4 leshort&0x0003 0
  508. >>>4 leshort x \b, %d
  509. >>>6 leshort x x %d
  510. >>4 leshort&0x0003 >0 \b,
  511. >>>4 leshort&0x0003 =1
  512. >>>>4 leshort x %d+3
  513. >>>4 leshort&0x0003 =2
  514. >>>>4 leshort x %d+2
  515. >>>4 leshort&0x0003 =3
  516. >>>>4 leshort x %d+1
  517. >>>6 leshort x x %d
  518. # at offset 8 starts imagedata followed by "RGB " marker
  519. # PC bitmaps (OS/2, Windows BMP files) (Greg Roelofs, newt@uchicago.edu)
  520. # http://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.\
  521. # 28bitmap_information_header.29
  522. 0 string BM
  523. >14 leshort 12 PC bitmap, OS/2 1.x format
  524. !:mime image/x-ms-bmp
  525. >>18 leshort x \b, %d x
  526. >>20 leshort x %d
  527. >14 leshort 64 PC bitmap, OS/2 2.x format
  528. !:mime image/x-ms-bmp
  529. >>18 leshort x \b, %d x
  530. >>20 leshort x %d
  531. >14 leshort 40 PC bitmap, Windows 3.x format
  532. !:mime image/x-ms-bmp
  533. >>18 lelong x \b, %d x
  534. >>22 lelong x %d x
  535. >>28 leshort x %d
  536. >14 leshort 124 PC bitmap, Windows 98/2000 and newer format
  537. !:mime image/x-ms-bmp
  538. >>18 lelong x \b, %d x
  539. >>22 lelong x %d x
  540. >>28 leshort x %d
  541. >14 leshort 108 PC bitmap, Windows 95/NT4 and newer format
  542. !:mime image/x-ms-bmp
  543. >>18 lelong x \b, %d x
  544. >>22 lelong x %d x
  545. >>28 leshort x %d
  546. >14 leshort 128 PC bitmap, Windows NT/2000 format
  547. !:mime image/x-ms-bmp
  548. >>18 lelong x \b, %d x
  549. >>22 lelong x %d x
  550. >>28 leshort x %d
  551. # Too simple - MPi
  552. #0 string IC PC icon data
  553. #0 string PI PC pointer image data
  554. #0 string CI PC color icon data
  555. #0 string CP PC color pointer image data
  556. # Conflicts with other entries [BABYL]
  557. #0 string BA PC bitmap array data
  558. # XPM icons (Greg Roelofs, newt@uchicago.edu)
  559. 0 search/1 /*\ XPM\ */ X pixmap image text
  560. !:mime image/x-xpmi
  561. # Utah Raster Toolkit RLE images (janl@ifi.uio.no)
  562. 0 leshort 0xcc52 RLE image data,
  563. >6 leshort x %d x
  564. >8 leshort x %d
  565. >2 leshort >0 \b, lower left corner: %d
  566. >4 leshort >0 \b, lower right corner: %d
  567. >10 byte&0x1 =0x1 \b, clear first
  568. >10 byte&0x2 =0x2 \b, no background
  569. >10 byte&0x4 =0x4 \b, alpha channel
  570. >10 byte&0x8 =0x8 \b, comment
  571. >11 byte >0 \b, %d color channels
  572. >12 byte >0 \b, %d bits per pixel
  573. >13 byte >0 \b, %d color map channels
  574. # image file format (Robert Potter, potter@cs.rochester.edu)
  575. 0 string Imagefile\ version- iff image data
  576. # this adds the whole header (inc. version number), informative but longish
  577. >10 string >\0 %s
  578. # Sun raster images, from Daniel Quinlan (quinlan@yggdrasil.com)
  579. 0 belong 0x59a66a95 Sun raster image data
  580. >4 belong >0 \b, %d x
  581. >8 belong >0 %d,
  582. >12 belong >0 %d-bit,
  583. #>16 belong >0 %d bytes long,
  584. >20 belong 0 old format,
  585. #>20 belong 1 standard,
  586. >20 belong 2 compressed,
  587. >20 belong 3 RGB,
  588. >20 belong 4 TIFF,
  589. >20 belong 5 IFF,
  590. >20 belong 0xffff reserved for testing,
  591. >24 belong 0 no colormap
  592. >24 belong 1 RGB colormap
  593. >24 belong 2 raw colormap
  594. #>28 belong >0 colormap is %d bytes long
  595. # SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
  596. #
  597. # See
  598. # http://reality.sgi.com/grafica/sgiimage.html
  599. #
  600. 0 beshort 474 SGI image data
  601. #>2 byte 0 \b, verbatim
  602. >2 byte 1 \b, RLE
  603. #>3 byte 1 \b, normal precision
  604. >3 byte 2 \b, high precision
  605. >4 beshort x \b, %d-D
  606. >6 beshort x \b, %d x
  607. >8 beshort x %d
  608. >10 beshort x \b, %d channel
  609. >10 beshort !1 \bs
  610. >80 string >0 \b, "%s"
  611. 0 string IT01 FIT image data
  612. >4 belong x \b, %d x
  613. >8 belong x %d x
  614. >12 belong x %d
  615. #
  616. 0 string IT02 FIT image data
  617. >4 belong x \b, %d x
  618. >8 belong x %d x
  619. >12 belong x %d
  620. #
  621. 2048 string PCD_IPI Kodak Photo CD image pack file
  622. >0xe02 byte&0x03 0x00 , landscape mode
  623. >0xe02 byte&0x03 0x01 , portrait mode
  624. >0xe02 byte&0x03 0x02 , landscape mode
  625. >0xe02 byte&0x03 0x03 , portrait mode
  626. 0 string PCD_OPA Kodak Photo CD overview pack file
  627. # FITS format. Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
  628. # FITS is the Flexible Image Transport System, the de facto standard for
  629. # data and image transfer, storage, etc., for the astronomical community.
  630. # (FITS floating point formats are big-endian.)
  631. 0 string SIMPLE\ \ = FITS image data
  632. >109 string 8 \b, 8-bit, character or unsigned binary integer
  633. >108 string 16 \b, 16-bit, two's complement binary integer
  634. >107 string \ 32 \b, 32-bit, two's complement binary integer
  635. >107 string -32 \b, 32-bit, floating point, single precision
  636. >107 string -64 \b, 64-bit, floating point, double precision
  637. # other images
  638. 0 string This\ is\ a\ BitMap\ file Lisp Machine bit-array-file
  639. # From SunOS 5.5.1 "/etc/magic" - appeared right before Sun raster image
  640. # stuff.
  641. #
  642. 0 beshort 0x1010 PEX Binary Archive
  643. # DICOM medical imaging data
  644. # URL: https://en.wikipedia.org/wiki/DICOM#Data_format
  645. # Note: "dcm" is the official file name extension
  646. # XnView mention also "dc3" and "acr" as file name extension
  647. 128 string DICM DICOM medical imaging data
  648. !:mime application/dicom
  649. !:ext dcm/dicom/dic
  650. # XWD - X Window Dump file.
  651. # As described in /usr/X11R6/include/X11/XWDFile.h
  652. # used by the xwd program.
  653. # Bradford Castalia, idaeim, 1/01
  654. # updated by Adam Buchbinder, 2/09
  655. # The following assumes version 7 of the format; the first long is the length
  656. # of the header, which is at least 25 4-byte longs, and the one at offset 8
  657. # is a constant which is always either 1 or 2. Offset 12 is the pixmap depth,
  658. # which is a maximum of 32.
  659. 0 belong >100
  660. >8 belong <3
  661. >>12 belong <33
  662. >>>4 belong 7 XWD X Window Dump image data
  663. !:mime image/x-xwindowdump
  664. >>>>100 string >\0 \b, "%s"
  665. >>>>16 belong x \b, %dx
  666. >>>>20 belong x \b%dx
  667. >>>>12 belong x \b%d
  668. # PDS - Planetary Data System
  669. # These files use Parameter Value Language in the header section.
  670. # Unfortunately, there is no certain magic, but the following
  671. # strings have been found to be most likely.
  672. 0 string NJPL1I00 PDS (JPL) image data
  673. 2 string NJPL1I PDS (JPL) image data
  674. 0 string CCSD3ZF PDS (CCSD) image data
  675. 2 string CCSD3Z PDS (CCSD) image data
  676. 0 string PDS_ PDS image data
  677. 0 string LBLSIZE= PDS (VICAR) image data
  678. # pM8x: ATARI STAD compressed bitmap format
  679. #
  680. # from Oskar Schirmer <schirmer@scara.com> Feb 2, 2001
  681. # p M 8 5/6 xx yy zz data...
  682. # Atari ST STAD bitmap is always 640x400, bytewise runlength compressed.
  683. # bytes either run horizontally (pM85) or vertically (pM86). yy is the
  684. # most frequent byte, xx and zz are runlength escape codes, where xx is
  685. # used for runs of yy.
  686. #
  687. 0 string pM85 Atari ST STAD bitmap image data (hor)
  688. >5 byte 0x00 (white background)
  689. >5 byte 0xFF (black background)
  690. 0 string pM86 Atari ST STAD bitmap image data (vert)
  691. >5 byte 0x00 (white background)
  692. >5 byte 0xFF (black background)
  693. # Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
  694. # http://www.atarimax.com/jindroush.atari.org/afmtatr.html
  695. 0 leshort 0x0296 Atari ATR image
  696. # XXX:
  697. # This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
  698. # magic.
  699. # SGI RICE image file <mpruett@sgi.com>
  700. #0 beshort 0x5249 RICE image
  701. #>2 beshort x v%d
  702. #>4 beshort x (%d x
  703. #>6 beshort x %d)
  704. #>8 beshort 0 8 bit
  705. #>8 beshort 1 10 bit
  706. #>8 beshort 2 12 bit
  707. #>8 beshort 3 13 bit
  708. #>10 beshort 0 4:2:2
  709. #>10 beshort 1 4:2:2:4
  710. #>10 beshort 2 4:4:4
  711. #>10 beshort 3 4:4:4:4
  712. #>12 beshort 1 RGB
  713. #>12 beshort 2 CCIR601
  714. #>12 beshort 3 RP175
  715. #>12 beshort 4 YUV
  716. # PCX image files
  717. # From: Dan Fandrich <dan@coneharvesters.com>
  718. # updated by Joerg Jenderek at Feb 2013 by http://de.wikipedia.org/wiki/PCX
  719. # http://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
  720. # GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
  721. # 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
  722. 0 ubelong&0xffF8fe00 0x0a000000
  723. # for PCX bit depth > 0
  724. >3 ubyte >0
  725. # test for valid versions
  726. >>1 ubyte <6
  727. >>>1 ubyte !1 PCX
  728. !:mime image/x-pcx
  729. #!:mime image/pcx
  730. >>>>1 ubyte 0 ver. 2.5 image data
  731. >>>>1 ubyte 2 ver. 2.8 image data, with palette
  732. >>>>1 ubyte 3 ver. 2.8 image data, without palette
  733. >>>>1 ubyte 4 for Windows image data
  734. >>>>1 ubyte 5 ver. 3.0 image data
  735. >>>>4 uleshort x bounding box [%d,
  736. >>>>6 uleshort x %d] -
  737. >>>>8 uleshort x [%d,
  738. >>>>10 uleshort x %d],
  739. >>>>65 ubyte >1 %d planes each of
  740. >>>>3 ubyte x %d-bit
  741. >>>>68 byte 1 colour,
  742. >>>>68 byte 2 grayscale,
  743. # this should not happen
  744. >>>>68 default x image,
  745. >>>>12 leshort >0 %d x
  746. >>>>>14 uleshort x %d dpi,
  747. >>>>2 byte 0 uncompressed
  748. >>>>2 byte 1 RLE compressed
  749. # Adobe Photoshop
  750. # From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
  751. 0 string 8BPS Adobe Photoshop Image
  752. !:mime image/vnd.adobe.photoshop
  753. >4 beshort 2 (PSB)
  754. >18 belong x \b, %d x
  755. >14 belong x %d,
  756. >24 beshort 0 bitmap
  757. >24 beshort 1 grayscale
  758. >>12 beshort 2 with alpha
  759. >24 beshort 2 indexed
  760. >24 beshort 3 RGB
  761. >>12 beshort 4 \bA
  762. >24 beshort 4 CMYK
  763. >>12 beshort 5 \bA
  764. >24 beshort 7 multichannel
  765. >24 beshort 8 duotone
  766. >24 beshort 9 lab
  767. >12 beshort > 1
  768. >>12 beshort x \b, %dx
  769. >12 beshort 1 \b,
  770. >22 beshort x %d-bit channel
  771. >12 beshort > 1 \bs
  772. # XV thumbnail indicator (ThMO)
  773. 0 string P7\ 332 XV thumbnail image data
  774. # NITF is defined by United States MIL-STD-2500A
  775. 0 string NITF National Imagery Transmission Format
  776. >25 string >\0 dated %.14s
  777. # GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
  778. # Format variations from: Bernd Nuernberger <bernd.nuernberger@web.de>
  779. # Update: Joerg Jenderek
  780. # See http://fileformats.archiveteam.org/wiki/GEM_Raster
  781. # For variations, also see:
  782. # http://www.seasip.info/Gem/ff_img.html (Ventura)
  783. # http://www.atari-wiki.com/?title=IMG_file (XIMG, STTT)
  784. # http://www.fileformat.info/format/gemraster/spec/index.htm (XIMG, STTT)
  785. # http://sylvana.net/1stguide/1STGUIDE.ENG (TIMG)
  786. 0 beshort 0x0001
  787. # header_size
  788. >2 beshort 0x0008
  789. >>0 use gem_info
  790. >2 beshort 0x0009
  791. >>0 use gem_info
  792. # no example for NOSIG
  793. >2 beshort 24
  794. >>0 use gem_info
  795. # no example for HYPERPAINT
  796. >2 beshort 25
  797. >>0 use gem_info
  798. 16 string XIMG\0
  799. >0 use gem_info
  800. # no example
  801. 16 string STTT\0\x10
  802. >0 use gem_info
  803. # no example or description
  804. 16 string TIMG\0
  805. >0 use gem_info
  806. 0 name gem_info
  807. # version is 2 for some XIMG and 1 for all others
  808. >0 beshort <0x0003 GEM
  809. # http://www.snowstone.org.uk/riscos/mimeman/mimemap.txt
  810. !:mime image/x-gem
  811. # header_size 24 25 27 59 779 words for colored bitmaps
  812. >>2 beshort >9
  813. >>>16 string STTT\0\x10 STTT
  814. >>>16 string TIMG\0 TIMG
  815. # HYPERPAINT or NOSIG variant
  816. >>>16 string \0\x80
  817. >>>>2 beshort =24 NOSIG
  818. >>>>2 beshort !24 HYPERPAINT
  819. # NOSIG or XIMG variant
  820. >>>16 default x
  821. >>>>16 string !XIMG\0 NOSIG
  822. >>16 string =XIMG\0 XIMG Image data
  823. !:ext img/ximg
  824. # to avoid Warning: Current entry does not yet have a description for adding a EXTENSION type
  825. >>16 string !XIMG\0 Image data
  826. !:ext img
  827. # header_size is 9 for Ventura files and 8 for other GEM Paint files
  828. >>2 beshort 9 (Ventura)
  829. #>>2 beshort 8 (Paint)
  830. >>12 beshort x %d x
  831. >>14 beshort x %d,
  832. # 1 4 8
  833. >>4 beshort x %d planes,
  834. # in tenths of a millimetre
  835. >>8 beshort x %d x
  836. >>10 beshort x %d pixelsize
  837. # pattern_size 1-8. 2 for GEM Paint
  838. >>6 beshort !2 \b, pattern size %d
  839. # GEM Metafile (Wolfram Kleff)
  840. 0 lelong 0x0018FFFF GEM Metafile data
  841. >4 leshort x version %d
  842. #
  843. # SMJPEG. A custom Motion JPEG format used by Loki Entertainment
  844. # Software Torbjorn Andersson <d91tan@Update.UU.SE>.
  845. #
  846. 0 string \0\nSMJPEG SMJPEG
  847. >8 belong x %d.x data
  848. # According to the specification you could find any number of _TXT
  849. # headers here, but I can't think of any way of handling that. None of
  850. # the SMJPEG files I tried it on used this feature. Even if such a
  851. # file is encountered the output should still be reasonable.
  852. >16 string _SND \b,
  853. >>24 beshort >0 %d Hz
  854. >>26 byte 8 8-bit
  855. >>26 byte 16 16-bit
  856. >>28 string NONE uncompressed
  857. # >>28 string APCM ADPCM compressed
  858. >>27 byte 1 mono
  859. >>28 byte 2 stereo
  860. # Help! Isn't there any way to avoid writing this part twice?
  861. >>32 string _VID \b,
  862. # >>>48 string JFIF JPEG
  863. >>>40 belong >0 %d frames
  864. >>>44 beshort >0 (%d x
  865. >>>46 beshort >0 %d)
  866. >16 string _VID \b,
  867. # >>32 string JFIF JPEG
  868. >>24 belong >0 %d frames
  869. >>28 beshort >0 (%d x
  870. >>30 beshort >0 %d)
  871. 0 string Paint\ Shop\ Pro\ Image\ File Paint Shop Pro Image File
  872. # "thumbnail file" (icon)
  873. # descended from "xv", but in use by other applications as well (Wolfram Kleff)
  874. 0 string P7\ 332 XV "thumbnail file" (icon) data
  875. # taken from fkiss: (<yav@mte.biglobe.ne.jp> ?)
  876. 0 string KiSS KISS/GS
  877. >4 byte 16 color
  878. >>5 byte x %d bit
  879. >>8 leshort x %d colors
  880. >>10 leshort x %d groups
  881. >4 byte 32 cell
  882. >>5 byte x %d bit
  883. >>8 leshort x %d x
  884. >>10 leshort x %d
  885. >>12 leshort x +%d
  886. >>14 leshort x +%d
  887. # Webshots (www.webshots.com), by John Harrison
  888. 0 string C\253\221g\230\0\0\0 Webshots Desktop .wbz file
  889. # Hercules DASD image files
  890. # From Jan Jaeger <jj@septa.nl>
  891. 0 string CKD_P370 Hercules CKD DASD image file
  892. >8 long x \b, %d heads per cylinder
  893. >12 long x \b, track size %d bytes
  894. >16 byte x \b, device type 33%2.2X
  895. 0 string CKD_C370 Hercules compressed CKD DASD image file
  896. >8 long x \b, %d heads per cylinder
  897. >12 long x \b, track size %d bytes
  898. >16 byte x \b, device type 33%2.2X
  899. 0 string CKD_S370 Hercules CKD DASD shadow file
  900. >8 long x \b, %d heads per cylinder
  901. >12 long x \b, track size %d bytes
  902. >16 byte x \b, device type 33%2.2X
  903. # Squeak images and programs - etoffi@softhome.net
  904. 0 string \146\031\0\0 Squeak image data
  905. 0 search/1 'From\040Squeak Squeak program text
  906. # partimage: file(1) magic for PartImage files (experimental, incomplete)
  907. # Author: Hans-Joachim Baader <hjb@pro-linux.de>
  908. 0 string PaRtImAgE-VoLuMe PartImage
  909. >0x0020 string 0.6.1 file version %s
  910. >>0x0060 lelong >-1 volume %d
  911. #>>0x0064 8 byte identifier
  912. #>>0x007c reserved
  913. >>0x0200 string >\0 type %s
  914. >>0x1400 string >\0 device %s,
  915. >>0x1600 string >\0 original filename %s,
  916. # Some fields omitted
  917. >>0x2744 lelong 0 not compressed
  918. >>0x2744 lelong 1 gzip compressed
  919. >>0x2744 lelong 2 bzip2 compressed
  920. >>0x2744 lelong >2 compressed with unknown algorithm
  921. >0x0020 string >0.6.1 file version %s
  922. >0x0020 string <0.6.1 file version %s
  923. # DCX is multi-page PCX, using a simple header of up to 1024
  924. # offsets for the respective PCX components.
  925. # From: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
  926. 0 lelong 987654321 DCX multi-page PCX image data
  927. # Simon Walton <simonw@matteworld.com>
  928. # Kodak Cineon format for scanned negatives
  929. # http://www.kodak.com/US/en/motion/support/dlad/
  930. 0 lelong 0xd75f2a80 Cineon image data
  931. >200 belong >0 \b, %d x
  932. >204 belong >0 %d
  933. # Bio-Rad .PIC is an image format used by microscope control systems
  934. # and related image processing software used by biologists.
  935. # From: Vebjorn Ljosa <vebjorn@ljosa.com>
  936. # BOOL values are two-byte integers; use them to rule out false positives.
  937. # http://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
  938. # Samples: http://www.loci.wisc.edu/software/sample-data
  939. 14 leshort <2
  940. >62 leshort <2
  941. >>54 leshort 12345 Bio-Rad .PIC Image File
  942. >>>0 leshort >0 %d x
  943. >>>2 leshort >0 %d,
  944. >>>4 leshort =1 1 image in file
  945. >>>4 leshort >1 %d images in file
  946. # From Jan "Yenya" Kasprzak <kas@fi.muni.cz>
  947. # The description of *.mrw format can be found at
  948. # http://www.dalibor.cz/minolta/raw_file_format.htm
  949. 0 string \000MRM Minolta Dimage camera raw image data
  950. # Summary: DjVu image / document
  951. # Extension: .djvu
  952. # Reference: http://djvu.org/docs/DjVu3Spec.djvu
  953. # Submitted by: Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
  954. # Modified by (1): Abel Cheung <abelcheung@gmail.com>
  955. 0 string AT&TFORM
  956. >12 string DJVM DjVu multiple page document
  957. !:mime image/vnd.djvu
  958. >12 string DJVU DjVu image or single page document
  959. !:mime image/vnd.djvu
  960. >12 string DJVI DjVu shared document
  961. !:mime image/vnd.djvu
  962. >12 string THUM DjVu page thumbnails
  963. !:mime image/vnd.djvu
  964. # Originally by Marc Espie
  965. # Modified by Robert Minsk <robertminsk at yahoo.com>
  966. # http://www.openexr.com/openexrfilelayout.pdf
  967. 0 lelong 20000630 OpenEXR image data,
  968. !:mime image/x-exr
  969. >4 lelong&0x000000ff x version %d,
  970. >4 lelong ^0x00000200 storage: scanline
  971. >4 lelong &0x00000200 storage: tiled
  972. >8 search/0x1000 compression\0 \b, compression:
  973. >>&16 byte 0 none
  974. >>&16 byte 1 rle
  975. >>&16 byte 2 zips
  976. >>&16 byte 3 zip
  977. >>&16 byte 4 piz
  978. >>&16 byte 5 pxr24
  979. >>&16 byte 6 b44
  980. >>&16 byte 7 b44a
  981. >>&16 byte >7 unknown
  982. >8 search/0x1000 dataWindow\0 \b, dataWindow:
  983. >>&10 lelong x (%d
  984. >>&14 lelong x %d)-
  985. >>&18 lelong x \b(%d
  986. >>&22 lelong x %d)
  987. >8 search/0x1000 displayWindow\0 \b, displayWindow:
  988. >>&10 lelong x (%d
  989. >>&14 lelong x %d)-
  990. >>&18 lelong x \b(%d
  991. >>&22 lelong x %d)
  992. >8 search/0x1000 lineOrder\0 \b, lineOrder:
  993. >>&14 byte 0 increasing y
  994. >>&14 byte 1 decreasing y
  995. >>&14 byte 2 random y
  996. >>&14 byte >2 unknown
  997. # SMPTE Digital Picture Exchange Format, SMPTE DPX
  998. #
  999. # ANSI/SMPTE 268M-1994, SMPTE Standard for File Format for Digital
  1000. # Moving-Picture Exchange (DPX), v1.0, 18 February 1994
  1001. # Robert Minsk <robertminsk at yahoo.com>
  1002. 0 string SDPX DPX image data, big-endian,
  1003. !:mime image/x-dpx
  1004. >768 beshort <4
  1005. >>772 belong x %dx
  1006. >>776 belong x \b%d,
  1007. >768 beshort >3
  1008. >>776 belong x %dx
  1009. >>772 belong x \b%d,
  1010. >768 beshort 0 left to right/top to bottom
  1011. >768 beshort 1 right to left/top to bottom
  1012. >768 beshort 2 left to right/bottom to top
  1013. >768 beshort 3 right to left/bottom to top
  1014. >768 beshort 4 top to bottom/left to right
  1015. >768 beshort 5 top to bottom/right to left
  1016. >768 leshort 6 bottom to top/left to right
  1017. >768 leshort 7 bottom to top/right to left
  1018. # From: Tom Hilinski <tom.hilinski@comcast.net>
  1019. # http://www.unidata.ucar.edu/packages/netcdf/
  1020. 0 string CDF\001 NetCDF Data Format data
  1021. #-----------------------------------------------------------------------
  1022. # Hierarchical Data Format, used to facilitate scientific data exchange
  1023. # specifications at http://hdf.ncsa.uiuc.edu/
  1024. 0 belong 0x0e031301 Hierarchical Data Format (version 4) data
  1025. !:mime application/x-hdf
  1026. 0 string \211HDF\r\n\032\n Hierarchical Data Format (version 5) data
  1027. !:mime application/x-hdf
  1028. 512 string \211HDF\r\n\032\n Hierarchical Data Format (version 5) with 512 bytes user block
  1029. !:mime application/x-hdf
  1030. 1024 string \211HDF\r\n\032\n Hierarchical Data Format (version 5) with 1k user block
  1031. !:mime application/x-hdf
  1032. 2048 string \211HDF\r\n\032\n Hierarchical Data Format (version 5) with 2k user block
  1033. !:mime application/x-hdf
  1034. 4096 string \211HDF\r\n\032\n Hierarchical Data Format (version 5) with 4k user block
  1035. !:mime application/x-hdf
  1036. # From: Tobias Burnus <burnus@net-b.de>
  1037. # Xara (for a while: Corel Xara) is a graphic package, see
  1038. # http://www.xara.com/ for Windows and as GPL application for Linux
  1039. 0 string XARA\243\243 Xara graphics file
  1040. # http://www.cartesianinc.com/Tech/
  1041. 0 string CPC\262 Cartesian Perceptual Compression image
  1042. !:mime image/x-cpi
  1043. # From Albert Cahalan <acahalan@gmail.com>
  1044. # puredigital used it for the CVS disposable camcorder
  1045. #8 lelong 4 ZBM bitmap image data
  1046. #>4 leshort x %u x
  1047. #>6 leshort x %u
  1048. # From Albert Cahalan <acahalan@gmail.com>
  1049. # uncompressed 5:6:5 HighColor image for OLPC XO firmware icons
  1050. 0 string C565 OLPC firmware icon image data
  1051. >4 leshort x %u x
  1052. >6 leshort x %u
  1053. # Applied Images - Image files from Cytovision
  1054. # Gustavo Junior Alves <gjalves@gjalves.com.br>
  1055. 0 string \xce\xda\xde\xfa Cytovision Metaphases file
  1056. 0 string \xed\xad\xef\xac Cytovision Karyotype file
  1057. 0 string \x0b\x00\x03\x00 Cytovision FISH Probe file
  1058. 0 string \xed\xfe\xda\xbe Cytovision FLEX file
  1059. 0 string \xed\xab\xed\xfe Cytovision FLEX file
  1060. 0 string \xad\xfd\xea\xad Cytovision RATS file
  1061. # Wavelet Scalar Quantization format used in gray-scale fingerprint images
  1062. # From Tano M Fotang <mfotang@quanteq.com>
  1063. 0 string \xff\xa0\xff\xa8\x00 Wavelet Scalar Quantization image data
  1064. # Type: PCO B16 image files
  1065. # URL: http://www.pco.de/fileadmin/user_upload/db/download/MA_CWDCOPIE_0412b.pdf
  1066. # From: Florian Philipp <florian.philipp@binarywings.net>
  1067. # Extension: .b16
  1068. # Description: Pixel image format produced by PCO Camware, typically used
  1069. # together with PCO cameras.
  1070. # Note: Different versions exist for e.g. 8 bit and 16 bit images.
  1071. # Documentation is incomplete.
  1072. 0 string/b PCO- PCO B16 image data
  1073. >12 lelong x \b, %dx
  1074. >16 lelong x \b%d
  1075. >20 lelong 0 \b, short header
  1076. >20 lelong -1 \b, extended header
  1077. >>24 lelong 0 \b, grayscale
  1078. >>>36 lelong 0 linear LUT
  1079. >>>36 lelong 1 logarithmic LUT
  1080. >>>28 lelong x [%d
  1081. >>>32 lelong x \b,%d]
  1082. >>24 lelong 1 \b, color
  1083. >>>64 lelong 0 linear LUT
  1084. >>>64 lelong 1 logarithmic LUT
  1085. >>>40 lelong x r[%d
  1086. >>>44 lelong x \b,%d]
  1087. >>>48 lelong x g[%d
  1088. >>>52 lelong x \b,%d]
  1089. >>>56 lelong x b[%d
  1090. >>>60 lelong x \b,%d]
  1091. # Polar Monitor Bitmap (.pmb) used as logo for Polar Electro watches
  1092. # From: Markus Heidelberg <markus.heidelberg at web.de>
  1093. 0 string/t [BitmapInfo2] Polar Monitor Bitmap text
  1094. !:mime image/x-polar-monitor-bitmap
  1095. # From: Rick Richardson <rickrich@gmail.com>
  1096. # updated by: Joerg Jenderek
  1097. # URL: http://techmods.net/nuvi/
  1098. 0 string GARMIN\ BITMAP\ 01 Garmin Bitmap file
  1099. # extension is also used for
  1100. # Sony SRF raw image (image/x-sony-srf)
  1101. # SRF map
  1102. # Terragen Surface Map (http://www.planetside.co.uk/terragen)
  1103. # FileLocator Pro search criteria file (http://www.mythicsoft.com/filelocatorpro)
  1104. !:ext srf
  1105. #!:mime image/x-garmin-srf
  1106. # version 1.00,2.00,2.10,2.40,2.50
  1107. >0x2f string >0 \b, version %4.4s
  1108. # width (2880,2881,3240)
  1109. >0x55 uleshort >0 \b, %dx
  1110. # height (80,90)
  1111. >>0x53 uleshort x \b%d
  1112. # Type: Ulead Photo Explorer5 (.pe5)
  1113. # URL: http://www.jisyo.com/cgibin/view.cgi?EXT=pe5 (Japanese)
  1114. # From: Simon Horman <horms@debian.org>
  1115. 0 string IIO2H Ulead Photo Explorer5
  1116. # Type: X11 cursor
  1117. # URL: http://webcvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml.in?view=markup
  1118. # From: Mathias Brodala <info@noctus.net>
  1119. 0 string Xcur X11 cursor
  1120. # Type: Olympus ORF raw images.
  1121. # URL: http://libopenraw.freedesktop.org/wiki/Olympus_ORF
  1122. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  1123. 0 string MMOR Olympus ORF raw image data, big-endian
  1124. !:mime image/x-olympus-orf
  1125. 0 string IIRO Olympus ORF raw image data, little-endian
  1126. !:mime image/x-olympus-orf
  1127. 0 string IIRS Olympus ORF raw image data, little-endian
  1128. !:mime image/x-olympus-orf
  1129. # Type: files used in modern AVCHD camcoders to store clip information
  1130. # Extension: .cpi
  1131. # From: Alexander Danilov <alexander.a.danilov@gmail.com>
  1132. 0 string HDMV0100 AVCHD Clip Information
  1133. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  1134. # URL: http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/
  1135. # Radiance HDR; usually has .pic or .hdr extension.
  1136. 0 string #?RADIANCE\n Radiance HDR image data
  1137. #!mime image/vnd.radiance
  1138. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  1139. # URL: http://www.mpi-inf.mpg.de/resources/pfstools/pfs_format_spec.pdf
  1140. # Used by the pfstools packages. The regex matches for the image size could
  1141. # probably use some work. The MIME type is made up; if there's one in
  1142. # actual common use, it should replace the one below.
  1143. 0 string PFS1\x0a PFS HDR image data
  1144. #!mime image/x-pfs
  1145. >1 regex [0-9]*\ \b, %s
  1146. >>1 regex \ [0-9]{4} \bx%s
  1147. # Type: Foveon X3F
  1148. # URL: http://www.photofo.com/downloads/x3f-raw-format.pdf
  1149. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  1150. # Note that the MIME type isn't defined anywhere that I can find; if
  1151. # there's a canonical type for this format, it should replace this one.
  1152. 0 string FOVb Foveon X3F raw image data
  1153. !:mime image/x-x3f
  1154. >6 leshort x \b, version %d.
  1155. >4 leshort x \b%d
  1156. >28 lelong x \b, %dx
  1157. >32 lelong x \b%d
  1158. # Paint.NET file
  1159. # From Adam Buchbinder <adam.buchbinder@gmail.com>
  1160. 0 string PDN3 Paint.NET image data
  1161. !:mime image/x-paintnet
  1162. # Not really an image.
  1163. # From: "Tano M. Fotang" <mfotang@quanteq.com>
  1164. 0 string \x46\x4d\x52\x00 ISO/IEC 19794-2 Format Minutiae Record (FMR)
  1165. # doc: http://www.shikino.co.jp/eng/products/images/FLOWER.jpg.zip
  1166. # example: http://www.shikino.co.jp/eng/products/images/FLOWER.wdp.zip
  1167. 90 bequad 0x574D50484F544F00 JPEG-XR Image
  1168. >98 byte&0x08 =0x08 \b, hard tiling
  1169. >99 byte&0x80 =0x80 \b, tiling present
  1170. >99 byte&0x40 =0x40 \b, codestream present
  1171. >99 byte&0x38 x \b, spatial xform=
  1172. >99 byte&0x38 0x00 \bTL
  1173. >99 byte&0x38 0x08 \bBL
  1174. >99 byte&0x38 0x10 \bTR
  1175. >99 byte&0x38 0x18 \bBR
  1176. >99 byte&0x38 0x20 \bBT
  1177. >99 byte&0x38 0x28 \bRB
  1178. >99 byte&0x38 0x30 \bLT
  1179. >99 byte&0x38 0x38 \bLB
  1180. >100 byte&0x80 =0x80 \b, short header
  1181. >>102 beshort+1 x \b, %d
  1182. >>104 beshort+1 x \bx%d
  1183. >100 byte&0x80 =0x00 \b, long header
  1184. >>102 belong+1 x \b, %x
  1185. >>106 belong+1 x \bx%x
  1186. >101 beshort&0xf x \b, bitdepth=
  1187. >>101 beshort&0xf 0x0 \b1-WHITE=1
  1188. >>101 beshort&0xf 0x1 \b8
  1189. >>101 beshort&0xf 0x2 \b16
  1190. >>101 beshort&0xf 0x3 \b16-SIGNED
  1191. >>101 beshort&0xf 0x4 \b16-FLOAT
  1192. >>101 beshort&0xf 0x5 \b(reserved 5)
  1193. >>101 beshort&0xf 0x6 \b32-SIGNED
  1194. >>101 beshort&0xf 0x7 \b32-FLOAT
  1195. >>101 beshort&0xf 0x8 \b5
  1196. >>101 beshort&0xf 0x9 \b10
  1197. >>101 beshort&0xf 0xa \b5-6-5
  1198. >>101 beshort&0xf 0xb \b(reserved %d)
  1199. >>101 beshort&0xf 0xc \b(reserved %d)
  1200. >>101 beshort&0xf 0xd \b(reserved %d)
  1201. >>101 beshort&0xf 0xe \b(reserved %d)
  1202. >>101 beshort&0xf 0xf \b1-BLACK=1
  1203. >101 beshort&0xf0 x \b, colorfmt=
  1204. >>101 beshort&0xf0 0x00 \bYONLY
  1205. >>101 beshort&0xf0 0x10 \bYUV240
  1206. >>101 beshort&0xf0 0x20 \bYWV422
  1207. >>101 beshort&0xf0 0x30 \bYWV444
  1208. >>101 beshort&0xf0 0x40 \bCMYK
  1209. >>101 beshort&0xf0 0x50 \bCMYKDIRECT
  1210. >>101 beshort&0xf0 0x60 \bNCOMPONENT
  1211. >>101 beshort&0xf0 0x70 \bRGB
  1212. >>101 beshort&0xf0 0x80 \bRGBE
  1213. >>101 beshort&0xf0 >0x80 \b(reserved 0x%x)
  1214. # From: Johan van der Knijff <johan.vanderknijff@kb.nl>
  1215. #
  1216. # BPG (Better Portable Graphics) format
  1217. # http://bellard.org/bpg/
  1218. # http://fileformats.archiveteam.org/wiki/BPG
  1219. #
  1220. 0 string \x42\x50\x47\xFB BPG (Better Portable Graphics)
  1221. !:mime image/bpg
  1222. # From: Joerg Jenderek
  1223. # URL: https://en.wikipedia.org/wiki/Apple_Icon_Image_format
  1224. 0 string icns Mac OS X icon
  1225. !:mime image/x-icns
  1226. !:apple ????icns
  1227. !:ext icns
  1228. >4 ubelong >0
  1229. # file size
  1230. >>4 ubelong x \b, %d bytes
  1231. # icon type
  1232. >>8 string x \b, "%4.4s" type
  1233. # TIM images
  1234. 0 lelong 0x00000010 TIM image,
  1235. >4 lelong 0x8 4-Bit,
  1236. >4 lelong 0x9 8-Bit,
  1237. >4 lelong 0x2 15-Bit,
  1238. >4 lelong 0x3 24-Bit,
  1239. >4 lelong &8
  1240. >>(8.l+12) leshort x Pixel at (%d,
  1241. >>(8.l+14) leshort x \b%d)
  1242. >>(8.l+16) leshort x Size=%dx
  1243. >>(8.l+18) leshort x \b%d,
  1244. >>4 lelong 0x8 16 CLUT Entries at
  1245. >>4 lelong 0x9 256 CLUT Entries at
  1246. >>12 leshort x (%d,
  1247. >>14 leshort x \b%d)
  1248. >4 lelong ^8
  1249. >>12 leshort x Pixel at (%d,
  1250. >>14 leshort x \b%d)
  1251. >>16 leshort x Size=%dx
  1252. >>18 leshort x \b%d
  1253. # MDEC streams
  1254. 0 lelong 0x80010160 MDEC video stream,
  1255. >16 leshort x %dx
  1256. >18 leshort x \b%d
  1257. #>8 lelong x %d frames
  1258. #>4 leshort x secCount=%d;
  1259. #>6 leshort x nSectors=%d;
  1260. #>12 lelong x frameSize=%d;
  1261. # BS encoded bitstreams
  1262. 2 leshort 0x3800 BS image,
  1263. >6 leshort x Version %d,
  1264. >4 leshort x Quantization %d,
  1265. >0 leshort x (Decompresses to %d words)
  1266. # Type: farbfeld image.
  1267. # Url: http://tools.suckless.org/farbfeld/
  1268. # From: Ian D. Scott <ian@iandouglasscott.com>
  1269. #
  1270. 0 string farbfeld farbfeld image data,
  1271. >8 ubelong x %dx
  1272. >12 ubelong x \b%d
  1273. # Type: Sega PVR image.
  1274. # From: David Korth <gerbilsoft@gerbilsoft.com>
  1275. # References:
  1276. # - http://fabiensanglard.net/Mykaruga/tools/segaPVRFormat.txt
  1277. # - https://github.com/yazgoo/pvrx2png
  1278. # - https://github.com/nickworonekin/puyotools
  1279. # Sega PVR header.
  1280. 0 name sega-pvr-image-header
  1281. >0x0C leshort x %d x
  1282. >0x0E leshort x %d
  1283. # Image format.
  1284. >0x08 byte 0 \b, ARGB1555
  1285. >0x08 byte 1 \b, RGB565
  1286. >0x08 byte 2 \b, ARGB4444
  1287. >0x08 byte 3 \b, YUV442
  1288. >0x08 byte 4 \b, Bump
  1289. >0x08 byte 5 \b, 4bpp
  1290. >0x08 byte 6 \b, 8bpp
  1291. # Image data type.
  1292. >0x09 byte 0x01 \b, square twiddled
  1293. >0x09 byte 0x02 \b, square twiddled & mipmap
  1294. >0x09 byte 0x03 \b, VQ
  1295. >0x09 byte 0x04 \b, VQ & mipmap
  1296. >0x09 byte 0x05 \b, 8-bit CLUT twiddled
  1297. >0x09 byte 0x06 \b, 4-bit CLUT twiddled
  1298. >0x09 byte 0x07 \b, 8-bit direct twiddled
  1299. >0x09 byte 0x08 \b, 4-bit direct twiddled
  1300. >0x09 byte 0x09 \b, rectangle
  1301. >0x09 byte 0x0B \b, rectangular stride
  1302. >0x09 byte 0x0D \b, rectangular twiddled
  1303. >0x09 byte 0x10 \b, small VQ
  1304. >0x09 byte 0x11 \b, small VQ & mipmap
  1305. >0x09 byte 0x12 \b, square twiddled & mipmap
  1306. # Sega PVR (Xbox) image header.
  1307. # Contains an embedded DirectDraw surface instead of PVR data.
  1308. 0 name sega-pvr-xbox-dds-header
  1309. >16 lelong x %d x
  1310. >12 lelong x %d,
  1311. >84 string x %.4s
  1312. # Sega PVR image.
  1313. 0 string PVRT
  1314. >0x10 string DDS\040\174\000\000\000 Sega PVR (Xbox) image:
  1315. >>0x20 use sega-pvr-xbox-dds-header
  1316. >0x10 belong !0x44445320 Sega PVR image:
  1317. >>0 use sega-pvr-image-header
  1318. # Sega PVR image with GBIX.
  1319. 0 string GBIX
  1320. >0x10 string PVRT
  1321. >>0x10 string DDS\040\174\000\000\000 Sega PVR (Xbox) image:
  1322. >>>0x20 use sega-pvr-xbox-dds-header
  1323. >>0x10 belong !0x44445320 Sega PVR image:
  1324. >>>0x10 use sega-pvr-image-header
  1325. >>0x08 lelong x \b, global index = %u
  1326. # Sega GVR header.
  1327. 0 name sega-gvr-image-header
  1328. >0x0C beshort x %d x
  1329. >0x0E beshort x %d
  1330. # Image data format.
  1331. >0x0B byte 0 \b, I4
  1332. >0x0B byte 1 \b, I8
  1333. >0x0B byte 2 \b, IA4
  1334. >0x0B byte 3 \b, IA8
  1335. >0x0B byte 4 \b, RGB565
  1336. >0x0B byte 5 \b, RGB5A3
  1337. >0x0B byte 6 \b, ARGB8888
  1338. >0x0B byte 8 \b, CI4
  1339. >0x0B byte 9 \b, CI8
  1340. >0x0B byte 14 \b, DXT1
  1341. # Sega GVR image.
  1342. 0 string GVRT Sega GVR image:
  1343. >0x10 use sega-gvr-image-header
  1344. # Sega GVR image with GBIX.
  1345. 0 string GBIX
  1346. >0x10 string GVRT Sega GVR image:
  1347. >>0x10 use sega-gvr-image-header
  1348. >>0x08 belong x \b, global index = %u
  1349. # Light Field Picture
  1350. # Documentation: http://optics.miloush.net/lytro/TheFileFormat.aspx
  1351. # Typical file extensions: .lfp .lfr .lfx
  1352. 0 belong 0x894C4650
  1353. >4 belong 0x0D0A1A0A
  1354. >12 belong 0x00000000 Lytro Light Field Picture
  1355. >8 belong x \b, version %d