How to use mogrify to crop an image

user1876422 picture user1876422 · Sep 2, 2013 · Viewed 10.1k times · Source

I would like to use the Linux' mogrify tool to remove the lower 20 pixels of several images with all different dimensions.

Example: Image width is 800px, image heigth is 600px. I would like to crop the image that the new size is 800x580px where the 20px from the bottom are removed.

I am struggling with the Image Geometry object.

Is there a way to formulate an Image Geometry object without providing the absolute dimensions per image? An object which can be used on every image achieving the 20px crop mentioned above?

If not: Based on the example above, how does the Image Geometry object has to look like if I have to provide the current dimensions of an image?

Thanks a lot!

Answer

user1876422 picture user1876422 · Sep 3, 2013

Just found the answer based on chorobas approach:

mogrify -chop 0x20+0+0 -gravity South image.jpg

This site helped.