How to crop an image using ImageMagick from the command line

cmd.execommand lineimage processingimagemagickshell

I am trying to crop a 640×640 image using ImageMagick on the command line.

I need to remove about 20 pixels from the bottom part of the image all the way from left to right. A long strip along the bottom.

I know about the shave command.

What would be the command to enter in the command line? I am using the Windows version of this software.

Best Answer

Assuming that you always know the size of your image you can do it like this:

convert original.jpg -crop 640x620+0+0 cropped.jpg

With the -crop operator you specify the size of the cut out image and the offset from the upper left corner of the old image. In order to get rid of the 20px along the bottom, you have to choose a size of 640x620 and an offset of 0+0

Related Question