当前位置:网站首页>JS get DPI, PX to cm, cm to PX
JS get DPI, PX to cm, cm to PX
2022-07-03 14:08:00 【Cheat the old traditional Chinese medicine in the Jianghu】
// obtain DPI
function js_getDPI() {
var arrDPI = new Array();
if ( window.screen.deviceXDPI != undefined ) {
arrDPI[0] = window.screen.deviceXDPI;
arrDPI[1] = window.screen.deviceYDPI;
}
else {
var tmpNode = document.createElement( "DIV" );
tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
document.body.appendChild( tmpNode );
arrDPI[0] = parseInt( tmpNode.offsetWidth );
arrDPI[1] = parseInt( tmpNode.offsetHeight );
tmpNode.parentNode.removeChild( tmpNode );
}
return arrDPI;
}because :1 Inch = 2.54cm
px turn cm:cm = pxValue/dpi*2.54
px = cm/2.54*dpi
边栏推荐
- 3D视觉——2.人体姿态估计(Pose Estimation)入门——OpenPose含安装、编译、使用(单帧、实时视频)
- Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride( simpleParallax. JS (create poor visual effects for website pictures)
- Record 405 questions about bank callback post request
- GoLand 2021.1: rename the go project
- Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
- 金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
- How to promote the progress of project collaboration | community essay solicitation
- Qt学习20 Qt 中的标准对话框(中)
- jvm-运行时数据区
猜你喜欢

Example analysis of QT learning 18 login dialog box

Another industry has been broken by Chinese chips. No wonder the leading analog chip companies in the United States have cut prices and sold off

Multi person collaborative data annotation based on Baidu brain easydata from scratch
[email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂"/>金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂

Qt学习17 对话框及其类型

jvm-运行时数据区

Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.

如何使用lxml判断网站公告是否更新

jvm-类加载

JS matrix zero
随机推荐
js . Find the first palindrome string in the array
MySQL data processing value addition, deletion and modification
金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
QT learning 25 layout manager (4)
Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride(
Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
Programmable logic device software testing
Go language web development series 30: gin: grouping by version for routing
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
Uniapp tips - set background music
Webpage connection database ~ simple implementation of addition, deletion, modification and query complete code
Use vscode to view hex or UTF-8 codes
使用vscode查看Hex或UTF-8编码
Qt学习17 对话框及其类型
Solve the problem of dormitory router campus network sharing login
可编程逻辑器件软件测试
Why don't I have a rookie medal
消息订阅与发布
jvm-对象生命周期
GoLand 2021.1.1: configure the multi line display of the tab of the open file