So I am trying to save an image from my GUI in a folder when I press pushbutton embeddimage.
toBeSavedm which is the same image from earlier, originalRounded, is the picture I want to save and it is in workspace.
I am trying to use the uiputfile and imwrite functions, but somehow the image that is saved in my folder is different, the data is changed.
toBeSaved=handles.originalRounded;
assignin('base','toBeSaved',toBeSaved);
[fileName, filePath]=uiputfile('*.jpg*', 'Save toBeSaved as');
fileName = fullfile(filePath, fileName);
imwrite(toBeSaved, 'fileName', 'jpg');
guidata(hObject, handles);
or is there any other way to save an image from GUI to my folder?

댓글 수: 2

thuvo thi
thuvo thi 2016년 12월 16일
Excuse me, can I ask you one question? With DICOM image, how do you save it?
Stephen23
Stephen23 2016년 12월 16일
" the data is changed."
That is what jpeg does. If you don't want that then use a lossless format.

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

 채택된 답변

Walter Roberson
Walter Roberson 2015년 12월 2일

0 개 추천

imwrite(toBeSaved, fileName, 'jpg');
No quotes around fileName
You need to expect that data will be changed when you use JPEG, unless you specifically request lossless storage. JPEG is a format for "scenes" and does not preserve sharp lines well and is permitted to change saved values.

댓글 수: 1

OJ27
OJ27 2018년 5월 7일
편집: OJ27 2018년 5월 7일
what if I want to use the image content that appears in one of the figures in the GUI but it is not in the workspace? I want to show the image content of one of the handles. I can't use a global variable but I thought I would "grab" the current content and then display it in another figure.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2015년 12월 2일

편집:

2018년 5월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by