jpg形式からpng形式への変更について
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
IMG = imread('1.jpg'); %画像読み込み
imshow(IMG,'Border','tight');
saveas(gcf,'test_1.png') %画像の保存
上記のコードで
.jpg形式の画像ファイルを読み込み、
.png形式のファイルとして出力する
プログラムを作成中です。
この際に、入力の画像ファイルの大きさと
出力画像ファイルの大きさが異なるのはなぜでしょうか?
640×480を入力ファイルとしても
667×500の画像が出力されます。
0 commentaires
Réponse acceptée
Kazuya
le 7 Juin 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
% 同じサイズが確認できます。
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Convert Image Type dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!