package com.memorynotfound.image;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
public class ReadImageExample {
public static void main(String... args) throws IOException {
File folderInput = new File("/tmp/duke.png");
BufferedImage folderImage = ImageIO.read(folderInput);
URL urlInput = new URL("https://memorynotfound.com/wp-content/uploads/java-duke.png");
BufferedImage urlImage = ImageIO.read(urlInput);
File classPathInput = new File(ReadImageExample.class.getResource("duke.png").getFile());
BufferedImage classpathImage = ImageIO.read(classPathInput);
InputStream isInput = new FileInputStream("/tmp/duke.png");
BufferedImage inputStreamImage = ImageIO.read(isInput);
}
}