save PNG to file wih --nodisplay

조회 수: 3 (최근 30일)
Richard
Richard 2015년 4월 1일
편집: Richard Quist 2015년 4월 2일
Hi all, I have some code that runs on a server where there is no display. I don't have any trouble using the "saveas" to save some figures as ".fig"s, but when I try and use "saveas" to save .png files I get the following error:
Error using print>LocalPrint (line 295)
Error getting PageBoundingBox position in file
What is the recommended approach to creating figures in .png (or similar) files where there is no access to a display?

답변 (1개)

Richard Quist
Richard Quist 2015년 4월 1일
Prior to R2014b, generating image formats when running MATLAB with -nodisplay was achieved by first creating a temporary PostScript file and then using Ghostscript to convert that file to the desired format.
You appear to be running into a problem as that temporary PostScript file is created.
It's possible that one of these could help:
  1. cleaning out the temp directory, or
  2. setting a different temp directory before starting MATLAB, by setting the TEMP (on Windows) or TMP (other platforms) environment variable
An alternative approach would be to create EPS files rather than PNG, and then later convert those files to PNG using Ghostscript or some other system tool.
Rich
  댓글 수: 2
Richard
Richard 2015년 4월 1일
편집: Richard 2015년 4월 1일
Thanks Rich. I tried setting the output to .eps like this:
saveas(gcf,'myFile.eps'])
This generated a segmentation fault (only on remote servers, it works fine locally). Any ideas?
Richard Quist
Richard Quist 2015년 4월 2일
편집: Richard Quist 2015년 4월 2일
Certainly sounds like you're going to need to try the tmp directory cleanup or change...
Can you provide the stack trace from the SEGV? If not, do you have sample code that reproduces the SEGV? And how are you running on the remote machine?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by