Open asomolinos opened 3 years ago
Looks much better 👍
Have you also tried RenderingHints.VALUE_INTERPOLATION_BICUBIC
?
Would it be possible to enable image interpolation by default in FlatLaf?
Sounds like a good idea. Will try with some applications to find out whether this has drawbacks.
From another project, I can remember that scaling small icons (<= 16x16) to 200% results in blurred icons when using bicubic. In this case NEAREST_NEIGHBOR was better.
Hi @DevCharly,
Yes, I have tried bicubic and other RenderingHints but I have not seen much difference. Maybe, the best option is that it can be configured through UIManager:
UIManager.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
Thanks!
I am struggling with the same issue described this bug. In case it helps @asomolinos, I load my ImageIcons with the paintIcon method overridden, essentially to perform what NetBeans did: https://github.com/apache/netbeans/blob/4ae01ea70f4530443343beee3292e880a74099bd/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java#L1193 (One change, round instead of cast to int at line 1209, or else icons might "jump").
From another project, I can remember that scaling small icons (<= 16x16) to 200% results in blurred icons when using bicubic. In this case NEAREST_NEIGHBOR was better.
When the scale factor is not an integral multiplication (e.g. 125%), NEAREST_NEIGHBOR is ugly. Blurry is an improvement.
When I put an image (jpg, png...) on a JLabel this is scaled to fit the screen DPI, but if interpolation is not enabled it looks really bad.
Example scaling 125% without interpolation:
I have found a partial solution by overriding the JLabel paintComponent method:
Example scaling 125% with interpolation:
Would it be possible to enable image interpolation by default in FlatLaf?