Java-无法使用ImageIO读取图像

时间:2013-12-28 18:43:00

标签: java

displaypicbase64编码的图片,但imageio.read(displaypic)返回null。没有例外

byte[] imageBytes = Base64.decodeBase64(DisplayPic);
ByteArrayInputStream bis = new ByteArrayInputStream(imageBytes);
try {                           
    BufferedImage image = ImageIO.read(bis);
    File dpPath = new File(DisplayPicturePath);
     if(!dpPath.exists())
        dpPath.createNewFile();
     ImageIO.write(image, "jpeg",dpPath);
} catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
}

0 个答案:

没有答案
相关问题