Monday, October 30, 2006

Here's some code for blurring an image:

float[] kernelData = new float[9];
for (int i = 0; i < kernelData.length; i++)
{
kernelData[i] = 0.15f;
}
ConvolveOp blur = new ConvolveOp(new Kernel(3, 3, kernelData));
BufferedImage blurryImage = new BufferedImage(w, h, w, h,
BufferedImage.TYPE_INT_ARGB);
blurryImage.createGraphics().drawImage(imageToBlur, blur, 0, 2);

No comments: