ImageMagickでcrop
convertコマンドでいける。
convert -crop 100x100+0+0 input.png output.png
指定してる数字は、切り取るサイズと切り取る座標の始点。
それぞれ横、縦の順。
座標の始点は画像の左上が0,0になるんだが、カメラでとった画像とか、メタ情報で縦横指定しているやつだと
見た目上は右上が始点になったりとかあり得る。
ちなみにリサイズとのコンボもOK。
convert -crop 300x300+50+0 -resize 150x150 input.png output.png
あとそもそも元画像のサイズをとりたいときは
identify -format '%w,%h' input.png