A set of member functions of VImage provide access to the fields in
the header:
int Xsize(); int Ysize(); int Bands(); TBandFmt BandFmt(); TCoding Coding(); TType Type(); float Xres(); float Yres(); int Length(); TCompression Compression(); short Level(); int Xoffset(); int Yoffset();
Where TBandFmt, TCoding, TType and TCompression
are enums for the types in the VIPS file header and are defined as:
// Type type
enum TType {
MULTIBAND = 0,
B_W = 1,
LUMINACE = 2,
XRAY = 3,
IR = 4,
YUV = 5,
RED_ONLY = 6,
GREEN_ONLY = 7,
BLUE_ONLY = 8,
POWER_SPECTRUM = 9,
HISTOGRAM = 10,
LUT = 11,
XYZ = 12,
LAB = 13,
CMC = 14,
CMYK = 15,
LABQ = 16,
RGB = 17,
UCS = 18,
LCH = 19,
LABS = 20
};
// Format type
enum TBandFmt {
FMTNOTSET = -1,
FMTUCHAR = 0,
FMTCHAR = 1,
FMTUSHORT = 2,
FMTSHORT = 3,
FMTUINT = 4,
FMTINT = 5,
FMTFLOAT = 6,
FMTCOMPLEX = 7,
FMTDOUBLE = 8,
FMTDPCOMPLEX = 9
};
// Coding type
enum TCoding {
NOCODING = 0,
COLQUANT = 1,
LABPACK = 2,
LABPACK_COMPRESSED = 3,
RGB_COMPRESSED = 4,
LUM_COMPRESSED = 5
};
// Compression type
enum TCompression {
NO_COMPRESSION = 0,
TCSF_COMPRESSION = 1,
JPEG_COMPRESSION = 2
};
See section §2.1 for an explanation of all of these fields. Unfortunately, the C names and the C++ names for these fields no longer quite match. The C++ API may change to match C more closely in vips8.
The image() member function provides access to the IMAGE
descriptor underlying the C++ API. See the VIPS Application Programmers'
Guide for details.
void *image();
The data() member function returns a pointer to an array of pixel data
for the image.
void *data() const;
This can be very slow and use huge amounts of RAM.
Finally, two projection functions give access to the filename and history fields maintained by the VIPS IO system.
char *filename(); char *Hist();