How to change image dpi using compiled matlab code run on aws ec2?

조회 수: 3 (최근 30일)
willis
willis 2015년 9월 4일
댓글: Usha Duddu 2015년 9월 8일
I can generate an image with 300dpi using print function on my local matlab on a linux box (example code below), however on aws ec2 (ubuntu), the image is always saved as 72dpi with the same code no matter what dpi value I set. I am running Matlab 2014a with compiler version 5.1.
figure('paperunits','inches','paperposition',[0 0 6 6]);
n = 20;
cm = jet(n);
for i = 1:n
plot(ceil(i/4), mod((i-1),4)+1,'s','MarkerFaceColor',cm(i,:), 'markeredgecolor','k','markersize',30); hold on;
end
print('figure_dpng.png', '-dpng', '-r300');
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 9월 4일
It mght be worth testing export_fig from the file exchange.
Usha Duddu
Usha Duddu 2015년 9월 8일
Are you launching your compiled application in 'nodisplay' mode?

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

채택된 답변

Usha Duddu
Usha Duddu 2015년 9월 8일
I understand that when you are executing your compiled MATLAB application in aws ec2(Ubuntu), resolution of the image generated is lesser than the stated resolution parameter in "print" command.
This behavior is directly correlated with the display environment. If you launch MATLAB-compiled application in 'nodisplay' mode, MATLAB uses Ghostscript to generate output instead of using built-in MATLAB drivers. Thus you cannot vary the resolution of image files when running in 'nodisplay' mode, which explains the differing behavior in resolution of PNG files in base MATLAB and compiled application.
Hope this answers your question.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by