Imagemagick is a very handy tool in linux to do a whole lot of things with images like cropping, resizing, frames, borders, watermark, compositing multiple images, etc. And with an easy to understand command line interface, it becomes easier to write a small shell script which could process images in a batch mode. I keep taking a lot of snaps and I want all the images to be watermarked with "Abeer Arts" and a nice frame around the picture to add to its beauty. I had a software called "Batch Watermarker" in Windows but the executable got corrupted with some virus (Windows sucks !!!) and I had already accumulated a huge backlog of images to be watermarked. Then I switched to linux mode and did a little bit of searching on google for watermarking with imagemagick library and finally wrote a small shell script which makes a frame around the image and also puts a text watermark. Here is the script:
if test -d $1
then
for f in $(ls $1 | grep .jpg)
do
echo $f
convert $f -font Gentium-Regular -pointsize $2 -draw "gravity southeast fill black text -5,12 'Watermark text' fill white text 0,5 'Watermark text'" $f
convert -mattecolor black -frame 15x15+5+5 $f $f
convert +raise 30x30 $f $f
done
fi
$1 -> first command line argument giving the directory location containing the images
$2 -> pointsize which defines the size of the watermark text over the image
I kept the name of the script "abeerify" ;) To run the script, copy the scipt to /usr/bin and change the permissions to 755. Then on command prompt type:
/> abeerify folderpath 65
where 65 is the font size for the watermark text.
Showing posts with label imagemagick. Show all posts
Showing posts with label imagemagick. Show all posts
Wednesday, June 25, 2008
batch watermarking using convert command in Linux
Posted by
Piyush Bhargava
at
10:18 PM
1 comments
Labels: convert, Image Processing, image watermarking, imagemagick, watermarking
Subscribe to:
Posts (Atom)