Tiff.readEncodedStrip

Reads one strip of the current image, still as stored.

Category: Data Import and Analysis > Data Import and Export

Syntax

S = readEncodedStrip(t, stripNum)

Decodes strip number stripNum.

Description

The method acts on a Tiff object created with Tiff(filename, mode). This lets you process a huge image a band at a time. The data comes back in the file's own sample layout, without any color conversion.

Input arguments

t
Tiff object opened on a stripped image.
stripNum
Strip index, counted from 1.

Output arguments

S
Array of the strip's rows: RowsPerStrip-by-ImageWidth (the last strip can be shorter).

Example

Second strip

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');
S = r.readEncodedStrip(2);
size(S)
isequal(S, I(5:8, :))
r.close();
Output
ans = 1×2

     4     8
ans = logical
   1

See also

Tiff.computeStrip Tiff.numberOfStrips Tiff.read Tiff.readEncodedTile