Next: 2.2 Computation formats Up: 2. The VIPS file Previous: 2. The VIPS file Contents

#
2.1 VIPS file header

There are two principal types of VIPS image file: images in a storage format, and images in a computation format. Both types start with a simple 64-byte header, see table 2.1.

The `Type` field, the `Xres`/`Yres` fields, and the `Xoffset`/`Yoffset` fields are advisory. VIPS maintains their value (if you convert an image to CIE colour space with `im_XYZ2Lab()`, for example, VIPS will set `Type` to be `IM_TYPE_LAB`), but never uses these values itself in determining the action of an image processing function. These fields are to help the user, and to help application programs built on VIPS which are trying to present image data to the user in a meaningful way.

The `BandFmt`, `Coding` and `Type` fields can take the values shown in tables 2.2, 2.3 and 2.4.

Table 2.1: VIPS header

Bytes | Represent | VIPS name
0-3 | VIPS magic number (in hex, 08 f2 f6 b6) |
4-7 | Number of pels per horizontal line (integer) | `Xsize`
8-11 | Number of horizontal lines (integer) | `Ysize`
12-15 | Number of bands (integer) | `Bands`
16-19 | Bits per band element (integer, eg. 8 for byte) | `Bbits`
20-23 | Band format (eg. `IM_BANDFMT_USHORT`) | `BandFmt`
24-27 | Coding type (eg. `IM_CODING_NONE`) | `Coding`
28-31 | Type (eg. `IM_TYPE_LAB`) | `Type`
32-35 | Horizontal resolution (float, pixels mm) | `Xres`
36-39 | Vertical resolution (float, pixels mm) | `Yres`
40-43 | Unused (legacy) | `Length`
44-45 | Unused (legacy) | `Compression`
46-47 | Unused (legacy) | `Level`
48-51 | Horizontal offset of origin | `Xoffset`
52-55 | Vertical offset of origin | `Yoffset`
56-63 | For future expansion (all zeros for now) |

Table 2.2: Possible values for `BandFmt`

`BandFmt` | Value | Meaning
`IM_BANDFMT_NOTSET` | -1 |
`IM_BANDFMT_UCHAR` | 0 | Unsigned 8-bit integers
`IM_BANDFMT_CHAR` | 1 | Signed 8-bit integers
`IM_BANDFMT_USHORT` | 2 | Unsigned 16-bit integers
`IM_BANDFMT_SHORT` | 3 | Signed 16-bit integers
`IM_BANDFMT_UINT` | 4 | Unsigned 32-bit integers
`IM_BANDFMT_INT` | 5 | Signed 32-bit integers
`IM_BANDFMT_FLOAT` | 6 | 32-bit IEEE floats
`IM_BANDFMT_COMPLEX` | 7 | Complex (2 float each)
`IM_BANDFMT_DOUBLE` | 8 | 64-bit IEEE doubles
`IM_BANDFMT_DPCOMPLEX` | 9 | Complex (2 double each)

Table 2.3: Possible values for `Coding`

`Coding` | Value | Meaning
`IM_CODING_NONE` | 0 | VIPS computation format
`IM_CODING_LABQ` | 2 | LABQ storage format

Table 2.4: Possible values for `Type`

`Type` | Value | Meaning
`IM_TYPE_MULTIBAND` | 0 | Not well defined
`IM_TYPE_B_W` | 1 | Not well defined
`IM_TYPE_HISTOGRAM` | 10 | 1 x n or n x 1 histogram or LUT
`IM_TYPE_FOURIER` | 24 | Image in Fourier space
`IM_TYPE_XYZ` | 12 | Pels are in CIE XYZ colour space
`IM_TYPE_LAB` | 13 | Pels are in CIE colour space
`IM_TYPE_CMYK` | 15 | Output of `im_icc_export()`
`IM_TYPE_LABQ` | 16 | Output of `im_*2LabQ()`
`IM_TYPE_RGB` | 17 | Output of `im_*2disp()`
`IM_TYPE_UCS` | 18 | Output of `im_*2UCS()`
`IM_TYPE_LCH` | 19 | Output of `im_*2LCh()`
`IM_TYPE_LABS` | 21 | Output of `im_*2LabS()`
`IM_TYPE_sRGB` | 22 | Output of `im_XYZ2sRGB()`
`IM_TYPE_YXY` | 22 | Output of `im_XYZ2Yxy()`

Next: 2.2 Computation formats Up: 2. The VIPS file Previous: 2. The VIPS file Contents