Rahul Dagli
Rahul Dagli

Reputation: 4502

How to crop image without knowing the height of image using ImageMagick

I have 100s of screenshots taken from website of varying height. I would like to crop header of the images by 50px from the top irrespective of the height of the image.

convert -crop autoxauto+0x50 image-input.png image-output.png

Upvotes: 0

Views: 187

Answers (2)

Rahul Dagli
Rahul Dagli

Reputation: 4502

I agree with @Mark's answer, however I found a simpler solution:

convert image-input.png -chop 0x50 image-output.png

Upvotes: 1

Mark Setchell
Mark Setchell

Reputation: 207465

If you start with this image where the two bars are both 50 pixels tall:

enter image description here

You probably mean:

convert start.png -crop x50+0+0 top.png

enter image description here

Or:

convert start.png -crop x50+0+50 bottom.png

enter image description here

Upvotes: 2

Related Questions