Page 1 of 1

Cutting off the top portion of a page

Posted: 2017-04-05T11:35:41-07:00
by damonm
Hey guys, I have searched the forum and found an article on cutting off the bottom 20% of an image but that didn't work for me. I have the image completely cropped and ready to go. This is a landscaped image, and I want to cut off the top 10 or 20% (I'll have to play with it to get it exact). I don't want to cut anything else except the top and I haven't figured out how to do this although I suspect it is pretty simple. Many thanks in advance for your help! I am using ImageMagick-7.0.5-4.x86_64.

Re: Cutting off the top portion of a page

Posted: 2017-04-05T11:53:09-07:00
by snibgo
"-crop" will do this, eg:

Code: Select all

convert in.png -gravity South -crop x90%+0+0 +repage out.png
EDIT: Sorry, you use v7, so use "magick" instead of "convert".

Re: Cutting off the top portion of a page

Posted: 2017-04-05T12:53:38-07:00
by GeeMack
damonm wrote: 2017-04-05T11:35:41-07:00This is a landscaped image, and I want to cut off the top 10 or 20% (I'll have to play with it to get it exact). I don't want to cut anything else except the top and I haven't figured out how to do this although I suspect it is pretty simple.
There are many ways to go about this, one of the more straightforward methods is by using "-crop" as snibgo described above. You can also use "-chop" or "-extent" just about as simply. Here are a couple of example commands...

Code: Select all

magick image.png -gravity north -chop 0x10% result.png

Code: Select all

magick image.png -gravity south -extent 100x90% result.png
Edited to add: Depending on the level of precision you require, all of those example operations can use fractions of whole percentages. Something like "-crop 100x90.3%+0+0" should work.