captchas/savecaptcha.sh

19 lines
539 B
Bash
Executable File

#!/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"