Tiff.readRGBAImage
Reads the whole image converted to RGB color data.
Category: Data Import and Analysis > Data Import and Export
Syntax
A = readRGBAImage(t)
Returns the image as color pixels regardless of how it is stored.
Description
The method acts on a Tiff object created with Tiff(filename, mode). The library converts any supported photometric interpretation (grayscale, palette, YCbCr and others) to RGB for you, which is handy for display. The conversion is always to 8 bits, so use read when you need the stored values.
Input arguments
tTiffobject opened for reading.
Output arguments
Auint8array with one plane per color channel.
Example
Grayscale as color
tag.ImageLength = 8; tag.ImageWidth = 8;
tag.Photometric = Tiff.Photometric.MinIsBlack;
tag.BitsPerSample = 8; tag.SamplesPerPixel = 1; tag.RowsPerStrip = 4;
tag.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
I = uint8(magic(8) * 3);
w = Tiff('t.tif', 'w'); w.setTag(tag); w.write(I); w.close();
r = Tiff('t.tif', 'r');
C = r.readRGBAImage();
class(C)
size(C, 1:2)
r.close();
Output
ans = 'uint8'
ans = 1×2
8 8
Notes
MatLivre returns three color planes (RGB) and no alpha plane.