Exporting images (png) through export_fig - painfully slow

I'm using export_fig to export a figure to a high resolution png and it's painfully slow. Takes about 36 seconds to perform the export. I also see the following warning upon export:
Warning: print2array generating a 83.6M pixel image. This could be slow and might also cause memory problems
Any suggestions on alternatives to speed up this portion of my code?
export_fig('-dpng','-opengl','-r450',sprintf('C:\\Users\\Username\\Documents\\%s',datetimelabel));

1 件のコメント

darova
darova 2021 年 9 月 19 日
Can't you reduce resolution?

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

回答 (4 件)

Yair Altman
Yair Altman 2021 年 9 月 19 日

1 投票

Try to either reduce the resolution (the -r450 part), or to save as a vector-graphics image (PDF/EPS) rather than a PNG bitmap.
Image Analyst
Image Analyst 2021 年 9 月 19 日

0 投票

Try comparing it to exportgraphics() but you'd need r2020a or later.
Oliver Woodford
Oliver Woodford 2021 年 10 月 24 日

0 投票

Reducing the level of anti-aliasing will reduce the sixe of the images created, saving time. Use the '-aX' option, where X is 1 to 4 (faster to slower).
yanqi liu
yanqi liu 2021 年 11 月 26 日

0 投票

yes,sir,may be use getframe or print,such as
f=getframe(gcf);
f=frame2im(f);
imwrite(f, './result.tif');
or
print(gcf,'-dpng','-r200','result')

カテゴリ

ヘルプ センター および File ExchangeImage Processing Toolbox についてさらに検索

製品

リリース

R2018a

質問済み:

2021 年 9 月 17 日

回答済み:

2021 年 11 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by