Skip to content

Instantly share code, notes, and snippets.

@vyuh
Created March 5, 2016 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vyuh/6608778c7bba106a2f99 to your computer and use it in GitHub Desktop.
Save vyuh/6608778c7bba106a2f99 to your computer and use it in GitHub Desktop.
Generate Image for CAPTCHA
#!/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