Cleaned & added savecaptcha.sh

This commit is contained in:
Adrien Bourmault 2021-08-31 13:06:50 +02:00 committed by root
parent 719f40912b
commit f7434c5b65

18
captcha/savecaptcha.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# This script relies on ImageMagick.
# It is NOT compliant with ImageMagick forks like GraphicsMagick.
RAND_ANGLE=$1
RAND_ITALIC=$2
INPUT=$3
SOLUTION=$4
convert -size 300x60 xc:none -pointsize 20 \
\( -clone 0 -fill black \
-stroke black -strokewidth 1 \
-annotate "${RAND_ANGLE}x${RAND_ITALIC}+0+0" "\n $INPUT" \
-roll +$ROLL_X+0 \
-wave "$WAVE1_AMPLITUDE"x"$WAVE1_LENGTH" \
-roll -$ROLL_X+0 \) \
-flatten -crop 300x60 +repage -quality 500 -depth 11 png:"/var/tmp/captcha/${SOLUTION}_$(date "+%Y-%m-%d-%H%M%S").png"