The ImageIO class provides the method to read and write image. We are providing you an example which copies the specified input file into the output file.
Use of Image I/O library
This section illustrates you how to use Image I/O library.
The ImageIO class provides the method to read and write image. We are providing you an example which copies the specified input file into the output file. A file image4.jpg is defined as input file which is read by the method read() of ImageIO class and returns a buffered image after decoding the file.
A matrix is defined in the variable data of float type. This matrix is defined by the class Kernel to describe how a pixel affect its position in the output image of a filtering operation. The class ConvolveOp provides a correlation from the source to the destination. The method filter(input, output) of class ConvolveOp performs a translation on BufferedImages.
The method write(output, "GIF", outputFile) writes into the output file logo.gif.
Here is the code of CopyImage.java
import java.io.*;
|
When you run the above program, the input file is copied into the output file specified.