Adjust the resolution of PNG plot image on a remote terminal
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 2 Mai 2016
Réponse apportée : MathWorks Support Team
le 3 Mai 2016
Generated plot image files using MATLAB R2009b on a remote UNIX terminal are always a low resolution image. I tried using the resolution option of the "print" command but that does not change the resolution of the output image at all.
How can I increase the resolution of the generated image files?
Réponse acceptée
MathWorks Support Team
le 2 Mai 2016
When running MATLAB R2009b or any release prior to R2014b that uses HG1 in the UNIX terminal or in "nodisplay" mode, there is a known limitation on increasing the resolution of an image with the print command.
The PostScript and Ghostscript devices all function in "nodisplay" mode on UNIX. The graphic devices -djpeg, -dpng, -dtiff (compressed TIFF bitmaps) and -tiff (EPS with TIFF preview) work as well, but under "nodisplay" they use Ghostscript to generate output instead of using the drivers built into MATLAB. However, Ghostscript ignores the -r option when generating -djpeg, -dpng, -dtiff and -tiff image files and always uses the default resolution of 72DPI.
A workaround is to set the "PaperUnits" and "PaperPosition" of the figure to increase its size.
Workaround:
% Example graph
plot(1:10)
% Set the "PaperUnits" and "PaperPosition" of the figure to increase its size
% Using [0 0 16 12] in "PaperPosition" creates an image that has the dimensions of 1152x864 pixels or (16*72) x (12*72) pixels
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 16 12])
% Print to the PNG file
print -dpng filename
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Adding custom doc dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!