如何使用 ImageMagic 仅裁剪图像的左侧和右侧

Ahm*_*mad 4 imagemagick

如何在不知道图像宽度的情况下从图像的左侧和右侧删除特定数量的像素:

我试过:

convert img.png -crop +200 result.png
Run Code Online (Sandbox Code Playgroud)

但它只从左侧删除

Mar*_*ell 6

您可以-shave像这样使用从左侧和右侧删除 200 个像素:

convert input.png -shave 200x0 result.png
Run Code Online (Sandbox Code Playgroud)

或者像这样的顶部和底部:

convert input.png -shave 0x200 result.png
Run Code Online (Sandbox Code Playgroud)