A problem in TIFF reading

4 views (last 30 days)
I have a problem in TIFF reading. The matlab gave me a warning when I read a TIFF file:
WARNING: The datatype for tag SamplesPerPixel should be TIFF_SHORT instead of
TIFF_LONG. This may cause data corruption.
the code I used is given as follows:
How can I overcome this problem? Thanks a lot
Walter Roberson
Walter Roberson on 30 Aug 2016
Correct, just reading the file is not going to corrupt the file.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 17 May 2015
The TIFF file you are reading does not have proper headers, and MATLAB is warning you about it. However, SamplesPerPixel is going to be a very small number, 1 for grayscale and 3 for RGB. If you were happening to use a TIFF with more than 32767 channels per pixel then you would encounter problems. For normal images it is just a warning about an improper file.
You could fix the file by opening it with some random image utility and asking to save it again.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!