JAI Image Scaling Yields Poor, Aliased Results
I'm writing a program against JAI which performs some image scaling from JPEG and PNG source images.
At any rate, the scalingdown of images yields very poor results. I am performing the downscale with the following code:
privatestatic RenderedOp scaleImage(RenderedOp originalImage,float scaleFactor){
Interpolation interp = Interpolation.getInstance(Interpolation.INTERP_BICUBIC);
ParameterBlock params =new ParameterBlock();
params.addSource(originalImage);
params.add(scaleFactor);// x scale factor
params.add(scaleFactor);// y scale factor
params.add(0.0F);// x translate
params.add(0.0F);// y translate
params.add(interp);// interpolation method
return JAI.create("scale", params);
}
When I compare the results against a photoshop image size manipulation they are very poor.
When I compare results of java.awt.Image:getScaledInstance(x, y, java.awt.Image.SCALE_AREA_AVERAGING)
against photoshop, they are almost identical. Is there any way to use the area averaging algorithm with JAI? Has anyone implemented it under the javax.media.jai.Interpolation interface?
Thanks for any help!
-matt

