save an image in a specific resolution with saveas

85 vues (au cours des 30 derniers jours)
Robin Hoja
Robin Hoja le 18 Mai 2022
Commenté : Robin Hoja le 19 Mai 2022
Hello there,
iam trying to safe an figure with saveas(figurename, 'filename','png'), but saving reduces the resolution from 7000x5000 to 1688x1176, and i want to keep the resolution of 7000x5000.
I don't know if I'm too stupid or if it's too obvious...it would be great if someone could help me.

Réponse acceptée

Image Analyst
Image Analyst le 18 Mai 2022
Don't use saveas() unless you want a screenshot. Even if you do you want a screenshot, should use exportgraphics.
If you want to save the actual image (instead of a figure window rendering of it on your screen) then use imwrite.
  3 commentaires
Image Analyst
Image Analyst le 18 Mai 2022
You're saving the figure handle. That's just as bad. I didn't say to save the figure (screenshot display). I told you to save the actual image variable that gets displayed. You need to save the image variable with imwrite. On the line above
seg_bin, seg_rgb] = createMask(I);
you have 3 images seg_bin, seg_rgb, and I. Which of those images do you want to save to the drive?
imwrite(seg_bin, 'Mask Image.png'); % The binary image
imwrite(seg_rgb, 'Masked RGB image.png'); % The original image blackened outside of the mask.
imwrite(I, 'Original image.png'); % The image that was thresholded, presumably the original image.
Robin Hoja
Robin Hoja le 19 Mai 2022
Thank you, that worked.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by