Does ImageIO read imply anti-aliased scaling?
-
20-09-2019 - |
Question
I've replaced the Java internal ImageFetcher with an own implementation using ImageIO. Some image renderers of our software, which use these images, now draw anti-aliased scaled images instead of non anti-aliased. The only change is the source of the image, which are now BufferedImages instead of Toolkit-Images.
The question now is, where is the difference? Which property causes the images to scale anti-aliased? I've always thought that the anti-alias key ONLY depends on the graphics I paint on - but this is obviously wrong.
By the way: unfortunately I cannot change the renderers.
Solution 2
Ok, after all there is one important difference: BufferedImages are RenderedImages, ToolkitImages are not. This may cause inconsistent behavior in some cases but doesn't seem to be a Java problem in general.
OTHER TIPS
If ImageIO.read does any anti-aliasing it's likely a platform-specific issue, as @Ichorus points out, since ImageIO.read doesn't specify anything about expected behaviour for scaling or anti-aliasing.
What you may try fiddling with is your rendering hints for your Graphics2D context before issuing g.drawImage or similar.
http://bit.ly/7b6lvg <-- Java Sun documentation on Graphics2D.setRenderingHint