用java读取图片的三种方式

参考网址:http://www.cnblogs.com/zxp_9527/archive/2009/03/20/1417504.html

        // Read from a file
        File sourceimage = new File("source.gif");
        image = ImageIO.read(sourceimage);

        // Read from an input stream
        InputStream is = new BufferedInputStream(
           new FileInputStream("mid.jpg")); 
        image = ImageIO.read(is);

        // Read from a URL
        URL url = new URL("http://www.javaworld.com/images/012407-tipsbox.jpg");
        image = ImageIO.read(url);

你可能感兴趣的:(用java读取图片的三种方式)