]> git.saurik.com Git - wxWidgets.git/blob - src/tiff/man/TIFFReadRGBAImage.3tiff
2800c3a948013bae0ee7eba821750f02ee20872f
[wxWidgets.git] / src / tiff / man / TIFFReadRGBAImage.3tiff
1 .\"
2 .\" Copyright (c) 1991-1997 Sam Leffler
3 .\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
4 .\"
5 .\" Permission to use, copy, modify, distribute, and sell this software and
6 .\" its documentation for any purpose is hereby granted without fee, provided
7 .\" that (i) the above copyright notices and this permission notice appear in
8 .\" all copies of the software and related documentation, and (ii) the names of
9 .\" Sam Leffler and Silicon Graphics may not be used in any advertising or
10 .\" publicity relating to the software without the specific, prior written
11 .\" permission of Sam Leffler and Silicon Graphics.
12 .\"
13 .\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14 .\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15 .\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16 .\"
17 .\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
18 .\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19 .\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20 .\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21 .\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22 .\" OF THIS SOFTWARE.
23 .\"
24 .if n .po 0
25 .TH TIFFReadRGBAImage 3TIFF "October 13, 2006" "libtiff"
26 .SH NAME
27 TIFFReadRGBAImage, TIFFReadRGBAImageOriented \- read and decode an image
28 into a fixed-format raster
29 .SH SYNOPSIS
30 .B "#include <tiffio.h>"
31 .sp
32 .B "#define TIFFGetR(abgr) ((abgr) & 0xff)"
33 .br
34 .B "#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)"
35 .br
36 .B "#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)"
37 .br
38 .B "#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)"
39 .sp
40 .BI "int TIFFReadRGBAImage(TIFF *" tif ", uint32 " width ", uint32 " height ", uint32 *" raster ", int " stopOnError ")"
41 .br
42 .BI "int TIFFReadRGBAImageOriented(TIFF *" tif ", uint32 " width ", uint32 " height ", uint32 *" raster ", int " orientation ", int " stopOnError ")"
43 .br
44 .SH DESCRIPTION
45 .IR TIFFReadRGBAImage
46 reads a strip- or tile-based image into memory, storing the
47 result in the user supplied
48 .IR raster .
49 The raster is assumed to be an array of
50 .I width
51 times
52 .I height
53 32-bit entries, where
54 .I width
55 must be less than or equal to the width of the image (\c
56 .I height
57 may be any non-zero size).
58 If the raster dimensions are smaller than the image, the image data
59 is cropped to the raster bounds.
60 If the raster height is greater than that of the image, then the
61 image data are placed in the lower part of the raster.
62 (Note that the raster is assume to be organized such that the pixel
63 at location (\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP];
64 with the raster origin in the lower-left hand corner.)
65 .PP
66 .IR TIFFReadRGBAImageOriented
67 works like
68 .IR TIFFReadRGBAImage
69 with except of that user can specify the raster origin position with the
70 .I orientation
71 parameter. Four orientations supported:
72 .TP
73 .B ORIENTATION_TOPLEFT
74 origin in top-left corner,
75 .TP
76 .B ORIENTATION_TOPRIGHT
77 origin in top-right corner,
78 .TP
79 .B ORIENTATION_BOTLEFT
80 origin in bottom-left corner
81 and
82 .TP
83 .B ORIENTATION_BOTRIGHT
84 origin in bottom-right corner.
85 .LP
86 If you choose
87 .B ORIENTATION_BOTLEFT
88 result will be the same as returned by the
89 .IR TIFFReadRGBAImage.
90 .PP
91 Raster pixels are 8-bit packed red, green, blue, alpha samples.
92 The macros
93 .IR TIFFGetR ,
94 .IR TIFFGetG ,
95 .IR TIFFGetB ,
96 and
97 .I TIFFGetA
98 should be used to access individual samples.
99 Images without Associated Alpha matting information have a constant
100 Alpha of 1.0 (255).
101 .PP
102 .I TIFFReadRGBAImage
103 converts non-8-bit images by scaling sample values.
104 Palette, grayscale, bilevel,
105 .SM CMYK\c
106 , and YCbCr images are converted to
107 .SM RGB
108 transparently.
109 Raster pixels are returned uncorrected by any colorimetry information
110 present in the directory.
111 .PP
112 The paramater
113 .I stopOnError
114 specifies how to act if an error is encountered while reading
115 the image.
116 If
117 .I stopOnError
118 is non-zero, then an error will terminate the operation; otherwise
119 .I TIFFReadRGBAImage
120 will continue processing data until all the possible data in the
121 image have been requested.
122 .SH NOTES
123 In C++ the
124 .I stopOnError
125 parameter defaults to 0.
126 .PP
127 Samples must be either 1, 2, 4, 8, or 16 bits.
128 Colorimetric samples/pixel must be either 1, 3, or 4 (i.e.
129 .I SamplesPerPixel
130 minus
131 .IR ExtraSamples ).
132 .PP
133 Palettte image colormaps that appear to be incorrectly written
134 as 8-bit values are automatically scaled to 16-bits.
135 .PP
136 .I TIFFReadRGBAImage
137 is just a wrapper around the more general
138 .IR TIFFRGBAImage (3TIFF)
139 facilities.
140 .SH "RETURN VALUES"
141 1 is returned if the image was successfully read and converted.
142 Otherwise, 0 is returned if an error was encountered and
143 .I stopOnError
144 is zero.
145 .SH DIAGNOSTICS
146 All error messages are directed to the
147 .IR TIFFError (3TIFF)
148 routine.
149 .PP
150 .BR "Sorry, can not handle %d-bit pictures" .
151 The image had
152 .I BitsPerSample
153 other than 1, 2, 4, 8, or 16.
154 .PP
155 .BR "Sorry, can not handle %d-channel images" .
156 The image had
157 .I SamplesPerPixel
158 other than 1, 3, or 4.
159 .PP
160 \fBMissing needed "PhotometricInterpretation" tag\fP.
161 The image did not have a tag that describes how to display
162 the data.
163 .PP
164 \fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
165 The image was missing a tag that describes how to display it,
166 but because it has 3 or 4 samples/pixel, it is assumed to be
167 .SM RGB.
168 .PP
169 \fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP.
170 The image was missing a tag that describes how to display it,
171 but because it has 1 sample/pixel, it is assumed to be a grayscale
172 or bilevel image.
173 .PP
174 .BR "No space for photometric conversion table" .
175 There was insufficient memory for a table used to convert
176 image samples to 8-bit
177 .SM RGB.
178 .PP
179 \fBMissing required "Colormap" tag\fP.
180 A Palette image did not have a required
181 .I Colormap
182 tag.
183 .PP
184 .BR "No space for tile buffer" .
185 There was insufficient memory to allocate an i/o buffer.
186 .PP
187 .BR "No space for strip buffer" .
188 There was insufficient memory to allocate an i/o buffer.
189 .PP
190 .BR "Can not handle format" .
191 The image has a format (combination of
192 .IR BitsPerSample ,
193 .IR SamplesPerPixel ,
194 and
195 .IR PhotometricInterpretation )
196 that
197 .I TIFFReadRGBAImage
198 can not handle.
199 .PP
200 .BR "No space for B&W mapping table" .
201 There was insufficient memory to allocate a table used to map
202 grayscale data to
203 .SM RGB.
204 .PP
205 .BR "No space for Palette mapping table" .
206 There was insufficient memory to allocate a table used to map
207 data to 8-bit
208 .SM RGB.
209 .SH "SEE ALSO"
210 .BR TIFFOpen (3TIFF),
211 .BR TIFFRGBAImage (3TIFF),
212 .BR TIFFReadRGBAStrip (3TIFF),
213 .BR TIFFReadRGBATile (3TIFF),
214 .BR libtiff (3TIFF)
215 .PP
216 Libtiff library home page:
217 .BR http://www.remotesensing.org/libtiff/