Previously I had a music website in which I publish photos from recent Tamil movies,But I had a problem with piracy issues,many people copied photos from my website and published to their website so i decided to add a watermark to every image,But the only restriction is Since I don’t use Windows, I could not find any batch watermark software’s for Linux but after lot of research i found a perfect and fastest way to add image watermark to photos.
1.Install the ImageMagick library (http://www.imagemagick.org) In fedora you can install using Yum
yum install ImageMagick
#!/bin/bash ########################################### # REQUIRES: ImageMagick, coreutils # VERSION: 1.0 # DESCRIPTION: A script to add a watermark and overwrite all images in a directory. # # This script will watermark all of the images in a directory. Warning! This will overwrite the files. # gravity NorthWest, North, NorthEast, West, Center, # East, SouthWest, South, or SouthEast ########################################### # Initialize variables WM=$HOME/Documents/Watermark.png # This is the path to your watermark image SCALE=50 # This sets the scale {71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} of your watermark image # Warning echo -e "This will overwrite all of the images in this directory."\\n"Are you sure want to continue? {Y/n}" read REPLY if [ "$REPLY" != "n" ] && [ "$REPLY" != "N" ] then file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE do echo Watermarking $IMAGE composite -dissolve 40{71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} -gravity center -quality 100 \( $WM -resize $SCALE{71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} \) "$IMAGE" "$IMAGE" done else echo exiting exit 0 fi exit 0
/home/vividvilla/Documents/logo.png
composite -dissolve 40{71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} -gravity center -quality 100 \( $WM -resize $SCALE{71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} \) "$IMAGE" "$IMAGE"
composite -dissolve 40{71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} -gravity NorthEast -quality 100 \( $WM -resize $SCALE{71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} \) "$IMAGE" "$IMAGE"
chmod +x /bin/yourfilename.sh
You can see two watermarks since I just repeated some steps and changes the Logo position
#!/bin/bash ########################################### # DESCRIPTION: A script to add a watermark and overwrite all images in a directory. # # This script will watermark all of the images in a directory. Warning! This will overwrite the files. # gravity NorthWest, North, NorthEast, West, Center, # East, SouthWest, South, or SouthEast ########################################### # Initialize variables WM=/home/vividvilla/Documents/logo/mp3tamil.png # This is the path to your watermark image WM1=/home/vividvilla/Documents/logo/watermark.png SCALE=100 # This sets the scale {71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} of your watermark image # Warning echo -e "This will overwrite all of the images in this directory."\\n"Are you sure want to continue? {Y/n}" read REPLY if [ "$REPLY" != "n" ] && [ "$REPLY" != "N" ] then file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE do echo Watermarking $IMAGE composite -dissolve 40{71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} -gravity SouthEast -quality 100 \( $WM -resize $SCALE{71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} \) "$IMAGE" "$IMAGE" done file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE do echo Watermarking $IMAGE composite -dissolve 40{71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} -gravity NorthWest -quality 100 \( $WM1 -resize $SCALE{71b550cbed0aca3fea2335d26076176dc834a5ad6e765af844b2cea64fe7483b} \) "$IMAGE" "$IMAGE" done else echo exiting exit 0 fi exit 0
Warning : This script overwrites the current file.
Thats it now you can any number of watermarks to your Images In very simple and Fastest way.Please Leave a comment if you face any problem