Search code examples
javaprintingsizelwjglimage-resizing

How to make java use millimeters instead of pixels?


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.


Solution

  • 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.