Search code examples
bashshellimage-processingimagemagickimagemagick-convert

Chop 4 sides of image with Imagemagick


I have the following image:

test PNG 1366x655 1366x655+0+0 8-bit sRGB 286KB 0.000u 0:00.000

and I need to chop it like this from the border of the image:

top: 140 px
bottom: 140 px
left: 180 px
right: 60 px

Is there a one-line command line to do this with convert?


Solution

  • You can combine two -crops:

                          #left,top      right,bottom
    convert test.png -crop +180+140 -crop -60-140 cropped.png