How to save an image from imshow() as a .jpeg?

조회 수: 11 (최근 30일)
fiona rozario
fiona rozario 2017년 3월 18일
답변: Dariush Ashtiani 2018년 10월 3일
I am creating an RGB image and displaying using imshow(). Once the image is displayed, if I save the image as .jpeg, it gets a white background to it and the image dimensions change. How can I keep it to its original dimensions? Attached image is what I got when I saved it as a .jpeg file and the dimensions are 240x170. Whereas the original dimensions of the constituting matrices are 100x100.

채택된 답변

Walter Roberson
Walter Roberson 2017년 3월 18일
편집: Walter Roberson 2017년 3월 18일
Have a look at print(), which pays attention to the figure PaperPosition* properties and to the figure InvertHardcopy property. It also allows a -r resolution option.
However, I would instead recommend using imwrite of the rgb matrix.

추가 답변 (1개)

Dariush Ashtiani
Dariush Ashtiani 2018년 10월 3일
You can use saveas commad. Say
filename='image1'; saveas(gcf,[filename,'.jpg'])

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by