Matlab cannot read the tiff image

53 views (last 30 days)
li yan
li yan on 28 Jul 2015
Commented: Justin on 10 Oct 2023
Matlab sometimes gives a warning when running the imread function to read a TIFF image.
My computer system is win8.1, and the Matlab is 2013b. What's wrong with this problem? How to fix it?

Accepted Answer

Walter Roberson
Walter Roberson on 28 Jul 2015
It took me a bit of chasing to track this
So what you have is a TIFF/IT tag IT8COLORTABLE . Now to research about TIFF/IT
<<TIFF/IT breaks TIFF 6.0 in many ways. TIFF/IT is certainly inspired by TIFF, but it is not a valid subset of TIFF 6.0 by far. It's best regarded a different file format altogether. [...]
TIFF/IT does not include the tag datatype 13 (IFD), nor, of course, its BigTIFF equivalent 18 (IFD8). It therefore enforces the problematically ambiguous use of the datatype 4 (Long, unsigned 32bit integer). [...] It therefore makes sense for TIFF/A to distinguish between unsigned 32bit integer data that is meant to communicate an actual integer value on the one hand, and a pointer to an auxiliary IFD on the other hand. [...]
TIFF/IT supports ICC color profiles. TIFF/A does not. (See section “7.2.8.4 Colour values” in the TIFF/IT specification.) [...]
Note that nothing here is actually valid criticism on the TIFF/IT file format, nor is it intended as such, on the condition that TIFF/IT is not mistaken for a flavor of TIFF, or an interchange or archival file format. If TIFF/IT is regarded as its own format, serving prepress needs perfectly fine, as it is intended, none of the above is anything other than a useful feature. Except for the badly chosen name, and the impractical and confusing reuse of another format's header and signature value.>>
Notice the 7.2.8.4 . So your IT8COLORTABLE is representing an ICC Color Profile, which is not used in the TIFF/A standard .
Basically what you have is a TIFF/IT file that is not a TIFF 6.0 file as is expected by imread(), and the TIFF/IT standard is incompatible with TIFF 6.0 in some regards. Especially as to what a LONG means in some circumstances. And your error message has to do with LONG.
So why the warning?
pronaldzito wrote "I believe this may be a bug in 64-bit libtiff where a TIFF IFD contains a data type of long with a value zero."
Possibly -- but the incompatibility in specifications would be more explanatory.
Joris wrote
<<In theory, one should never copy tags that are unknown.
You may do otherwise, and many people do. But then you are open for trouble, for instance when copying a LONG value that is in fact intended to be a private IFD pointer.>>
More evidence that it is incompatibility in file formats.
Your file is not a TIFF file in the sense expected by MATLAB's imread(): it is a TIFF/IT file, which has a subtly different use of the tag structure and you are seeing the effect of it. You might have problems with the file as it is corrupt from the standpoint of TIFF readers.
  8 Comments
li yan
li yan on 29 Jul 2015
Thank you for your great answers! you opened my mind!
Justin
Justin on 10 Oct 2023
I was able to resolve the issue by using Photoshop to update the .tiff to a .tif by using the save a copy option. Afterwards, I was able to load the image into Matlab.

Sign in to comment.

More Answers (1)

Muhammad Usman Saleem
Muhammad Usman Saleem on 28 Jul 2015
Use the correct extension for tif or you have convert your image to some other data type image like unit8 ,unit16 or might be your image converted to RGB image or binary image.

Products

Community Treasure Hunt

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

Start Hunting!