TIFFREADRGBASTRIP(3tiff)
๐ TIFFReadRGBAStrip โ bestie edition ๐
okay so you're here because you want to read ONE strip of a TIFF and get RGBA out of it, and honestly? valid. this is TIFFReadRGBAStrip from LibTIFF, living in the 3tiff manual section, and I'm gonna walk you through it like we're texting at 2am. ๐ฆ
โจ NAME โจ
TIFFReadRGBAStrip โ read and decode an image strip into a fixed-format raster. that's the whole vibe. ๐
โจ SYNOPSIS โจ
#include <tiffio.h>
int TIFFReadRGBAStrip(TIFF *tif, uint32_t row, uint32_t *raster)
int TIFFReadRGBAStripExt(TIFF *tif, uint32_t row, uint32_t *raster, int stop_on_error)
โจ DESCRIPTION โจ
so TIFFReadRGBAStrip() reads a single strip of a strip-based image into memory and drops the result into the RGBA raster you supply. it's giving "I don't need the whole image, just this one strip, thanks." ๐
the raster is assumed to be an array of ImageWidth ร RowsPerStrip 32-bit entries, where ImageWidth is the width of the image (TIFFTAG_IMAGEWIDTH) and RowsPerStrip is the maximum lines in a strip (TIFFTAG_ROWSPERSTRIP). do the math, allocate accordingly, no cap. ๐งฎ
TIFFReadRGBAStripExt() is the same girl but she brings a friend: the stop_on_error parameter. its behaviour is described over at TIFFReadRGBAImage. go look, iykyk. ๐
the row value should be the row of the first row in the strip โ that's strip ร RowsPerStrip, zero based. zero based!! do not forget!! ๐ญ
โ ๏ธ okay important: the raster is assumed to be organized such that the pixel at location (x, y) is raster [ y ร width + x ], with the raster origin in the lower-left hand corner of the strip. that is bottom to top organization. so it's not top-down like your brain wants it to be. ๐ when reading a partial last strip in the file, the last line of the image will begin at the beginning of the buffer.
raster pixels are 8-bit packed red, green, blue, alpha samples. the macros TIFFGetR, TIFFGetG, TIFFGetB, and TIFFGetA should be used to access individual samples โ don't go poking bytes yourself bestie. ๐ images without Associated Alpha matting information have a constant Alpha of 1.0 (255).
for the deets on how various image types get converted to RGBA values, see the TIFFRGBAImage page. she explains everything. ๐
โจ NOTES โจ
ngl, TIFFReadRGBAStrip() is just a wrapper around the more general TIFFRGBAImage facilities. its main advantage over the similar TIFFReadRGBAImage() function is that for large images a single buffer capable of holding the whole image doesn't need to be allocated โ only enough for one strip. memory stays cute and small. ๐ธ
the TIFFReadRGBATile() function does a similar operation for tiled images, in case your image is that girl instead. โจ
for general notes see TIFFRGBImage notes. ๐
โจ RETURN VALUES โจ
1 is returned if the image was successfully read and converted. otherwise, 0 is returned if an error was encountered.
so: 1 = slay, 0 = not slay. periodt. ๐
โจ DIAGNOSTICS โจ
all error messages are directed to the TIFFErrorExtR() routine. here's the full roster of complaints she might throw at you: ๐
"Sorry, can not handle %d-bit pictures"โ the image hadBitsPerSampleother than1,2,4,8, or16."Sorry, can not handle %d-channel images"โ the image hadSamplesPerPixelother than1,3, or4.- Missing needed
"PhotometricInterpretation"tag โ the image did not have a tag that describes how to display the data. - No
"PhotometricInterpretation"tag, assuming RGB โ the image was missing a tag that describes how to display it, but because it has 3 or 4 samples/pixel, it is assumed to be RGB. - No
"PhotometricInterpretation"tag, assuming min-is-black โ the image was missing a tag that describes how to display it, but because it has 1 sample/pixel, it is assumed to be a grayscale or bilevel image. "No space for photometric conversion table"โ there was insufficient memory for a table used to convert image samples to 8-bit RGB.- Missing required
"Colormap"tag โ a Palette image did not have a required Colormap tag. "No space for tile buffer"โ there was insufficient memory to allocate an i/o buffer."No space for strip buffer"โ there was insufficient memory to allocate an i/o buffer."Can not handle format"โ the image has a format (combination ofBitsPerSample,SamplesPerPixel, andPhotometricInterpretation) thatTIFFReadRGBAImage()can not handle."No space for B&W mapping table"โ there was insufficient memory to allocate a table used to map grayscale data to RGB."No space for Palette mapping table"โ there was insufficient memory to allocate a table used to map data to 8-bit RGB.
โจ SEE ALSO โจ
TIFFOpen(3tiff)TIFFRGBAImage(3tiff)TIFFReadRGBAImage(3tiff)TIFFReadRGBATile(3tiff)libtiff(3tiff)
โจ AUTHOR โจ
LibTIFF contributors ๐ซถ
โจ COPYRIGHT โจ
1988-2025, LibTIFF contributors
and that's the whole page bestie!! ๐ this was LibTIFF version 4.7, dated Jun 27, 2026 โ go read a strip, stay bottom-to-top, and don't forget your TIFFGetR/TIFFGetG/TIFFGetB/TIFFGetA macros. mwah. ๐
โจ๐
๐ฆ where this page comes from
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-3.fc43 ยท libtiff
- fedora 43: libtiff-devel 4.7.2-3.fc43 ยท libtiff
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-3.fc44 ยท libtiff
- fedora 44: libtiff-devel 4.7.2-3.fc44 ยท libtiff
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms