2 #------------------------------------------------------------------------------
3 # images: file(1) magic for image formats (see also "iff")
5 # originally from jef@helios.ee.lbl.gov (Jef Poskanzer),
6 # additions by janl@ifi.uio.no as well as others. Jan also suggested
7 # merging several one- and two-line files into here.
9 # little magic: PCX (first byte is 0x0a)
13 # The next byte following the magic is always whitespace.
14 0 string P1 PBM image text
15 0 string P2 PGM image text
16 0 string P3 PPM image text
17 0 string P4 PBM "rawbits" image data
18 0 string P5 PGM "rawbits" image data
19 0 string P6 PPM "rawbits" image data
21 # NIFF (Navy Interchange File Format, a modification of TIFF) images
22 0 string IIN1 NIFF image data
24 # Tag Image File Format, from Daniel Quinlan (quinlan@yggdrasil.com)
25 # The second word of TIFF files is the TIFF version number, 42, which has
26 # never changed. The TIFF specification recommends testing for it.
27 0 string MM\x00\x2a TIFF image data, big-endian
28 0 string II\x2a\x00 TIFF image data, little-endian
30 # PNG [Portable Network Graphics, or "PNG's Not GIF"] images
31 # (Greg Roelofs, newt@uchicago.edu)
33 # 137 P N G \r \n ^Z \n [4-byte length] H E A D [HEAD data] [HEAD crc] ...
35 0 string \x89PNG PNG image data,
36 >4 belong !0x0d0a1a0a CORRUPTED,
41 >25 byte 2 \b/color RGB,
43 >25 byte 4 gray+alpha,
44 >25 byte 6 \b/color RGBA,
45 #>26 byte 0 deflate/32K,
46 >28 byte 0 non-interlaced
50 0 string GIF8 GIF image data
51 >4 string 7a \b, version 8%s,
52 >4 string 9a \b, version 8%s,
55 #>10 byte &0x80 color mapped,
56 #>10 byte&0x07 =0x00 2 colors
57 #>10 byte&0x07 =0x01 4 colors
58 #>10 byte&0x07 =0x02 8 colors
59 #>10 byte&0x07 =0x03 16 colors
60 #>10 byte&0x07 =0x04 32 colors
61 #>10 byte&0x07 =0x05 64 colors
62 #>10 byte&0x07 =0x06 128 colors
63 #>10 byte&0x07 =0x07 256 colors
65 # ITC (CMU WM) raster files. It is essentially a byte-reversed Sun raster,
66 # 1 plane, no encoding.
67 0 string \361\0\100\273 CMU window manager raster image data
72 # Magick Image File Format
73 0 string id=ImageMagick MIFF image data
76 0 long 1123028772 Artisan image data
77 >4 long 1 \b, rectangular 24-bit
78 >4 long 2 \b, rectangular 8-bit with colormap
79 >4 long 3 \b, rectangular 32-bit (24-bit with matte)
81 # FIG (Facility for Interactive Generation of figures), an object-based format
82 0 string #FIG FIG image text
83 >5 string x \b, version %.3s
86 0 string ARF_BEGARF PHIGS clear text archive
87 0 string @(#)SunPHIGS SunPHIGS
88 # version number follows, in the form m.n
89 >40 string SunBin binary
90 >32 string archive archive
92 # GKS (Graphics Kernel System)
93 0 string GKSM GKS Metafile
94 >24 string SunGKS \b, SunGKS
97 0 string BEGMF clear text Computer Graphics Metafile
98 # XXX - questionable magic
99 0 beshort&0xffe0 0x0020 binary Computer Graphics Metafile
100 0 beshort 0x3020 character Computer Graphics Metafile
102 # MGR bitmaps (Michael Haardt, u31b3hs@pool.informatik.rwth-aachen.de)
103 0 string yz MGR bitmap, modern format, 8-bit aligned
104 0 string zz MGR bitmap, old format, 1-bit deep, 16-bit aligned
105 0 string xz MGR bitmap, old format, 1-bit deep, 32-bit aligned
106 0 string yx MGR bitmap, modern format, squeezed
108 # Fuzzy Bitmap (FBM) images
109 0 string %bitmap\0 FBM image data
110 >30 long 0x31 \b, mono
111 >30 long 0x33 \b, color
114 1 string PC\ Research,\ Inc group 3 fax data
115 >29 byte 0 \b, normal resolution (204x98 DPI)
116 >29 byte 1 \b, fine resolution (204x196 DPI)
121 # 0 string \377\330\377\340 JPEG file
122 # 0 string \377\330\377\356 JPG file
124 # both of which turn into "JPEG image data" here.
126 0 beshort 0xffd8 JPEG image data
127 >6 string JFIF \b, JFIF standard
128 # HSI is Handmade Software's proprietary JPEG encoding scheme
129 0 string hsi1 JPEG image data, HSI proprietary
131 # PC bitmaps (OS/2, Windoze BMP files) (Greg Roelofs, newt@uchicago.edu)
132 0 string BM PC bitmap data
133 >14 leshort 12 \b, OS/2 1.x format
134 >>18 leshort x \b, %d x
136 >14 leshort 64 \b, OS/2 2.x format
137 >>18 leshort x \b, %d x
139 >14 leshort 40 \b, Windows 3.x format
140 >>18 lelong x \b, %d x
143 0 string IC PC icon data
144 0 string PI PC pointer image data
145 0 string CI PC color icon data
146 0 string CP PC color pointer image data
147 # Conflicts with other entries [BABYL]
148 #0 string BA PC bitmap array data
150 # XPM icons (Greg Roelofs, newt@uchicago.edu)
151 # note possible collision with C/REXX entry in c-lang; currently commented out
152 0 string /*\ XPM\ */ X pixmap image text
154 # Utah Raster Toolkit RLE images (janl@ifi.uio.no)
155 0 leshort 0xcc52 RLE image data,
158 >2 leshort >0 \b, lower left corner: %d
159 >4 leshort >0 \b, lower right corner: %d
160 >10 byte&0x1 =0x1 \b, clear first
161 >10 byte&0x2 =0x2 \b, no background
162 >10 byte&0x4 =0x4 \b, alpha channel
163 >10 byte&0x8 =0x8 \b, comment
164 >11 byte >0 \b, %d color channels
165 >12 byte >0 \b, %d bits per pixel
166 >13 byte >0 \b, %d color map channels
168 # image file format (Robert Potter, potter@cs.rochester.edu)
169 0 string Imagefile\ version- iff image data
170 # this adds the whole header (inc. version number), informative but longish
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
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,
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
191 # SGI image file format, from Daniel Quinlan (quinlan@yggdrasil.com)
192 # file://sgi.com/graphics/SGIIMAGESPEC
193 0 beshort 474 SGI image data
194 #>2 byte 0 \b, verbatim
196 #>3 byte 1 \b, normal precision
197 >3 byte 2 \b, high precision
198 >4 beshort x \b, %d-D
199 >6 beshort x \b, %d x
201 >10 beshort x \b, %d channel
203 >80 string >0 \b, "%s"
205 0 string IT01 FIT image data
210 0 string IT02 FIT image data
215 2048 string PCD_IPI Kodak Photo CD image pack file
216 0 string PCD_OPA Kodak Photo CD overview pack file
218 # FITS format. Jeff Uphoff <juphoff@tarsier.cv.nrao.edu>
219 # FITS is the Flexible Image Transport System, the de facto standard for
220 # data and image transfer, storage, etc., for the astronomical community.
221 # (FITS floating point formats are big-endian.)
222 0 string SIMPLE\ \ = FITS image data
223 >109 string 8 \b, 8-bit, character or unsigned binary integer
224 >108 string 16 \b, 16-bit, two's complement binary integer
225 >107 string \ 32 \b, 32-bit, two's complement binary integer
226 >107 string -32 \b, 32-bit, floating point, single precision
227 >107 string -64 \b, 64-bit, floating point, double precision
230 0 string This\ is\ a\ BitMap\ file Lisp Machine bit-array-file
231 0 string !! Bennet Yee's "face" format
233 # From SunOS 5.5.1 "/etc/magic" - appeared right before Sun raster image
236 0 beshort 0x1010 PEX Binary Archive