Exporting images (png) through export_fig - painfully slow
13 次查看(过去 30 天)
显示 更早的评论
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));
回答(4 个)
Yair Altman
2021-9-19
Try to either reduce the resolution (the -r450 part), or to save as a vector-graphics image (PDF/EPS) rather than a PNG bitmap.
0 个评论
Oliver Woodford
2021-10-24
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).
0 个评论
yanqi liu
2021-11-26
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')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!