How to crop image using ImageMagick

To crop an image using ImageMagick, you need to specify the X and Y coordinates of the top corner of the crop rectangle and the width and height of the crop rectangle. Use the mogrify command if you want the images to be replaced in-place or use the convert command otherwise to make a copy.

If you want the crop rectangle to start at top corner X: 50 Y: 100 and the crop rectangle to be of size W: 640 H:480, then use the command:

$ mogrify -crop 640x480+50+100 foo.png

To write the cropped image to a new file:

$ convert foo.png -crop 640x480+50+100 out.png

Tried with: ImageMagick and Ubuntu 14.04

2 thoughts on “How to crop image using ImageMagick”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s