save an image in a specific resolution with saveas

84 views (last 30 days)
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.

Accepted Answer

Image Analyst
Image Analyst on 18 May 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 Comments
Image Analyst
Image Analyst on 18 May 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.

Sign in to comment.

More Answers (0)

Categories

Find more on Printing and Saving in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!