How to save file as 300 dpi png?

46 ビュー (過去 30 日間)
Faith McColl
Faith McColl 2015 年 7 月 9 日
コメント済み: Star Strider 2015 年 7 月 9 日
I am trying to save a figure as a 300 dpi png file. The command print('filename','-dpng','resolution','300') does not work because Matlab is unsure if the name of the file should be "filename" or "resolution". How do I fix this? Is there a better way to control the resolution and file type of images from Matlab?

採用された回答

Star Strider
Star Strider 2015 年 7 月 9 日
You didn’t say the MATLAB version you’re using, but the R2015a documentation for print under the section for Input Arguments states for ‘resolution’:
  • resolution — Resolutionstring containing -r and integerResolution, specified as a string containing -r and an integer value indicating the resolution in dots per inch. For example, '-r300' sets the output resolution to 300 dots per inch. To specify screen resolution, use '-r0'.
  2 件のコメント
Faith McColl
Faith McColl 2015 年 7 月 9 日
That worked! Thank you!
Star Strider
Star Strider 2015 年 7 月 9 日
My pleasure!

サインインしてコメントする。

その他の回答 (1 件)

Sid
Sid 2015 年 7 月 9 日
Not a direct answer to the question at hand, but can you try export_fig from FEX (check link here)?
Had a no issues setting resolution for .png formats in the past with it, so figured I suggest it.
In case you go down this path, the documentation is located here .
  1 件のコメント
Faith McColl
Faith McColl 2015 年 7 月 9 日
I would rather just stick to using Matlab without having to download anything extra if that's possible.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by