int im_tiff2vips( const char *filename, IMAGE *out )
int im_tiff2vips_header( const char *filename, IMAGE *out )
int im_vips2tiff( IMAGE *in, const char *filename )
You can embed a page number in the filename. For example:
"fred.tif:12"
will read page 12 (numbering from page zero) from the TIFF image.
Use im_istifftiled() and im_istiffpyramid() to find the TIFF image type before calling.
im_tiff2vips_header() reads just the header information from the TIFF file. You can't read any pixels!
im_vips2tiff() reads the image in and writes a TIFF file to the specified filename. The filename may include an optional mode string, following a ':' character. For example, "fred.tif" would write a default TIFF file (flat, strips, no compression). Writing to "fred.tif:deflate,tile:64x64" would write a ZIP-coded image, split into 64 by 64 pixel tiles.
The mode string has the following syntax:
<compression>,<layout>,<multi-res>
where <compression> is one of:
"none" - no compression
"jpeg" - JPEG compression
"deflate" - ZIP (deflate) compression
"packbits" - TIFF packbits compression
"lzw" - Lempel-Ziv compression
"jpeg" compression can be followed by a ":" character and a JPEG quality level. The default compression type is "none", the default JPEG quality factor is 75.
JPEG compression is a good lossy compressor for photographs, packbits is good for 1-bit images, and deflate is the best lossless compression TIFF can do. LZW has patent problems, and is no longer recommended.
<layout> is one of:
"strip" - strip layout
"tile" - tiled layout
"tile" layout can be followed by a ":" character and the horizontal and vertical tile size, separated by a "x" character. The default layout is "strip", and the default tile size is 128 by 128 pixels.
<multi-res> is one of:
"flat" - single image
"pyramid" - many images arranged in a pyramid
The default multi-res mode is "flat".
The TIFF reader and writer are based on Sam Leffler's TIFF library, and the IJG JPEG coder.
The call:
im_vips2tiff fred.v fred.tif
Writes a striped, uncompressed TIFF image. Almost anything should be able to read this.
im_vips2tiff fred.v fred.tif:jpeg,tile,pyramid
Writes a tiled JPEG pyramid image. Although VIPS tries to follow the TIFF specification carefully, you may have trouble reading this on any system other than VIPS.
im_vips2tiff fred.v fred.tif:jpeg:25,tile:64x64
Writes a highly compressed JPEG image, with a tile size of 64 by 64 pixels.
im_vips2tiff fred.v fred.tif:,tile
Writes an uncompressed tiled image.