How to get vision client resolution

Updated. Note this this doesn’t work in Java 8, as it always returns 100% scaling, for some reason. Java 11 seems to be okay. :man_shrugging:

import java.awt

gd=java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
width = gd.getDisplayMode().getWidth()
height = gd.getDisplayMode().getHeight()

dpi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution()

tf = gd.getDefaultConfiguration().getDefaultTransform()

print 'resolution:', width, 'x', height
print 'dpi:', dpi
print 'scaleX:', tf.getScaleX()
print 'scaleY:', tf.getScaleY()
5 Likes