static BWImage getAlphaChannel(BufferedImage src) { int w = src.getWidth(); int h = src.getHeight(); BWImage alpha = new BWImage(w, h); for y to h: for x to w: { //int a = (srcBuffer[i] >> 24) & 0xff; //int a = srcBuffer[i] & 0xff; int a = (src.getRGB(x, y) >> 24) &0xff; alpha.setByte(x, y, a); //print(intToHex= (srcBuffer[i])); } ret alpha; }