The performance of Image.getScaledInstance() has been known to be a problem for a long time. (This ticket <https://bugs.openjdk.org/browse/JDK-6196792> discusses it well. It has a complicated history.)

I have developed code <https://github.com/mickleness/pumpernickel/wiki/Scaling> that is much more performant. It takes less than 10% of the time the AreaAveragingScaleFilter does. There’s nothing especially clever about it; it just iterates over the pixels more efficiently. Like AreaAveragingScaleFilter: it doesn’t suffer degraded appearance (pixelation) at less than 50% scale.

Is there any interest in me working on a PR to overhaul AreaAveragingScaleFilter? (That is: is there interest in reviewing/sponsoring such a PR?) It won’t be a trivial task, but the results I have now indicate the performance gains could be significant.

(Or in my wildest of pipe dreams: I’d love it if Graphics2D.drawImage(..) could scale images past 50% without looking pixelated… but that could be an even more difficult discussion about RenderingHints and long-established interpolation norms. So I assume that’s a non-starter.)

Regards,
 - Jeremy

Reply via email to