Save image from GUI to desktop/folder
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kulsoom Naz
am 2 Dez. 2015
Bearbeitet: OJ27
am 7 Mai 2018
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?
Akzeptierte Antwort
Walter Roberson
am 2 Dez. 2015
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 Kommentar
OJ27
am 7 Mai 2018
Bearbeitet: OJ27
am 7 Mai 2018
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!