Use imwrite to save tif images

조회 수: 74 (최근 30일)
Angela
Angela 2018년 10월 2일
댓글: Puja Bharti 2018년 10월 5일
I want to save a 3 color image as a lossless tif image. When i tried
imwrite(image,'test.tif','Mode','lossless')
I got an error message. Is there any way to save an image as a lossless tif? Thank you.

채택된 답변

Guillaume
Guillaume 2018년 10월 5일
편집: Guillaume 2018년 10월 5일
"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
Angela
Angela 2018년 10월 5일
Thank you Guillaume.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2018년 10월 3일
Yes. Do NOT call your image variable image since that is the name of a built in function. Try
imwrite(yourImage,'test.tif');
  댓글 수: 6
Guillaume
Guillaume 2018년 10월 5일
@Puja Bharti, are your comments in any way related to Angela question or did you just try to highjack somebody's else question? If so, then please start your own question.
Puja Bharti
Puja Bharti 2018년 10월 5일
Sorry Guillaume and Angela. I had no such intensions. I just want the solution to my problem. Please help me at:
https://in.mathworks.com/matlabcentral/answers/422212-enhanced-image-is-not-getting-saved-as-it-values-get-changed-after-imwrite

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by