Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "Leyendo imagen...\n";
- $im = imagecreatefromjpeg("Captcha.jpg");
- $out = imagecreatetruecolor(imagesx($im),imagesy($im));
- echo "Limpiando...\n";
- for($x=0;$x<imagesx($im);$x++){
- for($y=0;$y<imagesy($im);$y++){
- $pixel = imagecolorsforindex($im,(imagecolorat($im,$x,$y)));
- if($pixel['red']>=100 || $pixel['green']>=100 || $pixel['blue']>=100){
- $color=imagecolorexact($out,0,0,0);
- imagesetpixel($out,$x,$y,$color);
- }else{
- $color=imagecolorexact($out,255,255,255);
- imagesetpixel($out,$x,$y,$color);
- }
- }
- }
- echo "Finished!! Catpcha_cracked.png\n";
- imagepng($out,"Captcha_cracked.png");
- shell_exec("convert Captcha_cracked.png Captcha.pnm");
- echo "Captcha_cracked: ";
- echo shell_exec('gocr Captcha.pnm');
- ?>
Add Comment
Please, Sign In to add comment