It's been awhile since I've played with Imagemagick. I do remember crop and I can take an image named foo.png and use:

convert foo.png -gravity north -crop 1000x100 bar.png

but my output is:


When I only want what's in bar-0.png.

I've researched around and found:

What is the correct way to crop an image and just get the first return? I'm not not worried about the aspect ratio or the size of the images. I'm just trying to get a sample of the image's first 100px.


You need to add the information from which X and Y you want to start, otherwise Imagemagick will repeat the crop:

convert foo.png -gravity north -crop 1000x100+0+0 bar.png

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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