Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use mogrify to crop an image

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!

like image 451
user1876422 Avatar asked Sep 02 '13 21:09

user1876422


1 Answers

Just found the answer based on chorobas approach:

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

This site helped.

like image 140
user1876422 Avatar answered Oct 04 '22 08:10

user1876422