2014-11-02 24 views

回答

2

尚未更新再次

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  
+0

调整大小调整图像大小,我想要做的是调整图像的画布 – user3622981 2014-11-02 11:00:10

+0

我不明白。在将其尺寸缩小50%后,如何看到一个100px宽,50px高的红色矩形? – 2014-11-02 11:24:20

+0

我又试了一次 - 请再看一遍。 – 2014-11-02 12:07:22

1

如果使用GUI工作,点击查看>半长(或调整其他比例)并查看>应用。之后,你保存你的图像。通过控制台,添加以下参数:

$ display -write ./output.png -resize 50% original.png