image - 将 Canvas 大小调整一半 imagemagick

标签 image imagemagick

如何将可变大小的图像调整为当前大小的一半?

即:
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/

相关文章:

php - PHP 和 S3 中的图像缓存与图像处理

html - 如何将图像和文本放在同一个 div 中而不影响对齐

python - 从扫描图像中删除水平线

php - 快速以肖像模式拍摄照片并上传到服务器 - 上传的图像显示方向错误

html - 点击元素下方的 HitTest

javascript - 在页面加载之前使用 jQuery 定位图像

animation - 以编程方式生成 .mov 或 .flv 视频文件的最佳开源框架是什么?

php - JPG 文件大小优化 - PHP、ImageMagick 和 Google 的 Page Speed

javascript - 托米 :upload Meteor package 503 service unavailable error

php - FFMPEG 或 ImageMagick 用于图像转换和调整大小(速度/内存使用)?