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