public static String _BitmapConvert(String imgpath) {
StringBuffer _sb = new StringBuffer();
File imgfile = new File(imgpath);
char[] charset = { 'M', '8', '0', 'V', '1', 'i', ':', '*', '|', '.', ' ' };
try {
BufferedImage buff = ImageIO.read(imgfile);
int bitmapH = buff.getHeight();
int bitmapW = buff.getWidth();
for (int y = 0; y < bitmapH; y++) {
for (int x = 0; x < bitmapW; x++) {
int rgb = buff.getRGB(x, y);
Color c = new Color(rgb);
int cc = (c.getRed() + c.getGreen() + c.getBlue()) / 3;//这是什么意思
_sb.append(charset[(int) ((cc * 10 - 1) / 255)]);//还有这??
}
_sb.append("\r\n");
}
} catch (Exception e) {
}
return _sb.toString();
}