1<!-- Creator     : groff version 1.19.2 -->
2<!-- CreationDate: Mon Jan  2 17:41:41 2006 -->
3<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
4"http://www.w3.org/TR/html4/loose.dtd">
5<html>
6<head>
7<meta name="generator" content="groff -Thtml, see www.gnu.org">
8<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
9<meta name="Content-Style" content="text/css">
10<style type="text/css">
11       p     { margin-top: 0; margin-bottom: 0; }
12       pre   { margin-top: 0; margin-bottom: 0; }
13       table { margin-top: 0; margin-bottom: 0; }
14</style>
15<title>TIFFReadRGBAImage</title>
16
17</head>
18<body>
19
20<h1 align=center>TIFFReadRGBAImage</h1>
21
22<a href="#NAME">NAME</a><br>
23<a href="#SYNOPSIS">SYNOPSIS</a><br>
24<a href="#DESCRIPTION">DESCRIPTION</a><br>
25<a href="#NOTES">NOTES</a><br>
26<a href="#RETURN VALUES">RETURN VALUES</a><br>
27<a href="#DIAGNOSTICS">DIAGNOSTICS</a><br>
28<a href="#SEE ALSO">SEE ALSO</a><br>
29
30<hr>
31
32
33<a name="NAME"></a>
34<h2>NAME</h2>
35
36
37
38<p style="margin-left:11%; margin-top: 1em">TIFFReadRGBAImage,
39TIFFReadRGBAImageOriented &minus; read and decode an image
40into a fixed-format raster</p>
41
42<a name="SYNOPSIS"></a>
43<h2>SYNOPSIS</h2>
44
45
46<p style="margin-left:11%; margin-top: 1em"><b>#include
47&lt;tiffio.h&gt;</b></p>
48
49<p style="margin-left:11%; margin-top: 1em"><b>#define
50TIFFGetR(abgr) ((abgr) &amp; 0xff) <br>
51#define TIFFGetG(abgr) (((abgr) &gt;&gt; 8) &amp; 0xff) <br>
52#define TIFFGetB(abgr) (((abgr) &gt;&gt; 16) &amp; 0xff)
53<br>
54#define TIFFGetA(abgr) (((abgr) &gt;&gt; 24) &amp;
550xff)</b></p>
56
57<p style="margin-left:11%; margin-top: 1em"><b>int
58TIFFReadRGBAImage(TIFF *</b><i>tif</i><b>, u_long</b>
59<i>width</i><b>, u_long</b> <i>height</i><b>, u_long
60*</b><i>raster</i><b>, int</b> <i>stopOnError</i><b>) <br>
61int TIFFReadRGBAImageOriented(TIFF *</b><i>tif</i><b>,
62u_long</b> <i>width</i><b>, u_long</b> <i>height</i><b>,
63u_long *</b><i>raster</i><b>, int</b> <i>orientation</i><b>,
64int</b> <i>stopOnError</i><b>)</b></p>
65
66<a name="DESCRIPTION"></a>
67<h2>DESCRIPTION</h2>
68
69
70
71<p style="margin-left:11%; margin-top: 1em"><i>TIFFReadRGBAImage</i>
72reads a strip- or tile-based image into memory, storing the
73result in the user supplied <i>raster</i>. The raster is
74assumed to be an array of <i>width</i> times <i>height</i>
7532-bit entries, where <i>width</i> must be less than or
76equal to the width of the image (<i>height</i> may be any
77non-zero size). If the raster dimensions are smaller than
78the image, the image data is cropped to the raster bounds.
79If the raster height is greater than that of the image, then
80the image data are placed in the lower part of the raster.
81(Note that the raster is assume to be organized such that
82the pixel at location (<i>x</i>,<i>y</i>) is
83<i>raster</i>[<i>y</i>*<i>width</i>+<i>x</i>]; with the
84raster origin in the lower-left hand corner.)</p>
85
86
87<p style="margin-left:11%; margin-top: 1em"><i>TIFFReadRGBAImageOriented</i>
88works like <i>TIFFReadRGBAImage</i> with except of that user
89can specify the raster origin position with the
90<i>orientation</i> parameter. Four orientations supported:
91<b><br>
92ORIENTATION_TOPLEFT</b></p>
93
94<p style="margin-left:22%;">origin in top-left corner,</p>
95
96
97<p style="margin-left:11%;"><b>ORIENTATION_TOPRIGHT</b></p>
98
99<p style="margin-left:22%;">origin in top-right corner,</p>
100
101<p style="margin-left:11%;"><b>ORIENTATION_BOTLEFT</b></p>
102
103<p style="margin-left:22%;">origin in bottom-left corner
104and</p>
105
106
107<p style="margin-left:11%;"><b>ORIENTATION_BOTRIGHT</b></p>
108
109<p style="margin-left:22%;">origin in bottom-right
110corner.</p>
111
112<p style="margin-left:11%; margin-top: 1em">If you choose
113<b>ORIENTATION_BOTLEFT</b> result will be the same as
114returned by the <i>TIFFReadRGBAImage.</i></p>
115
116<p style="margin-left:11%; margin-top: 1em">Raster pixels
117are 8-bit packed red, green, blue, alpha samples. The macros
118<i>TIFFGetR</i>, <i>TIFFGetG</i>, <i>TIFFGetB</i>, and
119<i>TIFFGetA</i> should be used to access individual samples.
120Images without Associated Alpha matting information have a
121constant Alpha of 1.0 (255).</p>
122
123
124<p style="margin-left:11%; margin-top: 1em"><i>TIFFReadRGBAImage</i>
125converts non-8-bit images by scaling sample values. Palette,
126grayscale, bilevel, <small>CMYK</small> , and YCbCr images
127are converted to <small>RGB</small> transparently. Raster
128pixels are returned uncorrected by any colorimetry
129information present in the directory.</p>
130
131<p style="margin-left:11%; margin-top: 1em">The paramater
132<i>stopOnError</i> specifies how to act if an error is
133encountered while reading the image. If <i>stopOnError</i>
134is non-zero, then an error will terminate the operation;
135otherwise <i>TIFFReadRGBAImage</i> will continue processing
136data until all the possible data in the image have been
137requested.</p>
138
139<a name="NOTES"></a>
140<h2>NOTES</h2>
141
142
143<p style="margin-left:11%; margin-top: 1em">In C++ the
144<i>stopOnError</i> parameter defaults to 0.</p>
145
146<p style="margin-left:11%; margin-top: 1em">Samples must be
147either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel
148must be either 1, 3, or 4 (i.e. <i>SamplesPerPixel</i> minus
149<i>ExtraSamples</i>).</p>
150
151<p style="margin-left:11%; margin-top: 1em">Palettte image
152colormaps that appear to be incorrectly written as 8-bit
153values are automatically scaled to 16-bits.</p>
154
155
156<p style="margin-left:11%; margin-top: 1em"><i>TIFFReadRGBAImage</i>
157is just a wrapper around the more general
158<i>TIFFRGBAImage</i>(3TIFF) facilities.</p>
159
160<a name="RETURN VALUES"></a>
161<h2>RETURN VALUES</h2>
162
163
164<p style="margin-left:11%; margin-top: 1em">1 is returned
165if the image was successfully read and converted. Otherwise,
1660 is returned if an error was encountered and
167<i>stopOnError</i> is zero.</p>
168
169<a name="DIAGNOSTICS"></a>
170<h2>DIAGNOSTICS</h2>
171
172
173<p style="margin-left:11%; margin-top: 1em">All error
174messages are directed to the <i>TIFFError</i>(3TIFF)
175routine.</p>
176
177<p style="margin-left:11%; margin-top: 1em"><b>Sorry, can
178not handle %d-bit pictures</b>. The image had
179<i>BitsPerSample</i> other than 1, 2, 4, 8, or 16.</p>
180
181<p style="margin-left:11%; margin-top: 1em"><b>Sorry, can
182not handle %d-channel images</b>. The image had
183<i>SamplesPerPixel</i> other than 1, 3, or 4.</p>
184
185<p style="margin-left:11%; margin-top: 1em"><b>Missing
186needed &quot;PhotometricInterpretation&quot; tag</b>. The
187image did not have a tag that describes how to display the
188data.</p>
189
190<p style="margin-left:11%; margin-top: 1em"><b>No
191&quot;PhotometricInterpretation&quot; tag, assuming RGB</b>.
192The image was missing a tag that describes how to display
193it, but because it has 3 or 4 samples/pixel, it is assumed
194to be <small>RGB.</small></p>
195
196<p style="margin-left:11%; margin-top: 1em"><b>No
197&quot;PhotometricInterpretation&quot; tag, assuming
198min-is-black</b>. The image was missing a tag that describes
199how to display it, but because it has 1 sample/pixel, it is
200assumed to be a grayscale or bilevel image.</p>
201
202<p style="margin-left:11%; margin-top: 1em"><b>No space for
203photometric conversion table</b>. There was insufficient
204memory for a table used to convert image samples to 8-bit
205<small>RGB.</small></p>
206
207<p style="margin-left:11%; margin-top: 1em"><b>Missing
208required &quot;Colormap&quot; tag</b>. A Palette image did
209not have a required <i>Colormap</i> tag.</p>
210
211<p style="margin-left:11%; margin-top: 1em"><b>No space for
212tile buffer</b>. There was insufficient memory to allocate
213an i/o buffer.</p>
214
215<p style="margin-left:11%; margin-top: 1em"><b>No space for
216strip buffer</b>. There was insufficient memory to allocate
217an i/o buffer.</p>
218
219<p style="margin-left:11%; margin-top: 1em"><b>Can not
220handle format</b>. The image has a format (combination of
221<i>BitsPerSample</i>, <i>SamplesPerPixel</i>, and
222<i>PhotometricInterpretation</i>) that
223<i>TIFFReadRGBAImage</i> can not handle.</p>
224
225<p style="margin-left:11%; margin-top: 1em"><b>No space for
226B&amp;W mapping table</b>. There was insufficient memory to
227allocate a table used to map grayscale data to
228<small>RGB.</small></p>
229
230<p style="margin-left:11%; margin-top: 1em"><b>No space for
231Palette mapping table</b>. There was insufficient memory to
232allocate a table used to map data to 8-bit
233<small>RGB.</small></p>
234
235<a name="SEE ALSO"></a>
236<h2>SEE ALSO</h2>
237
238
239
240<p style="margin-left:11%; margin-top: 1em"><b>TIFFOpen</b>(3TIFF),
241<b>TIFFRGBAImage</b>(3TIFF),
242<b>TIFFReadRGBAStrip</b>(3TIFF),
243<b>TIFFReadRGBATile</b>(3TIFF), <b>libtiff</b>(3TIFF)</p>
244
245<p style="margin-left:11%; margin-top: 1em">Libtiff library
246home page: <b>http://www.remotesensing.org/libtiff/</b></p>
247<hr>
248</body>
249</html>
250