Tiff.readRGBATile

Reads one tile converted to RGB color data.

Category: Data Import and Analysis > Data Import and Export

Syntax

A = readRGBATile(t, row, col)

Returns the tile whose upper-left pixel is at row, col.

Description

The method acts on a Tiff object created with Tiff(filename, mode). It is the color-converted counterpart of readEncodedTile. The position must correspond to the first pixel of a tile, so for the first tile pass 1, 1.

Input arguments

t
Tiff object opened on a tiled image.
row, col
Pixel position of the tile's upper-left corner, counted from 1.

Output arguments

A
uint8 color array of the tile.

Example

First tile as color

tag.ImageLength = 4; tag.ImageWidth = 4;
tag.Photometric = Tiff.Photometric.MinIsBlack;
tag.BitsPerSample = 8; tag.SamplesPerPixel = 1;
tag.TileLength = 16; tag.TileWidth = 16;
tag.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
w = Tiff('u.tif', 'w'); w.setTag(tag); w.write(uint8(magic(4))); w.close();
r = Tiff('u.tif', 'r');
A = r.readRGBATile(1, 1);
class(A)
A(:, :, 1)
r.close();
Output
ans = 'uint8'
ans = 4×4 uint8 matrix

   16    2    3   13
    5   11   10    8
    9    7    6   12
    4   14   15    1

See also

Tiff.readRGBAImage Tiff.readRGBAStrip Tiff.readEncodedTile Tiff.computeTile