此blog post图像中使用的边框阴影效果似乎嵌入在图像本身(而不是css3)中。如何在imagemagick中创建它?
编辑1: 我意外发现的解决方案在下面作为答案发布。
答案 0 :(得分:9)
不知何故,我找到了完全符合我要求的命令:
对于已经缩放和压缩的图像:
convert input.jpeg -bordercolor white -border 13 \( +clone -background black -shadow 80x3+2+2 \) +swap -background white -layers merge +repage output.jpg
用于创建缩略图:
convert input.jpeg -thumbnail 200x200 -bordercolor white -border 6 \( +clone -background black -shadow 80x3+2+2 \) +swap -background white -layers merge +repage output.jpg
原始图片:
convert input.jpeg -scale 600x400 -quality 86 -strip -bordercolor white -border 13 \( +clone -background black -shadow 80x3+2+2 \) +swap -background white -layers merge +repage output.jpg
答案 1 :(得分:1)
-shadow
上有一个convert
参数,可以选择执行此操作。
http://blog.bemoko.com/2009/07/01/add-shadow-and-border-to-images-with-imagemagick/
答案 2 :(得分:0)
Shutter 使用以下命令 https://github.com/shutter-project/shutter/blob/master/share/shutter/resources/system/plugins/perl/spshadow/spshadow#L375
convert in.png -gravity 'northwest' -background 'rgba(255,255,255,0)' -splice '10x10' \( +clone -background '#005f005f005f0000' -shadow "80x3-1-1" \) +swap -background none -mosaic +repage \( +clone -background '#005f005f005f0000' -shadow "80x3+5+5" \) +swap -background none -mosaic +repage out.png