-
-
Save bsorrentino/cf3f8a439ef688d2f869e1c00aaeecf9 to your computer and use it in GitHub Desktop.
// | |
// inspired by https://stackoverflow.com/a/838755/521197 | |
// | |
function getDPI() { | |
var div = document.createElement( "div"); | |
div.style.height = "1in"; | |
div.style.width = "1in"; | |
div.style.top = "-100%"; | |
div.style.left = "-100%"; | |
div.style.position = "absolute"; | |
document.body.appendChild(div); | |
var result = div.offsetHeight; | |
document.body.removeChild( div ); | |
return result; | |
} |
Hi @DCWizard thanks for contribution I'll add your snippet to gist
Thanks,
If you indulge me a little bit further.
It does not make sense to me to have only A DPI.
That doesn't make sense in a first place.
You have a width and a height. Not all screen have the same shape and proportions.
So, you should have a X DPI and a Y DPI.
One monitor I have is 1280x1024 on a 13x11in. Everything look weird on that monitor.
i.e. Movie/Video especially.
Strange that on printers and scanners (the good one) have all that info.
I should know. I made some of those.
As for 3D printers you also need a Z DPI.
Otherwise, you cannot phantom to produce anything worthy of the real world.
I think, I have just give my whole input on this now.
Let me know if I missed anything.
Hi @DCWizard thanks for contribution I'll add your snippet to gist