Main Content

images.blocked.TIFF class

Package: images.blocked

Store blocks in single TIFF file


The images.blocked.TIFF class is an adapter for use with blocked images. Use this adapter to archive compressed (lossy or lossless) 2-D image data. Additional information in UserData, if any, is stored alongside in a MAT-file with the same file name.

Data Types

M-by-N: logical, int8, uint8, int16, uint16, int32, uint32, single and double;

M-by-N-by-3: uint8, uint16, uint32, single and double

When writing, the TIFF format requires block sizes to be a multiple of 16.

Multiresolution levelsYes
Use parallel processingNo
Resume processingNo

The images.blocked.TIFF class is a handle class.

Class Attributes


For information on class attributes, see Class Attributes.




adapter = images.blocked.TIFF() creates an instance of an images.blocked.TIFF adapter for use with blockedImage functions.


expand all

TIFF compression scheme, specified as one of the following.

Compression SchemeDescription
"LZW"Lempel-Ziv-Welch lossless compression
"PackBits"PackBits lossless compression
"Deflate"Adobe DEFLATE lossless compression
"JPEG"JPEG-based lossy compression
"None"No compression

Data Types: string

Preferred file extension, specified as a string scalar or char array.

Data Types: char | string


collapse all

Create a blocked image.

bim = blockedImage('tumor_091R.tif');

Create two separate images.

bim.BlockSize = [512 512 3];
bo1 = apply(bim, @(bs)im2gray(bs.Data));
bo3 = apply(bim, @(bs)im2gray(bs.Data), "Level", 3);

Create a single multiresolution TIFF file from the two images. You specify additional resolution levels using the "LevelImages" parameter.

wa = images.blocked.TIFF(); % Specify the TIFF adapter
wa.Compression = Tiff.Compression.JPEG; % Specify compression in the adapter
write(bo1, "tumor_091RGray.tif", "LevelImages", bo3, "Adapter", wa);
Introduced in R2021a