Hi, I'm new to Java and I have a problem with a project.
How can I apply a filter on a BufferedImage object and obtain a BufferedImage as a result? The thing is I have a filter class whose signature looks like this:

class BrightnessFilter extends RGBImageFilter {...}

and I can apply that on an Image (or BufferedImage) object by creating an ImageProducer and calling createImage on that ImageProducer, like this:

ImageFilter filter=new BrightnessFilter(val);
ImageProducer prod=new FilteredImageSource(img.getSource(),filter);
newimg=createImage(prod);

The thing is, createImage returns an Image object, but I need a BufferedImage instead.
Can anyone help me?