1TIFFReadRGBAImage(3TIFF)                              TIFFReadRGBAImage(3TIFF)
2
3
4

NAME

6       TIFFReadRGBAImage, TIFFReadRGBAImageOriented - read and decode an image
7       into a fixed-format raster
8

SYNOPSIS

10       #include <tiffio.h>
11
12       #define TIFFGetR(abgr) ((abgr) & 0xff)
13       #define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)
14       #define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)
15       #define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)
16
17       int TIFFReadRGBAImage(TIFF *tif, uint32 width,  uint32  height,  uint32
18       *raster, int stopOnError)
19       int  TIFFReadRGBAImageOriented(TIFF  *tif, uint32 width, uint32 height,
20       uint32 *raster, int orientation, int stopOnError)
21

DESCRIPTION

23       TIFFReadRGBAImage reads a strip- or tile-based image into memory, stor‐
24       ing  the  result in the user supplied raster.  The raster is assumed to
25       be an array of width times height 32-bit entries, where width  must  be
26       less  than  or  equal to the width of the image (height may be any non-
27       zero size).  If the raster dimensions are smaller than the  image,  the
28       image  data  is  cropped to the raster bounds.  If the raster height is
29       greater than that of the image, then the image data are placed  in  the
30       lower  part of the raster.  (Note that the raster is assume to be orga‐
31       nized such that the pixel at location (x,y) is raster[y*width+x];  with
32       the raster origin in the lower-left hand corner.)
33
34       TIFFReadRGBAImageOriented  works  like TIFFReadRGBAImage with except of
35       that user can specify the raster origin position with  the  orientation
36       parameter. Four orientations supported:
37
38       ORIENTATION_TOPLEFT
39              origin in top-left corner,
40
41       ORIENTATION_TOPRIGHT
42              origin in top-right corner,
43
44       ORIENTATION_BOTLEFT
45              origin in bottom-left corner and
46
47       ORIENTATION_BOTRIGHT
48              origin in bottom-right corner.
49
50       If  you  choose ORIENTATION_BOTLEFT result will be the same as returned
51       by the TIFFReadRGBAImage.
52
53       Raster pixels are 8-bit packed red, green, blue,  alpha  samples.   The
54       macros  TIFFGetR,  TIFFGetG,  TIFFGetB,  and TIFFGetA should be used to
55       access individual samples.  Images  without  Associated  Alpha  matting
56       information have a constant Alpha of 1.0 (255).
57
58       TIFFReadRGBAImage  converts  non-8-bit images by scaling sample values.
59       Palette, grayscale, bilevel, CMYK, and YCbCr images  are  converted  to
60       RGB  transparently.  Raster pixels are returned uncorrected by any col‐
61       orimetry information present in the directory.
62
63       The paramater stopOnError specifies how to act if an error  is  encoun‐
64       tered  while  reading  the  image.  If stopOnError is non-zero, then an
65       error will terminate the operation;  otherwise  TIFFReadRGBAImage  will
66       continue  processing data until all the possible data in the image have
67       been requested.
68

NOTES

70       In C++ the stopOnError parameter defaults to 0.
71
72       Samples must be either 1, 2, 4,  8,  or  16  bits.   Colorimetric  sam‐
73       ples/pixel  must  be  either  1,  3,  or 4 (i.e.  SamplesPerPixel minus
74       ExtraSamples).
75
76       Palettte image colormaps that appear to be incorrectly written as 8-bit
77       values are automatically scaled to 16-bits.
78
79       TIFFReadRGBAImage is just a wrapper around the more general TIFFRGBAIm‐
80       age(3TIFF) facilities.
81

RETURN VALUES

83       1 is returned if the image was successfully read and converted.  Other‐
84       wise,  0  is  returned  if  an error was encountered and stopOnError is
85       zero.
86

DIAGNOSTICS

88       All error messages are directed to the TIFFError(3TIFF) routine.
89
90       Sorry, can not handle %d-bit pictures.   The  image  had  BitsPerSample
91       other than 1, 2, 4, 8, or 16.
92
93       Sorry, can not handle %d-channel images.  The image had SamplesPerPixel
94       other than 1, 3, or 4.
95
96       Missing needed "PhotometricInterpretation" tag.  The image did not have
97       a tag that describes how to display the data.
98
99       No  "PhotometricInterpretation" tag, assuming RGB.  The image was miss‐
100       ing a tag that describes how to display it, but because it has 3  or  4
101       samples/pixel, it is assumed to be RGB.
102
103       No  "PhotometricInterpretation"  tag, assuming min-is-black.  The image
104       was missing a tag that describes how to display it, but because it  has
105       1 sample/pixel, it is assumed to be a grayscale or bilevel image.
106
107       No space for photometric conversion table.  There was insufficient mem‐
108       ory for a table used to convert image samples to 8-bit RGB.
109
110       Missing required "Colormap" tag.   A  Palette  image  did  not  have  a
111       required Colormap tag.
112
113       No space for tile buffer.  There was insufficient memory to allocate an
114       i/o buffer.
115
116       No space for strip buffer.  There was insufficient memory  to  allocate
117       an i/o buffer.
118
119       Can not handle format.  The image has a format (combination of BitsPer‐
120       Sample, SamplesPerPixel, and PhotometricInterpretation) that  TIFFRead‐
121       RGBAImage can not handle.
122
123       No space for B&W mapping table.  There was insufficient memory to allo‐
124       cate a table used to map grayscale data to RGB.
125
126       No space for Palette mapping table.  There was insufficient  memory  to
127       allocate a table used to map data to 8-bit RGB.
128

SEE ALSO

130       TIFFOpen(3TIFF),  TIFFRGBAImage(3TIFF), TIFFReadRGBAStrip(3TIFF), TIFF‐
131       ReadRGBATile(3TIFF), libtiff(3TIFF)
132
133       Libtiff library home page: http://www.simplesystems.org/libtiff/
134
135
136
137libtiff                        October 13, 2006       TIFFReadRGBAImage(3TIFF)
Impressum