Use imwrite to save tif images

127 views (last 30 days)
Angela on 2 Oct 2018
Commented: Puja Bharti on 5 Oct 2018
I want to save a 3 color image as a lossless tif image. When i tried
I got an error message. Is there any way to save an image as a lossless tif? Thank you.

Accepted Answer

Guillaume on 5 Oct 2018
Edited: Guillaume on 5 Oct 2018
"I got an error message" is a useless statement if you don't give us said error message. Thankfully, you've finally given it in a comment to Image Analyst's answer.
'Mode' is indeed not a valid option for TIF. Probably, the nearest available option would be Compression. However, note that the default compression method for colour images is 'packbits' which is lossless anyway. In fact, the only compression mode that is lossy is 'jpeg' which you'd have to set explicitly. So really, for lossless TIF,
imwrite(im2uint16(NewImage), 'test.tif')
is all that is needed.
  1 Comment
Angela on 5 Oct 2018
Thank you Guillaume.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 3 Oct 2018
Yes. Do NOT call your image variable image since that is the name of a built in function. Try
Puja Bharti
Puja Bharti on 5 Oct 2018
Sorry Guillaume and Angela. I had no such intensions. I just want the solution to my problem. Please help me at:

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!