Open NathanSweet opened 2 years ago
Seems like getScaledInstance
with SCALE_AREA_AVERAGING
is the only sure way to get better results than bilinear.
@NathanSweet, have you tried using BufferedImage.TYPE_INT_ARGB
? I suspect that Java's Graphics2D rendering pipeline may act differently based on the image type that's being used. And yes, as you mentioned the black box nature of this pipeline makes it hard to chase these issues.
Expected behavior
Using
ScalingMode.BICUBIC
and downscaling to 50% I expect the output to be scaled using bicubic filtering.Actual behavior
The scaled image looks poor, like bilinear was used. The expected image is Photoshop's bicubic. The actual image looks like Photoshop's bilinear.![](http://n4te.com/x/2547-JkXG.png)
Steps to reproduce the behavior
Code below and this image file: http://n4te.com/x/2546-test.png
Environment
Notes
I traced it through BicubicResizer to AbstractResizer to Graphics2D#drawImage, eventually calling the native sun.java2d.loops.TransformHelper#Transform:
The
int txtype
parameter is3
, which is the "interpolation type" and I assume is AffineTransformOp.TYPE_BICUBIC (which is3
). If that's right, why isn't bicubic used? I hate this AWT black box where only "hints" are provided.