Unable to retrieve SubIFD (for tif image)

2 views (last 30 days)
Amritanjali dubey
Amritanjali dubey on 3 Jan 2020
Answered: Riya on 18 Jun 2025
t = Tiff('F:\SIH20\tree\Bareilyoutput.tif','r');
offsets = t.getTag('SubIFD');
t.setSubDirectory(offsets(1));
subimage_one = t.read();
imagesc(subimage_one)
t.close();
error.PNG
How do I fix above error please help.
Image info
Filename: 'F:\SIH20\cloud\INSAT3D_TIR1_India\3DIMG_07NOV2019_0130_L1C_SGP.tif'
FileModDate: '27-Dec-2019 05:58:53'
FileSize: 4235502
Format: 'tif'
FormatVersion: []
Width: 1074
Height: 984
BitDepth: 32
ColorType: 'grayscale'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: 32
Compression: 'Uncompressed'
PhotometricInterpretation: 'BlackIsZero'
StripOffsets: [1x984 double]
SamplesPerPixel: 1
RowsPerStrip: 1
StripByteCounts: [1x984 double]
XResolution: []
YResolution: []
ResolutionUnit: 'Inch'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: 4.2950e+09
MinSampleValue: 0
Thresholding: 1
Offset: 8
SampleFormat: 'IEEE floating point'
ModelPixelScaleTag: [0.0335 0.0335 0]
ModelTiepointTag: [0 0 0 62.9884 38.0290 0]
GeoKeyDirectoryTag: [1x32 double]
GeoDoubleParamsTag: [298.2572 6378137]
GeoAsciiParamsTag: 'WGS 84|'

Answers (1)

Riya
Riya on 18 Jun 2025
Hi Amritanjali,
I understand that you are encountering the error “Unable to retrieve SubIFD” while working with a TIFF image in MATLAB using the Tiff class. This error occurs because the image file you are using does not contain any Sub Image File Directories (SubIFDs), which are typically used for storing additional image levels like overviews or pyramids. As a result, calling getTag('SubIFD') fails since this tag does not exist in your image.
To fix this issue and successfully read the image, you should skip the attempt to access the SubIFD tag and simply read the image directly using either of the following approaches:
Option 1 – Using imread” function:
I = imread('F:\SIH20\tree\Bareilyoutput.tif');
imagesc(I); axis image; colormap gray; colorbar;
Option 2 – Using the Tiff object directly:
t = Tiff('F:\SIH20\tree\Bareilyoutput.tif', 'r');
I = t.read();
t.close();
imagesc(I); axis image; colormap gray; colorbar;
If you are expecting SubIFDs (such as in multi-resolution TIFFs), please ensure that your image source supports them. You can check the structure using:
info = imfinfo('F:\SIH20\tree\Bareilyoutput.tif');
If info returns only one structure, then your image does not contain SubIFDs or multiple IFDs.
For further reference on working with the Tiff class and its available tags, kindly refer to the official documentation below:

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!