Nick Ginanto
Nick Ginanto

Reputation: 32190

Imagemagick crop while keeping size

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

Upvotes: 0

Views: 195

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 208077

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.

Upvotes: 1

Related Questions