py-watermark/run-nesting.sh
2025-04-10 00:56:17 +03:00

22 lines
580 B
Bash

#!/bin/bash
FOLDER=$1
MASK=$2
TEXT=$3
FILES=$(find $1 -name "$2")
echo $FILES
for fullpath in $FILES; do
filename="${fullpath##*/}"
dir="${fullpath:0:${#fullpath} - ${#filename}}"
base="${filename%.[^.]*}"
echo "$base"
if [[ $base != *_wm ]]
then
ext="${filename:${#base} + 1}"
output_file="$dir${base}_wm.$ext"
echo -e "$fullpath:\n\tdir = \"$dir\"\n\tbase = \"$base\"\n\text = \"$ext\"\n\toutput = $output_file"
poetry run python main.py -t "$TEXT" -i $fullpath -o $output_file -f fonts/Roboto-Regular.ttf
fi
done