
z11.decaptcha.IMG Maven / Gradle / Ivy
package z11.decaptcha;
import java.awt.image.BufferedImage;
public class IMG {
public int[][] mt;
public int h;
public int w;
public IMG(BufferedImage image) throws Exception {
this.h = image.getHeight();
this.w = image.getWidth();
this.mt = new int[this.h][];
for (int i = 0; i < this.h; i++) {
this.mt[i] = new int[this.w];
}
for (int i = 0; i < this.h; i++) {
for (int j = 0; j < this.w; j++) {
int color32bit = image.getRGB(j, i);
int aValue = (color32bit >> 24) & 0xFF;
int redValue = (color32bit >> 16) & 0xFF;
if (redValue == 0 && aValue == 255) {
this.mt[i][j] = 1;
} else {
this.mt[i][j] = 0;
}
//System.out.print("\t"+ r + "-" + a);
}
//System.out.println();
}
//out();
}
public void out() {
for (int i = 0; i < this.h; i++) {
for (int j = 0; j < this.w; j++) {
System.out.print(this.mt[i][j]);
}
System.out.println();
}
}
// public static void main(String[] sdfsdf)
// throws Exception {
// img IMG = new img("D:\\Dropbox\\adp\\word\\52.png", true);
//
// IMG.out();
// }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy