Java读取网络图片

public static void main(String[] args) {  
        BufferedImage image = null;  
        try {  
            URL url = new URL("http://img1.gtimg.com/13/1310/131008/13100832_980x1200_0.jpg");  
            image = ImageIO.read(url);  
  
            ImageIO.write(image, "jpg", new File("F:\\Test\\1.jpg"));  
            ImageIO.write(image, "gif", new File("F:\\Test\\1.gif"));  
            ImageIO.write(image, "png", new File("F:\\Test\\1.png"));  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
        System.out.println("完成下载~");  
    }  

 

你可能感兴趣的:(Java核心)