I have a 640 x 640 image... I am trying to crop the image using imagemagick (https://www.imagemagick.org/script/command-line-options.php#shave)

from 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).

What would be the command to enter in the command line? I am using the windows version of this software. Thank you!


Use ImageMagick's -chop operator as follows to remove 20 rows of pixels from the bottom:

convert image.png -gravity South -chop 0x20 result.png

Change to -gravity North to chop top 20 rows.

Change to:

convert image.png -gravity East -chop 20x0 result.png

to crop from right side, note that the 20 pixels are now before the x separator.

  • Remove the zero (as in 1x20) to actually remove anything – yPhil Sep 9 '18 at 10:24

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy