1TIFFReadRGBATile(3TIFF) TIFFReadRGBATile(3TIFF)
2
3
4
6 TIFFReadRGBATile - read and decode an image tile into a fixed-format
7 raster
8
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 TIFFReadRGBATile(TIFF *tif, uint32 x, uint32 y, uint32 *raster)
18
20 TIFFReadRGBATile reads a single tile of a tile-based image into memory,
21 storing the result in the user supplied RGBA raster. The raster is
22 assumed to be an array of width times length 32-bit entries, where
23 width is the width of a tile (TIFFTAG_TILEWIDTH) and length is the
24 height of a tile (TIFFTAG_TILELENGTH).
25
26
27 The x and y values are the offsets from the top left corner to the top
28 left corner of the tile to be read. They must be an exact multiple of
29 the tile width and length.
30
31
32 Note that the raster is assume to be organized such that the pixel at
33 location (x,y) is raster[y*width+x]; with the raster origin in the
34 lower-left hand corner of the tile. That is bottom to top organization.
35 Edge tiles which partly fall off the image will be filled out with
36 appropriate zeroed areas.
37
38
39 Raster pixels are 8-bit packed red, green, blue, alpha samples. The
40 macros TIFFGetR, TIFFGetG, TIFFGetB, and TIFFGetA should be used to
41 access individual samples. Images without Associated Alpha matting
42 information have a constant Alpha of 1.0 (255).
43
44 See the TIFFRGBAImage(3TIFF) page for more details on how various image
45 types are converted to RGBA values.
46
48 Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric sam‐
49 ples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus
50 ExtraSamples).
51
52 Palette image colormaps that appear to be incorrectly written as 8-bit
53 values are automatically scaled to 16-bits.
54
55 TIFFReadRGBATile is just a wrapper around the more general TIFFRGBAIm‐
56 age(3TIFF) facilities. It's main advantage over the similar TIFFRead‐
57 RGBAImage() function is that for large images a single buffer capable
58 of holding the whole image doesn't need to be allocated, only enough
59 for one tile. The TIFFReadRGBAStrip() function does a similar opera‐
60 tion for stripped images.
61
63 1 is returned if the image was successfully read and converted. Other‐
64 wise, 0 is returned if an error was encountered.
65
67 All error messages are directed to the TIFFError(3TIFF) routine.
68
69 Sorry, can not handle %d-bit pictures. The image had BitsPerSample
70 other than 1, 2, 4, 8, or 16.
71
72 Sorry, can not handle %d-channel images. The image had SamplesPerPixel
73 other than 1, 3, or 4.
74
75 Missing needed "PhotometricInterpretation" tag. The image did not have
76 a tag that describes how to display the data.
77
78 No "PhotometricInterpretation" tag, assuming RGB. The image was miss‐
79 ing a tag that describes how to display it, but because it has 3 or 4
80 samples/pixel, it is assumed to be RGB.
81
82 No "PhotometricInterpretation" tag, assuming min-is-black. The image
83 was missing a tag that describes how to display it, but because it has
84 1 sample/pixel, it is assumed to be a grayscale or bilevel image.
85
86 No space for photometric conversion table. There was insufficient mem‐
87 ory for a table used to convert image samples to 8-bit RGB.
88
89 Missing required "Colormap" tag. A Palette image did not have a
90 required Colormap tag.
91
92 No space for tile buffer. There was insufficient memory to allocate an
93 i/o buffer.
94
95 No space for strip buffer. There was insufficient memory to allocate
96 an i/o buffer.
97
98 Can not handle format. The image has a format (combination of BitsPer‐
99 Sample, SamplesPerPixel, and PhotometricInterpretation) that TIFFRead‐
100 RGBAImage can not handle.
101
102 No space for B&W mapping table. There was insufficient memory to allo‐
103 cate a table used to map grayscale data to RGB.
104
105 No space for Palette mapping table. There was insufficient memory to
106 allocate a table used to map data to 8-bit RGB.
107
109 TIFFOpen(3TIFF), TIFFRGBAImage(3TIFF), TIFFReadRGBAImage(3TIFF), TIFF‐
110 ReadRGBAStrip(3TIFF), libtiff(3TIFF)
111
112 Libtiff library home page: http://www.remotesensing.org/libtiff/
113
114
115
116libtiff December 10, 1998 TIFFReadRGBATile(3TIFF)