Changeset 465 for pwntcha


Ignore:
Timestamp:
Jan 18, 2005, 3:34:23 PM (18 years ago)
Author:
Sam Hocevar
Message:
  • Workaround for problems with Gandi captchas.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pwntcha/trunk/src/scode.c

    r445 r465  
    5151        stats[i] = 0;
    5252
    53     for(y = 0; y < 3; y++)
     53    for(y = 0; y < 6; y++)
     54    {
     55        int y2 = (y & 1) ? img->width - 1 - y / 2 : y / 2;
    5456        for(x = 0; x < img->width; x++)
    5557        {
    56             getpixel(tmp1, x, y, &r, &g, &b);
    57             stats[r + g + b]++;
    58             getpixel(tmp1, x, img->height - 1 - y, &r, &g, &b);
    59             stats[r + g + b]++;
    60         }
     58            getpixel(tmp1, x, y2, &r, &g, &b);
     59            if(stats[r + g + b] == 0)
     60            {
     61                /* Parse middle line to see if this colour can be removed */
     62                int available = 0, x2, r2, g2, b2;
     63                stats[r + g + b] = 1;
     64                for(x2 = 0; x2 < img->width; x2++)
     65                {
     66                    getpixel(tmp1, x2, img->width / 2, &r2, &g2, &b2);
     67                    if(stats[r2 + g2 + b2] == 0)
     68                        available = 1;
     69                }
     70                if(!available)
     71                    stats[r + g + b] = 2;
     72            }
     73        }
     74    }
    6175
    6276    /* Set non-background colours to 0 */
     
    6579        {
    6680            getpixel(tmp1, x, y, &r, &g, &b);
    67             if(stats[r + g + b])
     81            if(stats[r + g + b] == 1)
    6882                setpixel(tmp1, x, y, 255, 255, 255);
    6983            else
Note: See TracChangeset for help on using the changeset viewer.