Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.image.BufferedImage;
import java.io.File;
import java.net.URL;

import javax.imageio.ImageIO;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedImage image = null;

        URL url = new URL("URL_IMAGE");
        image = ImageIO.read(url);

        ImageIO.write(image, "jpg", new File("C:\\out.jpg"));
        ImageIO.write(image, "gif", new File("C:\\out.gif"));
        ImageIO.write(image, "png", new File("C:\\out.png"));

        System.out.println("Done");
    }
}