shaving help

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Posts: 6
Joined: 2020-03-04T11:55:05-07:00
Authentication code: 1152

shaving help

Post by colorful »

convert -shave 50 -gravity north in.png out.png

I am trying to remove 50px off the top. What am I doing wrong?

User avatar
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: shaving help

Post by fmw42 »

Read the input first, then put the settings, then the command. Shave does both top and bottom. You want -chop.

Code: Select all

convert in.png -gravity north -chop 0x50  out.png

Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: shaving help

Post by snibgo »

See ... .php#shave and ... s.php#chop

You need 0x50 to remove from top/bottom but not left/right. Setting like "-gravity" for operations must come before those operations, not after.

"-shave" is not sensitive to "-gravity". "-chop" is, so:

Code: Select all

magick in.png -gravity north -chop 0x50 out.png
snibgo's IM pages: