Table of Contents

## Name

im_tiff2vips, im_tiff2vips_header, im_tiff2vips - convert TIFF images to and from VIPS format

## Synopsis

#include <vips/vips.h>

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 )

## Description

im_tiff2vips(3) reads the tiff image in filename, and writes the image out in VIPS format. It is a full baseline TIFF 6 reader, with extensions for tiled images, multipage images, LAB colour space, pyramidal images and JPEG compression.

You can embed options in the filename. They have the form:

filename.tif:<page-number>,<broken>

page-number lets you read a particular page out of a multipage TIFF file. For example:

"fred.tif:12"

will read page 12 (numbering from page zero) from the TIFF image.

broken turns on backwards compatibility for tiled TIFF files written with versions of VIPS before 7.9.3. Without this flag you'll see problems in edge tiles. For example:

"fred.tif:,broken"

will read fred.tif, with the old and broken edge tile code.

Use im_istifftiled(3) and im_istiffpyramid(3) to find the TIFF image type before calling.

im_tiff2vips_header(3) reads just the header information from the TIFF file. You can't read any pixels!

im_vips2tiff(3) 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>,<format>,<resolution>,<icc>

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".

<format> is one of:

"manybit" - don't bit-reduce images
"onebit" - one band 8 bit images are saved as 1 bit

The default format is "multibit".

<resolution> is one of:

"res_cm" - output resolution unit is piexls per centimetre
"res_inch" - output resolution unit is piexls per inch

The default format is "res_cm". The unit can optionally be followed by a ":" character and the horizontal and vertical resolution, separated by a "x" character. You can have a single number with no "x" and set the horizontal and vertical resolutions together. The default unit is cm, and the default resolution is taken from the VIPS header.

<icc> is the filename of an ICC

profile to embed in the TIFF file

The TIFF reader and writer are based on Sam Leffler's TIFF library, and the IJG JPEG coder.

## Examples

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.

im_vips2tiff fred.v fred.tif:packbits,tile,,onebit

Writes a tiled one bit TIFF image (provided fred.v is a one band 8 bit image) compressed with packbits.

im_vips2tiff fred.v fred.tif:,,,,res_inch:300

Writes fred.v as a tiff file, with the resolution in the tiff header set to 300 dpi.

## See Also

im_istiff(3) , im_istifftiled(3) , im_istiffpyramid(3)

## Copyright

Hey, you want this? You have it!

Table of Contents

- Name
- Synopsis
- Description
- Examples
- See Also
- Copyright