Created
March 5, 2016 14:57
-
-
Save vyuh/6608778c7bba106a2f99 to your computer and use it in GitHub Desktop.
Generate Image for CAPTCHA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
$r = join "", map { ( "a".."z", "A".."Z", "0".."9" )[rand 62] } 1..9; | |
system( qq/convert -size 300x100 -font Courier -gravity center "label:$r" label.bmp/ ); | |
system( q/convert -size 150x50 xc:gray +noise random -blur 1x1 -colorspace gray -scale 300x100 gray.bmp/ ); | |
system( q/convert label.bmp gray.bmp -compose displace -define compose:args=12x12 -composite -blur 1x1 comp.png/ ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment