JDK-6196792 Image.getScaledInstance

Aleksei Ivanov alexey.ivanov at oracle.com
Thu Oct 5 12:55:43 UTC 2023


Hi Jeremy,

I looked through the comments in the bug and your wiki. If 
Image.getScaledInstance() is not recommended, we may want to do 
something about it: as the bug report suggests, either deprecate the 
method and provide guidelines for the recommended way or fix the 
implementation.

Yet I don't have extensive experience in Java 2D.

You can add this a the comment in JBS and ask for Phil's opinion.


Regards,
Alexey

On 23/06/2023 07:06, Jeremy Wood wrote:
> 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/20231005/d2be8fc6/attachment.htm>


More information about the client-libs-dev mailing list