Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
fiona rozario
fiona rozario am 18 Mär. 2017
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.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 18 Mär. 2017
Bearbeitet: Walter Roberson am 18 Mär. 2017
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.

Weitere Antworten (1)

Dariush Ashtiani
Dariush Ashtiani am 3 Okt. 2018
You can use saveas commad. Say
filename='image1'; saveas(gcf,[filename,'.jpg'])

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by