Maarten
Maarten

Reputation: 663

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.

Upvotes: 2

Views: 7253

Answers (2)

Lucas Alves
Lucas Alves

Reputation: 11

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.

Upvotes: 1

Maarten
Maarten

Reputation: 663

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.

Upvotes: 8

Related Questions