Imagemagick crop while keeping size

205 views Asked by At

I want to crop the top 10 pixels of an image, but to keep the width

All exmaples I found look like

  convert rose: -crop 90x60-10-10  crop_all.gif

I need to supply the 90x60 so for the result size

How can I crop with something like +0+10 and not supply a final size

1

There are 1 answers

1
Mark Setchell On BEST ANSWER

I think you need this to chop 10px off the top edge:

convert rose: -chop 0x10 result.gif

Just for completeness, if you want to chop 10px off the bottom, do this:

convert rose: -gravity south -chop 0x10 result.gif

And to chop 10px off the left edge:

convert rose: -chop 10x result.gif

and 10px off the right edge:

convert rose: -gravity east -chop 10x result.gif

The reason you don't need to specify -gravity for top and left sides is that the default value for the -gravity setting is NorthWest.