用ImageMagick给图片添加水印
体验 了一下ImageMagick的强大,用ImageMagick给图片添加水印,为了批量操作,写成了一个shell.
?
输入参数为:水印图片,图片所在文件夹
?
?
#!/bin/bash
echo "Image watermarking Script"
echo ""
if [ $# -ne 2 ]
then
??? echo "usage: ./watermark watermark.jpg picture_directory"
??? echo ""
??????? exit
fi
WATERMARK=$1
PICDIR=$2
for each in $PICDIR/*{.jpg,.jpeg,.png,.JPG,.JPEG,PNG}
do
??? #mv "$each" `echo $each | tr ' ' '_'`;
??? composite -gravity center? -dissolve 15.3 $WATERMARK$each $each 2> /dev/null
??? echo "$each: done!"
done
exit 0