javahidpi

Can we bypass HiDPI UI scaling when rendering high-res RenderedImages in Java 9+


I am working on a medical image viewer, and would like to take advantage of the HiDPI scaling options offered by Java since Java 9. I like that Java/Swing is not able to properly scale up fonts, layouts, and various UI elements, but as has been lamented in multiple posts in here, doesn't automatically do a good job with bitmaps, displaying icons and images in a very pixelated way.

I have seen several questions and answers in here about how to deal with badly scaled up icons. This is not what this is about.

My question is about displaying and interacting with high-resolution images without having them scaled up while rendering, when everything else in the UI is being scaled up. I don't want to turn off HiDPI scaling altogether, I want to use it for the UI.

Is there a way to selectively display RenderedImages in screen resolution, bypassing the scaling?


Solution

  • I took me a while digging through a lot of unrelated or tangentially related topics, but I did eventually find an answer to my own question here:

    jdk 9 high dpi disable for specific panel