Create a watermark image, should be transparent background. watermark.png
Run script in the folder where all jpgs are located:
cd someproductimages
bash ../watermark.sh
...| # make sure there are no spaces in filenames | |
| rename 's/ +/_/g' *.jpg | |
| # path to watermark image | |
| watermark="../watermark.png" | |
| # create extra folder in current folder | |
| mkdir -p watermark | |
| for i in `ls *jpg` | |
| do | |
| # calculate width of watermark: e.g. 1/3 of width | |
| echo "processing $i" | |
| full_width=`identify -format '%w' ""$i""` | |
| width=`expr $full_width / 3` | |
| echo "Watermark size: $width / $full_width" | |
| composite -geometry x$width+15+15 -dissolve 50% -gravity SouthWest $watermark "$i" "watermark/$i" | |
| done |