PPRuNe Forums - View Single Post - Forcing a graphic/photograph to display at an exact size.
Old 14th September 2010 | 20:42
  #3 (permalink)  
bnt
15 Anniversary
 
Joined: Feb 2007
Posts: 755
Likes: 26
From: Dublin, Ireland. (No, I just live here.)
Things are better then they used to be, but not quite there yet. The OS needs to know the DPI (dots per inch) of the monitor. Modern monitor hardware has something called EDID, which reports the hardware details to the OS, including the display size in cm. But ... some EDIDs lie, or the OS ignores it.

Have a look at what this site does with JavaScript: Display DPI detector - find out DPI of your monitor

The code is there to see, and the following lines query the OS for its figures:
Code:
<script type='text/javascript'>  dpi_x = document.getElementById('testdiv').offsetWidth; dpi_y = document.getElementById('testdiv').offsetHeight;
</script>
You could use these figures to scale graphics accordingly. However, this is nevertheless what the OS reports, and may not reflect reality. It tells me that this netbook has a 96x96 DPI resolution, while a few seconds with a ruler and a calculator tell me that it's more like 120 DPI. The EDID in my case has the correct physical dimensions (220mm x 129mm = 10" diagonal) - so Ubuntu should have picked this up, but it didn't - or chose not to.

In my case I can now set the OS (Ubuntu Linux) to display at 120 DPI, but not everyone knows there's even a problem ...

Last edited by bnt; 14th September 2010 at 21:01.
bnt is offline  
Reply