PRINT コマンドを使って画像のピクセルでサイズを指定するにはどうすればよいですか?
7 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2014 年 2 月 17 日
回答済み: MathWorks Support Team
2014 年 2 月 17 日
出力ファイルをピクセルで指定する必要があります。Image Processing Toolbox がないため、IMRESIZEコマンドが使用できません。
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Read, Write, and Modify Image についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!