From 35ad95bb685b51662bf91570cc12052ed809fb89 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Wed, 30 Dec 2020 20:01:50 +0100 Subject: [PATCH] New colored captcha ! --- captcha/captcha.sh | 22 +++++++++++++--------- captcha/experimental.sh | 22 +++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/captcha/captcha.sh b/captcha/captcha.sh index fa9628c..0478b41 100755 --- a/captcha/captcha.sh +++ b/captcha/captcha.sh @@ -77,16 +77,18 @@ B2_LINE_STOP_X=$((100 + $R % 40)) #B3_LINE_STOP_X=$((100 + $R % 40)) get_random -ROLL_A=$(($R % 10 + 50)) +RAND_A=$(($R % 10 + 40)) get_random -ROLL_B=$(($R % 20)) +RAND_B=$(($R % 14)) get_random -ROLL_C=$(($R % 20 + 60)) +RAND_C=$(($R % 10 + 60)) +get_random +RAND_D=$(($R % 20)) convert -size 180x60 xc:none -pointsize 40 \ - \( -clone 0 -fill white \ - -stroke black -strokewidth 4 -annotate +0+40 "$INPUT" \ - -stroke white -strokewidth 2 -annotate +0+40 "$INPUT" \ + \( -clone 0 -fill plasma:fractal \ + -stroke plasma:fractal -strokewidth 3 -annotate "2x0+0+$RAND_A" "$INPUT" \ + -stroke plasma:fractal -strokewidth 4 -annotate "2x0+0+$RAND_A" "$INPUT" \ -roll +$ROLL_X+0 \ -wave "$WAVE1_AMPLITUDE"x"$WAVE1_LENGTH" \ -roll -$ROLL_X+0 \) \ @@ -101,6 +103,8 @@ convert -size 180x60 xc:none -pointsize 40 \ -strokewidth 2 -draw "line 0,$W2_LINE_START_Y 140,$W2_LINE_STOP_Y" \ -strokewidth 2 -draw "line 0,$W3_LINE_START_Y 140,$W3_LINE_STOP_Y" \ -wave "$WAVE3_AMPLITUDE"x"$WAVE3_LENGTH" \) \ - -distort Perspective "0,0,0,0 0,$ROLL_C,0,80 80,0,80,$ROLL_B 80,80,80,$ROLL_A" \ - -flatten -crop 140x60 +repage -quality 100 -depth 11 png:- - + -distort Perspective "0,0,0,0 0,$RAND_C,0,80 80,0,80,5 80,80,80,55" \ + -rotate "+$RAND_D" \ + \( -size 140x60 xc: +noise Random -alpha set -channel A -evaluate set 30% \) \ + -compose add \ + -flatten -crop 140x60 +repage -quality 500 -depth 11 png:- diff --git a/captcha/experimental.sh b/captcha/experimental.sh index fa9628c..0478b41 100755 --- a/captcha/experimental.sh +++ b/captcha/experimental.sh @@ -77,16 +77,18 @@ B2_LINE_STOP_X=$((100 + $R % 40)) #B3_LINE_STOP_X=$((100 + $R % 40)) get_random -ROLL_A=$(($R % 10 + 50)) +RAND_A=$(($R % 10 + 40)) get_random -ROLL_B=$(($R % 20)) +RAND_B=$(($R % 14)) get_random -ROLL_C=$(($R % 20 + 60)) +RAND_C=$(($R % 10 + 60)) +get_random +RAND_D=$(($R % 20)) convert -size 180x60 xc:none -pointsize 40 \ - \( -clone 0 -fill white \ - -stroke black -strokewidth 4 -annotate +0+40 "$INPUT" \ - -stroke white -strokewidth 2 -annotate +0+40 "$INPUT" \ + \( -clone 0 -fill plasma:fractal \ + -stroke plasma:fractal -strokewidth 3 -annotate "2x0+0+$RAND_A" "$INPUT" \ + -stroke plasma:fractal -strokewidth 4 -annotate "2x0+0+$RAND_A" "$INPUT" \ -roll +$ROLL_X+0 \ -wave "$WAVE1_AMPLITUDE"x"$WAVE1_LENGTH" \ -roll -$ROLL_X+0 \) \ @@ -101,6 +103,8 @@ convert -size 180x60 xc:none -pointsize 40 \ -strokewidth 2 -draw "line 0,$W2_LINE_START_Y 140,$W2_LINE_STOP_Y" \ -strokewidth 2 -draw "line 0,$W3_LINE_START_Y 140,$W3_LINE_STOP_Y" \ -wave "$WAVE3_AMPLITUDE"x"$WAVE3_LENGTH" \) \ - -distort Perspective "0,0,0,0 0,$ROLL_C,0,80 80,0,80,$ROLL_B 80,80,80,$ROLL_A" \ - -flatten -crop 140x60 +repage -quality 100 -depth 11 png:- - + -distort Perspective "0,0,0,0 0,$RAND_C,0,80 80,0,80,5 80,80,80,55" \ + -rotate "+$RAND_D" \ + \( -size 140x60 xc: +noise Random -alpha set -channel A -evaluate set 30% \) \ + -compose add \ + -flatten -crop 140x60 +repage -quality 500 -depth 11 png:-