GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Tech Batch watermark folder recursively with imagick composite? (https://gfy.com/showthread.php?t=1276851)

Zeiss 08-22-2017 04:01 AM

Batch watermark folder recursively with imagick composite?
 
I would like to watermark thousands of images. I am trying to do it with imagemagick.

Code:

composite -dissolve 40% -gravity SouthWest /path/to/watermark.png /path/to/input/file.jpg /path/to/output/file.jpg
This works well for individual files. I have also managed to write a sh script based on it to watermark images in a folder but I can't make it watermark images in the sub folders of that folder. Any ideas how to add recursion to this command? :Oh crap

The sh script is...

Code:

#!/bin/bash

WM=$HOME/path/to/watermark.png
STARTDIR="/dicecotry/of/pics"

for imagedir in $( find $STARTDIR -type d )
do
  echo "Running in $imagedir ..."
  cd $imagedir
  file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
  do
    echo "Watermarking $IMAGE"
    composite -dissolve 40% -gravity SouthWest -quality 100 $WM "$IMAGE" "$IMAGE"
  done
done


Zeiss 08-22-2017 11:52 PM

Solved by writing a new script... Thanks, nobody, anyway! :)


All times are GMT -7. The time now is 08:51 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc