0

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 Answer 1

1

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.

1
  • 1
    -crop gives you the bit you cut, whereas -chop gives you what's left after the cut. Commented Jun 9, 2015 at 15:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.