如何将可变大小的图像调整为当前大小的一半?
即:
30x30 到 15x15
40x40 到 20x20
60x60 到 30x30
重力:左上
最佳答案
再次更新
convert input.png -extent 50% -background none output.png
再次更新
也许你的意思是:
convert input.jpg -extent 50% output.jpg
更新的答案
也许你的意思是像这样裁剪出图像的中心:
convert input.jpg -gravity center -crop 50% output.jpg
原始答案
像这样:
identify input.jpg # Check dimensions of input image
input.jpg JPEG 304x304 304x304+0+0 8-bit sRGB 37KB 0.000u 0:00.000
# Convert the image to half its size
convert input.jpg -resize 50% output.jpg
identify output.jpg # Check dimensions of output image
output.jpg JPEG 152x152 152x152+0+0 8-bit sRGB 20.2KB 0.000u 0:00.000
关于image - 将 Canvas 大小调整一半 imagemagick,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26698000/