1IM_TIFF(3) Library Functions Manual IM_TIFF(3)
2
3
4
6 im_tiff2vips, im_tiff2vips_header, im_tiff2vips - convert TIFF images
7 to and from VIPS format
8
10 #include <vips/vips.h>
11
12 int im_tiff2vips( const char *filename, IMAGE *out )
13
14 int im_tiff2vips_header( const char *filename, IMAGE *out )
15
16 int im_vips2tiff( IMAGE *in, const char *filename )
17
18
20 im_tiff2vips(3) reads the tiff image in filename, and writes the image
21 out in VIPS format. It is a full baseline TIFF 6 reader, with exten‐
22 sions for tiled images, multipage images, LAB colour space, pyramidal
23 images and JPEG compression.
24
25 You can embed options in the filename. They have the form:
26
27 filename.tif:<page-number>,<broken>
28
29 page-number lets you read a particular page out of a multipage TIFF
30 file. For example:
31
32 "fred.tif:12"
33
34 will read page 12 (numbering from page zero) from the TIFF image.
35
36 broken turns on backwards compatibility for tiled TIFF files written
37 with versions of VIPS before 7.9.3. Without this flag you'll see prob‐
38 lems in edge tiles. For example:
39
40 "fred.tif:,broken"
41
42 will read fred.tif, with the old and broken edge tile code.
43
44 Use im_istifftiled(3) and im_istiffpyramid(3) to find the TIFF image
45 type before calling.
46
47 im_tiff2vips_header(3) reads just the header information from the TIFF
48 file. You can't read any pixels!
49
50 im_vips2tiff(3) reads the image in and writes a TIFF file to the speci‐
51 fied filename. The filename may include an optional mode string, fol‐
52 lowing a ':' character. For example, "fred.tif" would write a default
53 TIFF file (flat, strips, no compression). Writing to
54 "fred.tif:deflate,tile:64x64" would write a ZIP-coded image, split into
55 64 by 64 pixel tiles.
56
57 The mode string has the following syntax:
58
59 <compression>,<layout>,<multi-res>,<format>,<resolution>,<icc>
60
61 where <compression> is one of:
62
63 "none" - no compression
64 "jpeg" - JPEG compression
65 "deflate" - ZIP (deflate) compression
66 "packbits" - TIFF packbits compression
67 "ccittfax4" - CCITT Group 4 fax encoding
68 "lzw" - Lempel-Ziv compression
69
70 "jpeg" compression can be followed by a ":" character and a JPEG qual‐
71 ity level. The default compression type is "none", the default JPEG
72 quality factor is 75.
73
74 JPEG compression is a good lossy compressor for photographs, packbits
75 is good for 1-bit images, and deflate is the best lossless compression
76 TIFF can do. LZW has patent problems, and is no longer recommended.
77
78 <layout> is one of:
79
80 "strip" - strip layout
81 "tile" - tiled layout
82
83 "tile" layout can be followed by a ":" character and the horizontal and
84 vertical tile size, separated by a "x" character. The default layout is
85 "strip", and the default tile size is 128 by 128 pixels.
86
87 <multi-res> is one of:
88
89 "flat" - single image
90 "pyramid" - many images arranged in a pyramid
91
92 The default multi-res mode is "flat".
93
94 <format> is one of:
95
96 "manybit" - don't bit-reduce images
97 "onebit" - one band 8 bit images are saved as 1 bit
98
99 The default format is "multibit".
100
101 <resolution> is one of:
102
103 "res_cm" - output resolution unit is piexls per centimetre
104 "res_inch" - output resolution unit is piexls per inch
105
106 The default format is "res_cm". The unit can optionally be followed by
107 a ":" character and the horizontal and vertical resolution, separated
108 by a "x" character. You can have a single number with no "x" and set
109 the horizontal and vertical resolutions together. The default unit is
110 cm, and the default resolution is taken from the VIPS header.
111
112 <icc> is the filename of an ICC profile to embed in the TIFF file
113
114 The TIFF reader and writer are based on Sam Leffler's TIFF library, and
115 the IJG JPEG coder.
116
117
119 The call:
120
121 im_vips2tiff fred.v fred.tif
122
123 Writes a striped, uncompressed TIFF image. Almost anything should be
124 able to read this.
125
126 im_vips2tiff fred.v fred.tif:jpeg,tile,pyramid
127
128 Writes a tiled JPEG pyramid image. Although VIPS tries to follow the
129 TIFF specification carefully, you may have trouble reading this on any
130 system other than VIPS.
131
132 im_vips2tiff fred.v fred.tif:jpeg:25,tile:64x64
133
134 Writes a highly compressed JPEG image, with a tile size of 64 by 64
135 pixels.
136
137 im_vips2tiff fred.v fred.tif:,tile
138
139 Writes an uncompressed tiled image.
140
141 im_vips2tiff fred.v fred.tif:packbits,tile,,onebit
142
143 Writes a tiled one bit TIFF image (provided fred.v is a one band 8 bit
144 image) compressed with packbits.
145
146 im_vips2tiff fred.v fred.tif:,,,,res_inch:300
147
148 Writes fred.v as a tiff file, with the resolution in the tiff header
149 set to 300 dpi.
150
151
153 im_istiff(3), im_istifftiled(3), im_istiffpyramid(3)
154
156 Hey, you want this? You have it!
157
158
159
160 6 June 1994 IM_TIFF(3)