欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解析:android 如何從JPEG生成BufferedImage

 更新時間:2013年06月17日 08:54:14   作者:  
本篇文章是對在android中,如何從JPEG生成BufferedImage的解決方法進行了詳細的分析介紹,需要的朋友參考下
如下所示:
復制代碼 代碼如下:

private void readImage(String filename)  throws FileNotFoundException, IOException {
        FileInputStream fIn = new FileInputStream(filename);

//需要替換這邊的兩句:
        JPEGImageDecoder jpeg_decode = JPEGCodec.createJPEGDecoder(fIn);
        BufferedImage image = jpeg_decode.decodeAsBufferedImage();
        width = image.getWidth();
        height = image.getHeight();
        int[] rgbdata = new int[width * height];
        image.getRGB(0,0,width,height,rgbdata,0,width);
        bytes = new byte[rgbdata.length];
        doubles = new double[rgbdata.length];
        for (int i = 0; i < bytes.length; i++) {
          bytes[i]    = (byte)  (rgbdata[i] & 0xFF);
          doubles[i]  = (double)(rgbdata[i]);
        }
    }

相關文章

最新評論