#author("2020-05-25T19:40:52+09:00","","")
#author("2020-05-25T19:47:35+09:00","","")
* 画像ファイルの扱い [#g02ad308]

[[ビデオファイルの扱いメモ>movie_files]] にも関連情報(主に ffmpeg )あり

#hr
#contents

** imagamagick でサイズ変更 2020年5月25日 [#gb65a218]
** imagemagick でサイズ変更 2020年5月25日 [#gb65a218]

アスペクト比を変えずに変更   
 $ convert ifile.png -resize 640x ofile.png ← 幅を指定
 $ convert ifile.png -resize x540 ofile.png ← 高さを指定
 $ convert ifile.png -geometry 30% ofile.png

参考:https://imagemagick.biz/archives/93

** imagamagick でトリミング(切り抜き) [#f826400e]
** imagemagick でトリミング(切り抜き) [#f826400e]

*** 単にトリミングするとき 2020年5月25日 [#uc0f5ca3]

 $ convert ifile.png 1920x1080+243+94 ofile.png ← (width) x (height) +(x) + (y) 

ペイントなどを利用して、どういう風に切るかの数字を見付ける

参考:https://imagemagick.biz/archives/550

trim オプションを使うと、周辺の単一色(または無色)の部分を削り取るので注意
 $ convert ifile.png trim ofile.png


*** トリミングした画像ファイルを別途利用するとき 2020年5月25日 [#a09a3f14]

convert だけだとレイヤーが残る = キャンバスサイズが大きなままになる~
キャンバスサイズやどのようにトリミングが行われたかなどは、identify で確認できる~

 $ identify trimmed.png
 trimmed.png PNG 1500x925 1920x1080+243+94 8-bit sRGB 47909B 0.000u 0:00.000

これのような、キャンバスサイズが元のままで、再度 crop しようとするとヘンになる。~
それを避けるためには、mogrify +repage をする。

 $ mogrify +repage trimmed.png
 $ identify trimmed.png
 trimmed.png PNG 1500x925 1500x925+0+0 8-bit sRGB 47881B 0.000u 0:00.001

キャンバスサイズがトリミングした大きさに一致していることが、identify で確認できる

参考:https://qiita.com/yoya/items/62879e6e03d5a70eed09

|Today:&counter(today); |Yesterday:&counter(yesterday); |Total:&counter(); since 25 May 2020|


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS