mirror of
https://github.com/jlengrand/batchWaterMarking.git
synced 2026-03-10 08:01:18 +00:00
Initiates the batch watermarking project
This commit is contained in:
BIN
in/feel_lonely__by_jlengrand-d4dp6sk.jpg
Normal file
BIN
in/feel_lonely__by_jlengrand-d4dp6sk.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 MiB |
BIN
out/feel_lonely__by_jlengrand-d4dp6sk.jpg
Normal file
BIN
out/feel_lonely__by_jlengrand-d4dp6sk.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 355 KiB |
BIN
out/pourquoi_le_bitume__by_jlengrand-d4dp4ha.jpg
Normal file
BIN
out/pourquoi_le_bitume__by_jlengrand-d4dp4ha.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 308 KiB |
BIN
site.png
Executable file
BIN
site.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 6.0 KiB |
69
waterMark
Executable file
69
waterMark
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
##---
|
||||
# Advansee
|
||||
#airballman
|
||||
#Created on : Sat Jun 11 22:15:32 CEST 2011
|
||||
#
|
||||
# DESCRIPTION : Script designed to automatically watermark all the images in a folder given a template. Resize images at the same time to make them fit with Piwigo's desires.
|
||||
# EXAMPLE : ./waterMark in_folder out_folder wtermark_image
|
||||
##---
|
||||
|
||||
#TODO :
|
||||
# must be available for jpg, jpeg, JPEG , . . . too !
|
||||
# Adds output folder creation if needed
|
||||
# Automatically check for background constrast and invert watermark color if needed
|
||||
|
||||
#identify -format "%w,%h"foto.jpg
|
||||
#composite -gravity SouthWest -geometry +5+5 -size 2000x2000 site.png foto_new.jpg test.jpg
|
||||
#convert -resize 1024 foto.jpg foto_new.jpg
|
||||
|
||||
IN_REPO=$1
|
||||
OUT_REPO=$2
|
||||
WATER=$3
|
||||
echo " Input repo is : $IN_REPO"
|
||||
|
||||
|
||||
|
||||
for file in $IN_REPO/*
|
||||
do
|
||||
HEIGHT=$(identify -format "%h" ${file})
|
||||
WIDTH=$(identify -format "%w" ${file})
|
||||
|
||||
#echo "w: $WIDTH , h:$HEIGHT"
|
||||
|
||||
BASEFILE=$(basename $file)
|
||||
#DIRFILE=$(dirname $file)
|
||||
|
||||
OUTNAME="$OUT_REPO/$BASEFILE"
|
||||
#echo "OUT : $OUTNAME"
|
||||
|
||||
#echo "dir : $DIRFILE, base : $BASEFILE"
|
||||
|
||||
#checking wether we are in portrait or lanscape mode
|
||||
#---
|
||||
if [ $WIDTH -ge $HEIGHT ]
|
||||
then
|
||||
echo "image $file is in landscape mode !"
|
||||
#resizing
|
||||
DIM="1024"
|
||||
GRAV="SouthWest"
|
||||
#---
|
||||
elif [ $HEIGHT -gt $WIDTH ]
|
||||
then
|
||||
echo "Image $file is in portrait mode !"
|
||||
DIM="x1024"
|
||||
GRAV="NorthWest"
|
||||
#---
|
||||
else
|
||||
echo "Unknown problem with file $file. Image not processed !"
|
||||
continue
|
||||
fi
|
||||
#---
|
||||
#resizing
|
||||
convert -resize $DIM $file $OUTNAME
|
||||
composite -gravity $GRAV -geometry +10+10 $WATER $OUTNAME $OUTNAME
|
||||
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user