jpg形式からpng形式への変更について
25 views (last 30 days)
Show older comments
IMG = imread('1.jpg'); %画像読み込み
imshow(IMG,'Border','tight');
saveas(gcf,'test_1.png') %画像の保存
上記のコードで
.jpg形式の画像ファイルを読み込み、
.png形式のファイルとして出力する
プログラムを作成中です。
この際に、入力の画像ファイルの大きさと
出力画像ファイルの大きさが異なるのはなぜでしょうか?
640×480を入力ファイルとしても
667×500の画像が出力されます。
0 Comments
Accepted Answer
Kazuya
on 7 Jun 2019
imwrite 関数を使うのがよいかと。
A = rand(50);
imwrite(A,'myGray.png') % サンプル画像
B = imread('myGray.png');
whos B
imwrite(B,'myGray.jpg'); % jpg で保存
C = imread('myGray.jpg');
whos C
% 同じサイズが確認できます。
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!