I use java to get screen sizes and resolution. When I run the following code, I get the output below.
Toolkit toolkit = Toolkit.getDefaultToolkit ();
Dimension dim = toolkit.getScreenSize();
System.out.println("Width of Screen Size is "+dim.width+" pixels");
System.out.println("Height of Screen Size is "+dim.height+" pixels");
int resolution =Toolkit.getDefaultToolkit().getScreenResolution();
System.out.println(resolution);
output:
Width of Screen Size is 1920 pixels
Height of Screen Size is 1080 pixels
120
Now Javadoc says getScreenResolution returns the resolution in dpi (dots per inch). I suppose that means that if I have an image with a width of 600 pixels, it will be 5 inches on my screen. When I measure, it is actually 4 inches wide. Pointing me that it should be 150 dpi.
My monitor is a 15.6-inch monitor, and I measure it at 13.6 inches and just over 7.6 inches. Now the width of my screen is apparently 1920 pixels, which is about 141 pixels per inch. Similarly, 1080 / 7.6 calculates about 141 pixels per inch.
- 600x600px. 4.25 ", 141 .
getScreenResolution 120?
, , .