我试图将dataurl转换为图像,但它不适用于svg文件

时间:2017-06-22 07:09:13

标签: java

//read image
try{
  // f = new File("G:\\Image\\Taj.jpg"); //image file path
  URL url = new URL("https://daks2k3a4ib2z.cloudfront.net/582092645c2f894f0cf8f02f/58481fbed43b9934653a9440_Analytiks%20en-01.jpg");

  image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  image = ImageIO.read(url);
  System.out.println("Reading complete.");
}catch(IOException e){
  System.out.println("Error: "+e);
}

//write image
try{
  f = new File("G:\\Image\\abc.jpg");  //output file path
  ImageIO.write(image, "jpg", f);
  System.out.println("Writing complete.");
}catch(IOException e){
  System.out.println("Error: "+e);`
}

0 个答案:

没有答案