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
?
You can combine two -crop
s:
#left,top right,bottom
convert test.png -crop +180+140 -crop -60-140 cropped.png
The solution from that other guy
is very clever. The standard way would be to use -chop. But that means 4 calls, since there is no symmetry in the sizes to be removed. So in ImageMagick using -chop, you could do
convert text.png -gravity north -chop 0x180 -gravity east -chop 60x0 -gravity south -chop 0x140 -gravity west -chop 140x0 cropped.png
See http://www.imagemagick.org/Usage/crop/#chop
See also -shave when there is symmetry either left/right or top/bottom or all around. http://www.imagemagick.org/Usage/crop/#shave
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With