Knowledge Walls
John Peter
Pune, Maharashtra, India
How to Copy image in Core Java using javax.imageio with Example
9564 Views
Hints 
In this Example explained how to copy image using Java.imageio package Classes.

Startup program for manipulating images with java libraries for multiple image oriented concepts. First concept just takes the stream of the images and creates the copy of the file using ImageIO.write() method.

Example
ImageIO.write(<buffered image>,<type of the image> , <file object>);
ImageIOJavaExample
import java.awt.image.BufferedImage;
import java.io.File;
import java.net.URL;

import javax.imageio.ImageIO;

public class ImageIOJavaExample {
    public static void main(String args[]) throws Exception{    
        URL imageURL = new URL("file:///D:/hello-world.png");
        BufferedImage bi = ImageIO.read(imageURL);
        
        ImageIO.write(bi, "jpg", new File("D:/hello-world-copy.png"));
        System.out.println("Copied!");
    }
}
Output 
Copied!
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details