Tue Nov 11, 2008 8:21 pm
import java.io.*;
import java.awt.image.*;
import javax.imageio.ImageIO;
public class CopyImage {
private static final float[] data = { 0.0f, -1.0f, 0.0f, -1.0f, 5.0f,
-1.0f, 0.0f, -1.0f, 0.0f };
public static void main(String args[]) throws IOException {
File fileIn = new File("image4.jpg");
BufferedImage bufferedImage1 = ImageIO.read(fileIn);
Kernel kernel = new Kernel(3, 3, data);
ConvolveOp convolveOp = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP,
null);
int width = bufferedImage1.getWidth();
int height = bufferedImage1.getHeight();
BufferedImage bufferedImage2 = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
convolveOp.filter(bufferedImage1, bufferedImage2);
File fileOut = new File("logo.gif");
ImageIO.write(bufferedImage2, "GIF", fileOut);
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.