TIFFREADRGBAIMAGE(3tiff)
β¨ NAME β¨
TIFFReadRGBAImage β read and decode an image into a fixed-format raster π
okay bestie, this is the LibTIFF 3tiff manual page and it's literally the one that turns your cursed TIFF into a nice little pile of RGBA pixels. no cap. let's go π«Ά
πΈ SYNOPSIS πΈ
#include <tiffio.h>
TIFFGetR(abgr)
((abgr)&0xff)
TIFFGetG(abgr)
(((abgr) >> 8) & 0xff)
TIFFGetB(abgr)
(((abgr) >> 16) & 0xff)
TIFFGetA(abgr)
(((abgr) >> 24) & 0xff)
int TIFFReadRGBAImage(TIFF *tif, uint32_t width, uint32_t height,
uint32_t *raster, int stopOnError)
int TIFFReadRGBAImageOriented(TIFF *tif, uint32_t width, uint32_t
height, uint32_t *raster, int orientation, int stopOnError)
those four macros are your lil keys to the pixel vault, and the two functions are the actual main characters π₯
π DESCRIPTION π
TIFFReadRGBAImage() reads a strip- or tile-based image into memory and stores the result in the raster that you supply. the raster is assumed to be an array of width Γ height 32-bit entries, where width must be less than or equal to the width of the image (height may be any non-zero size). if your raster dimensions are smaller than the image, the image data gets cropped to the raster bounds. if the raster height is greater than the image's, then the image data are placed in the lower part of the raster.
note that the raster is assume 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. (yes, "assume" β that's the original wording, we don't fix it, we respect it π)
TIFFReadRGBAImageOriented() works like TIFFReadRGBAImage() except that you get to specify the raster origin position with the orientation parameter. four orientations are supported:
ORIENTATION_TOPLEFT: origin in top-left corner,ORIENTATION_TOPRIGHT: origin in top-right corner,ORIENTATION_BOTLEFT: origin in bottom-left cornerORIENTATION_BOTRIGHT: origin in bottom-right corner.
if you choose ORIENTATION_BOTLEFT, the result will be the same as returned by the TIFFReadRGBAImage(). slay, consistency π
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. images without Associated Alpha matting information have a constant Alpha of 1.0 (255).
TIFFReadRGBAImage() converts non-8-bit images by scaling sample values. Palette, grayscale, bilevel, CMYK, and YCbCr images are converted to RGB transparently. raster pixels are returned uncorrected by any colorimetry information present in the directory. it's giving "we just hand you the pixels, no glow-up applied" β¨
the parameter stopOnError specifies how to act if an error is encountered while reading the image. if stopOnError is non-zero, then an error will terminate the operation; otherwise TIFFReadRGBAImage() will continue processing data until all the possible data in the image have been requested. pick your fighter π₯
π¦ NOTES π¦
IFFReadRGBAImage() is just a wrapper around the more general TIFFRGBAImage facilities.
for general notes see TIFFRGBImage notes.
(and yes, the first one says IFFReadRGBAImage() β that's the original spelling, we do not edit the ancestors π«Ά)
π RETURN VALUES π
1 is returned if the image was successfully read and converted. otherwise, 0 is returned if an error was encountered and stopOnError is zero.
π₯ DIAGNOSTICS π₯
all error messages are directed to the TIFFErrorExtR() routine.
- "Sorry, can not handle %d-bit pictures" β the image had
BitsPerSampleother than1,2,4,8, or16. - "Sorry, can not handle %d-channel images" β the image had
SamplesPerPixelother 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 of
BitsPerSample,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.
the memory ones are literally just "we ran out of RAM bestie", and the format ones are "this image is built different and we can't even" π
π SEE ALSO π
TIFFOpen (3tiff), TIFFRGBAImage (3tiff), TIFFReadRGBAStrip (3tiff), TIFFReadRGBATile (3tiff), libtiff (3tiff)
π AUTHOR π
LibTIFF contributors β absolute icons, every single one π
β COPYRIGHT β
1988-2025, LibTIFF contributors
and that's the whole vibe check, bestie π§ this was LibTIFF version 4.7, dated Jun 27, 2026, and it lives in the TIFFREADRGBAIMAGE(3tiff) manual page. go read some pixels, you ate π
ππΈ
π¦ 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