脚本文件 image-shadow.sh:
#!/bin/bash # run image-shadow myimage.png to add a shadow to the image # or run image-shadow myimage.png 6x6 to add a shadow and 6 pixel border image-shadow () { out=${1%.*}-shadow.${1#*.} in=$1 echo "Converted file : $out" if [ ! -z $2 ] ; then convert $in -frame $2 $out in=$out fi convert $in -bordercolor white -border 13 -bordercolor grey60 -border 1 \( +clone -background black -shadow 60x5+10+10 \) \ +swap -background none -layers merge +repage $out } image-shadow $1 $2
用法:
./image-shadow.sh ~/Pictures/1.png
使用前:
使用后: