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

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

问题描述

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

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

解决方案

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

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

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

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

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

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

这里是一些在 MATLAB 中保存漂亮图形的好技巧:p>

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天全站免登陆