JDK-6196792 Image.getScaledInstance

Jeremy Wood mickleness at gmail.com
Fri Jun 23 06:06:03 UTC 2023


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20230623/a512c035/attachment.htm>


More information about the client-libs-dev mailing list