[macOS General] imagemagick で image の top から指定した座標までを除いて crop する
Automator で切り抜こうとしたら、センター(上下がカットされる)指定のみのようだったので imagemagik でやります。
[markdown]
インストール。
“`prettyprinted
% brew install imagemagick
“`
`cmd+shift+3` でキャプチャしたスクリーンショットから、OS とブラウザのメニューを削除したい。
こんな形で1ファイルの処理はできました。
x 座標は 0 ピクセル、y 座標は 118 ピクセルの位置から、1280×682 ピクセルの大きさで切り抜きます。
“`bash
% convert -crop 1280×682+0+118 input.png output.png
“`
複数ファイルの一括処理が分からない。。。
> * [[ImageMagick] convertコマンドの使い方 – Physical Oceanography Lab Bulletin Board](https://sites.google.com/site/infoaofd/Home/computer/unix-linux/command/imagemagikconvertkomandonotsukaikata)
どうも複数ファイルの操作は、他のスクリプトと組み合わせるよう。
“`bash
% for f in *.png; do convert -crop 1280×682+0+118 $f ${f%.png}.png; done
“`
ファイル名の処理部分が分かってませんでした。
ありがとうございます。
[/markdown]