Hi guys
I have a problem with the image quality, when i save the result as .jpg, the quality is reduced, please help me, how can I solve it ?

4 Comments

Which function are you using? Are you saving an image or a figure() window?
I use saveas(gcf,'filename.jpg') in my code
If you use print() instead of saveas(), then you can give a resolution by using a '-r' option. For example,
set(gcf,'PaperPositionMode','auto')
print('YourFileName.jpg','-djpeg','-r0') %corrected
which would print at screen resolution.
thank you so much, it worked.

Sign in to comment.

 Accepted Answer

If you use print() instead of saveas(), then you can give a resolution by using a '-r' option. For example,
set(gcf,'PaperPositionMode','auto')
print('YourFileName.jpg','-djpeg','-r0') %note correction compared to my earlier comment
which would print at screen resolution.

More Answers (1)

Image Analyst
Image Analyst on 8 Oct 2020
Try using exportgraphics().
Save the file as a PNG format file instead of JPEG to avoid lossy compression artifacts.

Categories

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

Community Treasure Hunt

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

Start Hunting!