Linux批量打水印

在 CentOS 下安装:

# yum install ImageMagick

在 Ubuntu 下安装:

$ sudo apt-get install imagemagick

批量给某目录打:
#!/bin/bash

if [ $# -ne 2 ]
then
    echo "usage: ./watermark watermark.jpg picture_directory"
    echo ""
        exit
fi

MARK=$1
PICDIR=$2
for each in $PICDIR/*{.jpg,.jpeg,.png,.JPG,.JPEG,PNG}
do
   # mv "$each" `echo $each | tr ' ' '_'`;
   # composite -gravity northeast -dissolve 50 $MARK $each $each 2> /dev/null
   composite -gravity southeast $MARK $each $each 2> /dev/null
    echo "$each: done!"
done
exit 0 

调用:sh watermark.sh /home/www/elinkmall/fashionemall.png /home/www/elinkmall/wish_shui

你可能感兴趣的:(Linux)