Write a multipage tiff error

4 views (last 30 days)
Dante Basile
Dante Basile on 8 Aug 2019
Commented: Dante Basile on 13 Aug 2019
I attempted to write a 144 page tiff using imwrite and I got the following error message:
Error using writetif (line 40)
Writing TIFFs with 144 components is not supported with IMWRITE. Use Tiff instead. Type "help Tiff" for more information.
However, I was able to use imwrite to write the stack as far as I can tell by using the append feature.
imwrite(wallShroom(:, :, 1), strcat(outputPath, patientID, '_', selectedChamber, '_shroomed.tif')) %write first slice of tiff
for i = 2:size(wallShroom, 3) %append the rest of the slices
imwrite(wallShroom(:, :, i), strcat(outputPath, patientID, '_', selectedChamber, '_shroomed.tif'), 'WriteMode', 'append')
I felt that the error message's reference to the Tiff object in this scenario was slightly misleading as this complex approach was not needed as far as I can tell.
I just wanted to give some feedback.
What are your opinions on this?

Accepted Answer

Vimal Rathod
Vimal Rathod on 13 Aug 2019
The message’s reference to a TIFF object is to enable the users to utilize this broader functionality. Creating a tiff file using this object provides some additional features such as reading subimages, writing tiles and strips of image data, modifying individual tiff tags among others.
Also, to overcome the error, you could use the imwrite function with append feature.
  1 Comment
Dante Basile
Dante Basile on 13 Aug 2019
Thank you, this makes sense.
The only reason I bring this up is that when it says "Writing TIFFs with 144 components is not supported with IMWRITE" it lead me to believe that imwrite is not usable for writing multipage tiffs, which seems not to be the case.

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!