To implement Linux under the Shell script batch for the specified folder to add a watermark to the picture, first need to install ImageMagick:
Install on CentOS:
Yum Install Imagemagick-y
Install on Debian:
Apt-get Install Imagemagick-y
Script:
#!/bin/bash
for all in/to be processed the picture directory/*{.jpg,.gif}
s= ' du-k $each | awk ' {print '} '
if [$s-gt]; then
# Convert-quality 80-resize 600x800 $each $each
composite-gravity southeast-dissolve-/<a "href= con.com/tag/%25e6%25b0%25b4%25e5%258d%25b0/"rel=" external nofollow "onclick=" javascript:tagshow (' watermark '); return false; " > Watermark </a> directory/mark.jpg $each $each 2>/dev/null
echo "$each: done!"
Fi
done
exit 0
The main is the script, for this we will briefly analyze:
Convert-quality 80-resize 600x800 $each $each
This is a picture shrink.
-quality 80 represents picture quality
600x800 picture size 600 wide X800 high
Do not need to remove the good!
Composite-gravity southeast-dissolve 80/Watermark directory/mark.jpg $each $each 2>/dev/null
This sentence is a watermark of the image
-gravity Southeast Picture Watermark Location South is the South East is the picture of the lower right corner
-dissolve 80 This is to set the transparency of the watermark. The smaller the more transparent.
/watermark Directory/mark.jpg The location of the watermark picture
If [$s-gt 10] to determine the image size is less than 10K of watermark
For all in/to process the picture directory/*{.jpg,.gif} need to add watermark to the directory of the file format
After the file is configured, save as watermark.sh.
And then run it.