My problem is that what I size a picture according to millimeters to pixels, and then print it out this will never be exact. My question is there a way to make java draw in millimeters or any other metric unit stead of pixels, because pixils will never be exact to millimeters.
Get the screen DPI using java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
Then simply do (MM * DPI)/25.4.
The outcome will be the amount of pixels relative to the physical length in MM.
Doing some analysis, you could understand better:
pixels = mm * inch/mm * pixels/inch
pixels = mm (milimeters) * 25.4 (how many inches I have in 1 mm) * DPI (screen resolution)
DPI is dots per inch, which is the same of pixels per inch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With