放大图像 canvas 以补偿模糊
Enlarge image canvas to compensate for blur
我正在使用 imagemagick 处理一张图像以添加模糊效果:
convert input.png -blur 0x16 output.png
但是,模糊在超出图像框架时会被裁剪掉。我该如何弥补这一点并扩大 canvas 让蓝色完全显示出来?
示例图片here
您链接的图像是 JPEG,而不是 PNG,就像您的命令建议的那样,所以我不知道它是否具有透明度,或者它是否应该有很多备用 canvas电视机的图像。因此,我猜你想要什么。
您可以通过指定 -gravity center
并使用 -extent
将 canvas 从中心向外扩展,这样您就可以像这样获得 space 的模糊效果:
convert image.jpg -gravity center -extent 120%x120% -blur 0x16 output.jpg
但是,这引入的 canvas 超出了您的需要,因此您可能希望之后 trim 它,如下所示:
convert image.jpg -gravity center -extent 120%x120% -blur 0x16 -trim output.png
作为替代方案,您可以像这样添加一些白色边框(我选择了 500 像素):
convert image.jpg -bordercolor white -border 500x500 -blur 0x16 output.png
然后用 -shave
像这样删除你想删除的内容:
convert image.jpg -bordercolor white -border 500x500 -blur 0x16 -shave 400x400 output.png
我正在使用 imagemagick 处理一张图像以添加模糊效果:
convert input.png -blur 0x16 output.png
但是,模糊在超出图像框架时会被裁剪掉。我该如何弥补这一点并扩大 canvas 让蓝色完全显示出来?
示例图片here
您链接的图像是 JPEG,而不是 PNG,就像您的命令建议的那样,所以我不知道它是否具有透明度,或者它是否应该有很多备用 canvas电视机的图像。因此,我猜你想要什么。
您可以通过指定 -gravity center
并使用 -extent
将 canvas 从中心向外扩展,这样您就可以像这样获得 space 的模糊效果:
convert image.jpg -gravity center -extent 120%x120% -blur 0x16 output.jpg
但是,这引入的 canvas 超出了您的需要,因此您可能希望之后 trim 它,如下所示:
convert image.jpg -gravity center -extent 120%x120% -blur 0x16 -trim output.png
作为替代方案,您可以像这样添加一些白色边框(我选择了 500 像素):
convert image.jpg -bordercolor white -border 500x500 -blur 0x16 output.png
然后用 -shave
像这样删除你想删除的内容:
convert image.jpg -bordercolor white -border 500x500 -blur 0x16 -shave 400x400 output.png