如何在MATLAB中保存高分辨率图形 [英] How to save a high-resolution figure in MATLAB

查看:1107
本文介绍了如何在MATLAB中保存高分辨率图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从MATALB中保存图形时,我希望生成的图像具有非常高的分辨率,以便可以放大以查看图像中的细节.当我在图上使用文件->另存为"时,图像不是高分辨率.

如何在MATLAB中将图形保存为高分辨率图像?

解决方案

您可以从命令行或从文件"菜单中指定所需的分辨率来保存图像.

命令行: 使用print,只需包含选项-r###,如果需要,在其中包含###.通常,每英寸300点(dpi)的分辨率足以满足我的需求,但如有需要,可以随意提高.显然,dpi越高,图像文件的大小将越大.

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

查看 MATLAB打印文档以查看您可以像这样调整所有打印选项.

文件菜单:或使用文件->导出设置...",在左侧选择渲染",然后调整分辨率(dpi)".默认情况下,它设置为自动".

与命令行一样,您可以在文件"菜单中调整许多打印选项.稍作修改并获得所需的一切后,您可以将当前的导出设置保存为默认设置,这样就不必在每次保存图形时都进行此操作.这是在同一菜单导出样式->另存为样式命名:"->选择默认"并单击保存"的底部完成的.

此处是一些在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?

解决方案

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:

这篇关于如何在MATLAB中保存高分辨率图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆