PRINT コマンドを使って画像​のピクセルでサイズを​指定するにはどうすれ​ばよいですか?

조회 수: 7 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2014년 2월 17일
답변: MathWorks Support Team 2014년 2월 17일
出力ファイルをピクセルで指定する必要があります。Image Processing Toolbox がないため、IMRESIZEコマンドが使用できません。

채택된 답변

MathWorks Support Team
MathWorks Support Team 2014년 2월 17일
PAPERPOSITION プロパティを変更し、PRINTコマンドで解像度を指定することで実現できます。下記に、コマンドの実行例を紹介します。
surf(peaks)
% control the image pixel size by manipulating the paper size and number of dots per inch
output_size = [500 300];%Size in pixels
resolution = 300;%Resolution in DPI
set(gcf,'paperunits','inches','paperposition',[0 0 output_size/resolution]);
% use 300 DPI
print('test.png','-dpng',['-r' num2str(resolution)]);
% now read the image back in to MATLAB and test its size
a=imread('test.png');
size(a)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2009a

Community Treasure Hunt

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

Start Hunting!