r9 fan
r9 fan

Reputation: 177

How to save a high-resolution figure in MATLAB

When I save a figure from MATALB, I'd like the resulting image to have very high resolution so that I can zoom in to see detail in the image. When I use 'File --> Save As' on a figure, the image is not high resolution.

How can I save a figure to a high resolution image in MATLAB?

Upvotes: 13

Views: 83975

Answers (1)

Geoff
Geoff

Reputation: 1212

You can specify a desired resolution to save the image, either from the command line or from the File menu.

Command line: Using print, just include the option -r###, where ### if the resolution you want. Usually 300 dots-per-inch (dpi) is plenty high enough resolution for my purposes, but feel free to go higher if needed. Obviously the higher the dpi the larger the image file size will be.

print(gcf,'foo.png','-dpng','-r300');         *// 300 dpi

Check out the MATLAB print documentation to see all the print options you can adjust like this.

File menu: Or using 'File -> Export Setup...', on the left select 'Rendering', then adjust the 'Resolution (dpi)'. By default it set to 'auto'.

As with the command line, there are many printing options you can adjust in the File menu. Once you've tinkered a little bit and gotten everything how you want it, you can save the current export settings as default so you don't have to do it every time you save a figure. This is done on the bottom of the same menu 'Export Styles --> Save as style named:' --> choose "default" and click 'Save'.

Here are some more good tips for saving nice figures in MATLAB:

Upvotes: 20

Related Questions