//首先生成一个图片,然后取每一行的像素值
   
    //创建图像
    int width = 50,height = 20;
    BufferedImage image = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);    
    Graphics g = image.getGraphics();
    g.setColor(Color.white);
    g.fillRect(0, 0, width, height);
    g.setColor(Color.black);
    g.drawRect(0, 0, width, height);
    String text="这里是图版内容"   
    g.setColor(Color.black);
    g.drawString(text, 2, 14);
    g.dispose();
   //取每行的像素值
for (int i = 0; i < image.getHeight(); i++) {
java.util.List pixelData=new ArrayList();
try{
int w=image.getWidth();
int r[]=new int[w];
int gb[]=new int[w];
WritableRaster raster = image.getRaster();
int colorData[]=new int[4];
for (int j = 0; j < width; j++) {
colorData=raster.getPixel(j,i,colorData);
r[j]=colorData[0];
gb[j]=colorData[1];
System.out.print(" "+j+"="+r[j]+","+gb[j]);
//这里输出的值为什么都是255?
}
pixelData.add(r);
pixelData.add(gb);
}catch(Exception fe){
fe.printStackTrace();
}


}