From f7434c5b65ddcda96226a3420dc528cbff37ace9 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Tue, 31 Aug 2021 13:06:50 +0200 Subject: [PATCH] Cleaned & added savecaptcha.sh --- captcha/savecaptcha.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 captcha/savecaptcha.sh diff --git a/captcha/savecaptcha.sh b/captcha/savecaptcha.sh new file mode 100755 index 0000000..a1f196f --- /dev/null +++ b/captcha/savecaptcha.sh @@ -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"