images 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. #------------------------------------------------------------------------------
  2. # images: file(1) magic for image formats (see also "iff")
  3. #
  4. # originally from jef@helios.ee.lbl.gov (Jef Poskanzer),
  5. # additions by janl@ifi.uio.no as well as others. Jan also suggested
  6. # merging several one- and two-line files into here.
  7. #
  8. # Targa - matches `povray', `ppmtotga' and `xv' outputs
  9. # by Philippe De Muyter <phdm@macqel.be>
  10. # at 2, byte ImgType must be 1, 2, 3, 9, 10 or 11
  11. # at 1, byte CoMapType must be 1 if ImgType is 1 or 9, 0 otherwise
  12. # at 3, leshort Index is 0 for povray, ppmtotga and xv outputs
  13. # `xv' recognizes only a subset of the following (RGB with pixelsize = 24)
  14. # `tgatoppm' recognizes a superset (Index may be anything)
  15. 1 belong&0xfff7ffff 0x01010000 Targa image data - Map
  16. >2 byte&8 8 - RLE
  17. >12 leshort >0 %hd x
  18. >14 leshort >0 %hd
  19. 1 belong&0xfff7ffff 0x00020000 Targa image data - RGB
  20. >2 byte&8 8 - RLE
  21. >12 leshort >0 %hd x
  22. >14 leshort >0 %hd
  23. 1 belong&0xfff7ffff 0x00030000 Targa image data - Mono
  24. >2 byte&8 8 - RLE
  25. >12 leshort >0 %hd x
  26. >14 leshort >0 %hd
  27. # PBMPLUS images
  28. # The next byte following the magic is always whitespace.
  29. 0 string P1 Netpbm PBM image text
  30. 0 string P2 Netpbm PGM image text
  31. 0 string P3 Netpbm PPM image text
  32. 0 string P4 Netpbm PBM "rawbits" image data
  33. 0 string P5 Netpbm PGM "rawbits" image data
  34. 0 string P6 Netpbm PPM "rawbits" image data
  35. 0 string P7 Netpbm PAM image file
  36. # From: bryanh@giraffe-data.com (Bryan Henderson)
  37. 0 string \117\072 Solitaire Image Recorder format
  38. >4 string \013 MGI Type 11
  39. >4 string \021 MGI Type 17
  40. 0 string .MDA MicroDesign data
  41. >21 byte 48 version 2
  42. >21 byte 51 version 3
  43. 0 string .MDP MicroDesign page data
  44. >21 byte 48 version 2
  45. >21 byte 51 version 3
  46. # NITF is defined by United States MIL-STD-2500A
  47. 0 string NITF National Imagery Transmission Format
  48. >25 string >\0 dated %.14s
  49. # NIFF (Navy Interchange File Format, a modification of TIFF) images
  50. 0 string IIN1 NIFF image data
  51. # Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
  52. # The second word of TIFF files is the TIFF version number, 42, which has
  53. # never changed. The TIFF specification recommends testing for it.
  54. 0 string MM\x00\x2a TIFF image data, big-endian
  55. 0 string II\x2a\x00 TIFF image data, little-endian
  56. # PNG [Portable Network Graphics, or "PNG's Not GIF"] images
  57. # (Greg Roelofs, newt@uchicago.edu)
  58. # (Albert Cahalan, acahalan@cs.uml.edu)
  59. #
  60. # 137 P N G \r \n ^Z \n [4-byte length] H E A D [HEAD data] [HEAD crc] ...
  61. #
  62. 0 string \x89PNG PNG image data,
  63. >4 belong !0x0d0a1a0a CORRUPTED,
  64. >4 belong 0x0d0a1a0a
  65. >>16 belong x %ld x
  66. >>20 belong x %ld,
  67. >>24 byte x %d-bit
  68. >>25 byte 0 grayscale,
  69. >>25 byte 2 \b/color RGB,
  70. >>25 byte 3 colormap,
  71. >>25 byte 4 gray+alpha,
  72. >>25 byte 6 \b/color RGBA,
  73. #>>26 byte 0 deflate/32K,
  74. >>28 byte 0 non-interlaced
  75. >>28 byte 1 interlaced
  76. 1 string PNG PNG image data, CORRUPTED
  77. # GIF
  78. 0 string GIF8 GIF image data
  79. >4 string 7a \b, version 8%s,
  80. >4 string 9a \b, version 8%s,
  81. >6 leshort >0 %hd x
  82. >8 leshort >0 %hd
  83. #>10 byte &0x80 color mapped,
  84. #>10 byte&0x07 =0x00 2 colors
  85. #>10 byte&0x07 =0x01 4 colors
  86. #>10 byte&0x07 =0x02 8 colors
  87. #>10 byte&0x07 =0x03 16 colors
  88. #>10 byte&0x07 =0x04 32 colors
  89. #>10 byte&0x07 =0x05 64 colors
  90. #>10 byte&0x07 =0x06 128 colors
  91. #>10 byte&0x07 =0x07 256 colors
  92. # ITC (CMU WM) raster files. It is essentially a byte-reversed Sun raster,
  93. # 1 plane, no encoding.
  94. 0 string \361\0\100\273 CMU window manager raster image data
  95. >4 lelong >0 %d x
  96. >8 lelong >0 %d,
  97. >12 lelong >0 %d-bit
  98. # Magick Image File Format
  99. 0 string id=ImageMagick MIFF image data
  100. # Artisan
  101. 0 long 1123028772 Artisan image data
  102. >4 long 1 \b, rectangular 24-bit
  103. >4 long 2 \b, rectangular 8-bit with colormap
  104. >4 long 3 \b, rectangular 32-bit (24-bit with matte)
  105. # FIG (Facility for Interactive Generation of figures), an object-based format
  106. 0 string #FIG FIG image text
  107. >5 string x \b, version %.3s
  108. # PHIGS
  109. 0 string ARF_BEGARF PHIGS clear text archive
  110. 0 string @(#)SunPHIGS SunPHIGS
  111. # version number follows, in the form m.n
  112. >40 string SunBin binary
  113. >32 string archive archive
  114. # GKS (Graphics Kernel System)
  115. 0 string GKSM GKS Metafile
  116. >24 string SunGKS \b, SunGKS
  117. # CGM image files
  118. 0 string BEGMF clear text Computer Graphics Metafile
  119. # XXX - questionable magic
  120. 0 beshort&0xffe0 0x0020 binary Computer Graphics Metafile
  121. 0 beshort 0x3020 character Computer Graphics Metafile
  122. # MGR bitmaps (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
  123. 0 string yz MGR bitmap, modern format, 8-bit aligned
  124. 0 string zz MGR bitmap, old format, 1-bit deep, 16-bit aligned
  125. 0 string xz MGR bitmap, old format, 1-bit deep, 32-bit aligned
  126. 0 string yx MGR bitmap, modern format, squeezed
  127. # Fuzzy Bitmap (FBM) images
  128. 0 string %bitmap\0 FBM image data
  129. >30 long 0x31 \b, mono
  130. >30 long 0x33 \b, color
  131. # facsimile data
  132. 1 string PC\ Research,\ Inc group 3 fax data
  133. >29 byte 0 \b, normal resolution (204x98 DPI)
  134. >29 byte 1 \b, fine resolution (204x196 DPI)
  135. # PC bitmaps (OS/2, Windoze BMP files) (Greg Roelofs, newt@uchicago.edu)
  136. 0 string BM PC bitmap data
  137. >14 leshort 12 \b, OS/2 1.x format
  138. >>18 leshort x \b, %d x
  139. >>20 leshort x %d
  140. >14 leshort 64 \b, OS/2 2.x format
  141. >>18 leshort x \b, %d x
  142. >>20 leshort x %d
  143. >14 leshort 40 \b, Windows 3.x format
  144. >>18 lelong x \b, %d x
  145. >>22 lelong x %d x
  146. >>28 leshort x %d
  147. 0 string IC PC icon data
  148. 0 string PI PC pointer image data
  149. 0 string CI PC color icon data
  150. 0 string CP PC color pointer image data
  151. # Conflicts with other entries [BABYL]
  152. #0 string BA PC bitmap array data
  153. # XPM icons (Greg Roelofs, newt@uchicago.edu)
  154. # note possible collision with C/REXX entry in c-lang; currently commented out
  155. 0 string /*\ XPM\ */ X pixmap image text
  156. # Utah Raster Toolkit RLE images (janl@ifi.uio.no)
  157. 0 leshort 0xcc52 RLE image data,
  158. >6 leshort x %d x
  159. >8 leshort x %d
  160. >2 leshort >0 \b, lower left corner: %d
  161. >4 leshort >0 \b, lower right corner: %d
  162. >10 byte&0x1 =0x1 \b, clear first
  163. >10 byte&0x2 =0x2 \b, no background
  164. >10 byte&0x4 =0x4 \b, alpha channel
  165. >10 byte&0x8 =0x8 \b, comment
  166. >11 byte >0 \b, %d color channels
  167. >12 byte >0 \b, %d bits per pixel
  168. >13 byte >0 \b, %d color map channels
  169. # image file format (Robert Potter, potter@cs.rochester.edu)
  170. 0 string Imagefile\ version- iff image data
  171. # this adds the whole header (inc. version number), informative but longish
  172. >10 string >\0 %s
  173. # Sun raster images, from Daniel Quinlan (quinlan@yggdrasil.com)
  174. 0 belong 0x59a66a95 Sun raster image data
  175. >4 belong >0 \b, %d x
  176. >8 belong >0 %d,
  177. >12 belong >0 %d-bit,
  178. #>16 belong >0 %d bytes long,
  179. >20 belong 0 old format,
  180. #>20 belong 1 standard,
  181. >20 belong 2 compressed,
  182. >20 belong 3 RGB,
  183. >20 belong 4 TIFF,
  184. >20 belong 5 IFF,
  185. >20 belong 0xffff reserved for testing,
  186. >24 belong 0 no colormap
  187. >24 belong 1 RGB colormap
  188. >24 belong 2 raw colormap
  189. #>28 belong >0 colormap is %d bytes long
  190. # SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
  191. #
  192. # See
  193. # http://reality.sgi.com/grafica/sgiimage.html
  194. #
  195. 0 beshort 474 SGI image data
  196. #>2 byte 0 \b, verbatim
  197. >2 byte 1 \b, RLE
  198. #>3 byte 1 \b, normal precision
  199. >3 byte 2 \b, high precision
  200. >4 beshort x \b, %d-D
  201. >6 beshort x \b, %d x
  202. >8 beshort x %d
  203. >10 beshort x \b, %d channel
  204. >10 beshort !1 \bs
  205. >80 string >0 \b, "%s"
  206. 0 string IT01 FIT image data
  207. >4 belong x \b, %d x
  208. >8 belong x %d x
  209. >12 belong x %d
  210. #
  211. 0 string IT02 FIT image data
  212. >4 belong x \b, %d x
  213. >8 belong x %d x
  214. >12 belong x %d
  215. #
  216. 2048 string PCD_IPI Kodak Photo CD image pack file
  217. >0xe02 byte&0x03 0x00 , landscape mode
  218. >0xe02 byte&0x03 0x01 , portrait mode
  219. >0xe02 byte&0x03 0x02 , landscape mode
  220. >0xe02 byte&0x03 0x03 , portrait mode
  221. 0 string PCD_OPA Kodak Photo CD overview pack file
  222. # FITS format. Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
  223. # FITS is the Flexible Image Transport System, the de facto standard for
  224. # data and image transfer, storage, etc., for the astronomical community.
  225. # (FITS floating point formats are big-endian.)
  226. 0 string SIMPLE\ \ = FITS image data
  227. >109 string 8 \b, 8-bit, character or unsigned binary integer
  228. >108 string 16 \b, 16-bit, two's complement binary integer
  229. >107 string \ 32 \b, 32-bit, two's complement binary integer
  230. >107 string -32 \b, 32-bit, floating point, single precision
  231. >107 string -64 \b, 64-bit, floating point, double precision
  232. # other images
  233. 0 string This\ is\ a\ BitMap\ file Lisp Machine bit-array-file
  234. 0 string !! Bennet Yee's "face" format
  235. # From SunOS 5.5.1 "/etc/magic" - appeared right before Sun raster image
  236. # stuff.
  237. #
  238. 0 beshort 0x1010 PEX Binary Archive
  239. # Visio drawings
  240. 03000 string Visio\ (TM)\ Drawing %s
  241. # Tgif files
  242. 0 string \%TGIF\ x Tgif file version %s
  243. # DICOM medical imaging data
  244. 128 string DICM DICOM medical imaging data
  245. # XWD - X-Windows Dump file.
  246. # As described in /usr/X11R6/include/X11/XWDFile.h
  247. # used by the xwd program.
  248. # Bradford Castalia, idaeim, 1/01
  249. 4 belong 7 XWD X-Windows Dump image data
  250. >100 string >\0 \b, "%s"
  251. >16 belong x \b, %dx
  252. >20 belong x \b%dx
  253. >12 belong x \b%d
  254. # PDS - Planetary Data System
  255. # These files use Parameter Value Language in the header section.
  256. # Unfortunately, there is no certain magic, but the following
  257. # strings have been found to be most likely.
  258. 0 string NJPL1I00 PDS (JPL) image data
  259. 2 string NJPL1I PDS (JPL) image data
  260. 0 string CCSD3ZF PDS (CCSD) image data
  261. 2 string CCSD3Z PDS (CCSD) image data
  262. 0 string PDS_ PDS image data
  263. 0 string LBLSIZE= PDS (VICAR) image data
  264. # pM8x: ATARI STAD compressed bitmap format
  265. #
  266. # from Oskar Schirmer <schirmer@scara.com> Feb 2, 2001
  267. # p M 8 5/6 xx yy zz data...
  268. # Atari ST STAD bitmap is always 640x400, bytewise runlength compressed.
  269. # bytes either run horizontally (pM85) or vertically (pM86). yy is the
  270. # most frequent byte, xx and zz are runlength escape codes, where xx is
  271. # used for runs of yy.
  272. #
  273. 0 string pM85 Atari ST STAD bitmap image data (hor)
  274. >5 byte 0x00 (white background)
  275. >5 byte 0xFF (black background)
  276. 0 string pM86 Atari ST STAD bitmap image data (vert)
  277. >5 byte 0x00 (white background)
  278. >5 byte 0xFF (black background)
  279. # XXX:
  280. # This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
  281. # magic.
  282. # SGI RICE image file <mpruett@sgi.com>
  283. #0 beshort 0x5249 RICE image
  284. #>2 beshort x v%d
  285. #>4 beshort x (%d x
  286. #>6 beshort x %d)
  287. #>8 beshort 0 8 bit
  288. #>8 beshort 1 10 bit
  289. #>8 beshort 2 12 bit
  290. #>8 beshort 3 13 bit
  291. #>10 beshort 0 4:2:2
  292. #>10 beshort 1 4:2:2:4
  293. #>10 beshort 2 4:4:4
  294. #>10 beshort 3 4:4:4:4
  295. #>12 beshort 1 RGB
  296. #>12 beshort 2 CCIR601
  297. #>12 beshort 3 RP175
  298. #>12 beshort 4 YUV
  299. #------------------------------------------------------------------------------
  300. #
  301. # Marco Schmidt (marcoschmidt@users.sourceforge.net) -- an image file format
  302. # for the EPOC operating system, which is used with PDAs like those from Psion
  303. #
  304. # see http://huizen.dds.nl/~frodol/psiconv/html/Index.html for a description
  305. # of various EPOC file formats
  306. 0 string \x37\x00\x00\x10\x42\x00\x00\x10\x00\x00\x00\x00\x39\x64\x39\x47 EPOC MBM image file
  307. # PSD (Adobe Photoshop bitmap) (Wolfram Kleff)
  308. 0 string 8BPS PSD image data (Adobe Photoshop bitmap)
  309. # PCX (should be reliable with a 2 byte header - Wolfram Kleff)
  310. 0 beshort 0x0A00 PCX image data, version 2.5
  311. 0 beshort 0x0A02 PCX image data, version 2.8 with palette
  312. 0 beshort 0x0A03 PCX image data, version 2.8 without palette
  313. 0 beshort 0x0A04 PCX image data, version 3.0 (Windows)
  314. 0 beshort 0x0A05 PCX image data, version 3.0
  315. # GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
  316. 0 belong 0x00010008 GEM Image data
  317. >12 beshort x %d x
  318. >14 beshort x %d,
  319. >4 beshort x %d planes,
  320. >8 beshort x %d x
  321. >10 beshort x %d pixelsize
  322. # GEM Metafile (Wolfram Kleff)
  323. 0 lelong 0x0018FFFF GEM Metafile data
  324. >4 leshort x version %d
  325. # A Sketch drawing (Michael Loßin). <URL:http://sketch.sourceforge.net/>
  326. #
  327. 0 string \#\#Sketch Sketch drawing text
  328. #
  329. # SMJPEG. A custom Motion JPEG format used by Loki Entertainment
  330. # Software Torbjorn Andersson <d91tan@Update.UU.SE>.
  331. #
  332. 0 string \0\nSMJPEG SMJPEG
  333. >8 belong x %d.x data
  334. # According to the specification you could find any number of _TXT
  335. # headers here, but I can't think of any way of handling that. None of
  336. # the SMJPEG files I tried it on used this feature. Even if such a
  337. # file is encountered the output should still be reasonable.
  338. >16 string _SND \b,
  339. >>24 beshort >0 %d Hz
  340. >>26 byte 8 8-bit
  341. >>26 byte 16 16-bit
  342. >>28 string NONE uncompressed
  343. # >>28 string APCM ADPCM compressed
  344. >>27 byte 1 mono
  345. >>28 byte 2 stereo
  346. # Help! Isn't there any way to avoid writing this part twice?
  347. >>32 string _VID \b,
  348. # >>>48 string JFIF JPEG
  349. >>>40 belong >0 %d frames
  350. >>>44 beshort >0 (%d x
  351. >>>46 beshort >0 %d)
  352. >16 string _VID \b,
  353. # >>32 string JFIF JPEG
  354. >>24 belong >0 %d frames
  355. >>28 beshort >0 (%d x
  356. >>30 beshort >0 %d)
  357. 0 string Paint\ Shop\ Pro\ Image\ File Paint Shop Pro Image File
  358. # "thumbnail file" (icon)
  359. # descended from "xv", but in use by other applications as well (Wolfram Kleff)
  360. 0 string P7\ 332 XV "thumbnail file" (icon) data
  361. # taken from fkiss: (<yav@mte.biglobe.ne.jp> ?)
  362. 0 string KiSS KISS/GS
  363. >4 byte 16 color
  364. >>5 byte x %d bit
  365. >>8 leshort x %d colors
  366. >>10 leshort x %d groups
  367. >4 byte 32 cell
  368. >>5 byte x %d bit
  369. >>8 leshort x %d x
  370. >>10 leshort x %d
  371. >>12 leshort x +%d
  372. >>14 leshort x +%d
  373. # Webshots (www.webshots.com), by John Harrison
  374. 0 string C\253\221g\230\0\0\0 Webshots Desktop .wbz file
  375. # Hercules DASD image files
  376. # From Jan Jaeger <jj@septa.nl>
  377. 0 string CKD_P370 Hercules CKD DASD image file
  378. >8 long x \b, %d heads per cylinder
  379. >12 long x \b, track size %d bytes
  380. >16 byte x \b, device type 33%2.2X
  381. 0 string CKD_C370 Hercules compressed CKD DASD image file
  382. >8 long x \b, %d heads per cylinder
  383. >12 long x \b, track size %d bytes
  384. >16 byte x \b, device type 33%2.2X
  385. 0 string CKD_S370 Hercules CKD DASD shadow file
  386. >8 long x \b, %d heads per cylinder
  387. >12 long x \b, track size %d bytes
  388. >16 byte x \b, device type 33%2.2X
  389. # Squeak images and - etoffi@softhome.net
  390. 0 string \146\031\0\0 Squeak image data
  391. 0 string 'From\040Squeak Squeak program text