dpi

Python/PyQt4: How do you find the SIZE of a monitor (in inches)?

我与影子孤独终老i 提交于 2019-12-20 01:46:24
问题 I'm trying to find the horizontal width of a monitor in inches or cm (not pixels!) to make a small "ruler" program. DPI would work too. I'm using PyQt4. 回答1: try using the QDesktopWidget's width() and height() to get the width and height respectively. Class reference at QDesktopWidget Class Reference, this will give you the screens size in pixels and then use QX11Info.appDpiX, this will give you the DPI in pixels per inch. Use both the above info to calculate the screen size in inches. PS:

9102年了,再谈屏幕适配!

隐身守侯 提交于 2019-12-19 11:44:25
前言 众所周知,Android授权的厂商不计其数,生产出的机型也数不胜数,导致尺寸碎片化很严重。 当然,都9102年了,大家逐渐得到了最优解,国内主流机型基本上都在720、1080、1440徘徊,最多高度上各有所长,但是还是保留着不少其他分辨率的手机,先来看一组数据(来源:友盟) 如图所证上述结论的正确性,但是可以看到,每年都有比例不小的其他尺寸的手机占据着市场份额,更何况那些还在服役的古董机器。我相信,这部分用户群是不可能被产品经理所割舍的。 为了解决这个问题,我们当然可以: 善于使用RelativeLayout、Linearlayout、ConstraintLayout; 合理使用wrap_content、match_content; 使用minHeight、minWidth、lines、ellipsize等等属性; 使用dp、sp单位; 以某个页面为单位针对不同的手机使用不同的布局、图片、dimen; 但是我想说,以上种种,只是一个Android开发应该具备的基本素质。 也许有人会问,这些还不够吗?而且dp、sp不已经是官方适配过了的单位吗?下面我们就来逐步剖析。 为什么官方需要使用设备独立像素适配 设备独立像素(dp、sp),又叫逻辑像素,是一种用缩放因子(scale)计算出来的、和像素有一定的换算比例的、不受设备分辨率和密度(ppi)制约的尺寸单位。 那么什么是分辨率

Calculating image size in inches or dpi from pixels using php

若如初见. 提交于 2019-12-19 10:03:33
问题 I need to calculate an approximate image size in inches assuming 300dpi. I have a target image size in mind, and i want to show the user if the image they have uploaded is adequate, or will need to be stretched, and offer various conditional messages based off of this. I already have the height and width in pixels, just need to know the math i guess. 回答1: DPI = "dots per inch". One dot = one pixel. 300 pixels in 300 dpi: 1 inch. You can work it out :-) 回答2: Given that dots == pixels: size in

Calculating image size in inches or dpi from pixels using php

不羁的心 提交于 2019-12-19 10:01:12
问题 I need to calculate an approximate image size in inches assuming 300dpi. I have a target image size in mind, and i want to show the user if the image they have uploaded is adequate, or will need to be stretched, and offer various conditional messages based off of this. I already have the height and width in pixels, just need to know the math i guess. 回答1: DPI = "dots per inch". One dot = one pixel. 300 pixels in 300 dpi: 1 inch. You can work it out :-) 回答2: Given that dots == pixels: size in

9102年了,再谈屏幕适配!

不打扰是莪最后的温柔 提交于 2019-12-19 08:58:54
前言 众所周知,Android授权的厂商不计其数,生产出的机型也数不胜数,导致尺寸碎片化很严重。 当然,都9102年了,大家逐渐得到了最优解,国内主流机型基本上都在720、1080、1440徘徊,最多高度上各有所长,但是还是保留着不少其他分辨率的手机,先来看一组数据(来源:友盟) 如图所证上述结论的正确性,但是可以看到,每年都有比例不小的其他尺寸的手机占据着市场份额,更何况那些还在服役的古董机器。我相信,这部分用户群是不可能被产品经理所割舍的。 为了解决这个问题,我们当然可以: 善于使用RelativeLayout、Linearlayout、ConstraintLayout; 合理使用wrap_content、match_content; 使用minHeight、minWidth、lines、ellipsize等等属性; 使用dp、sp单位; 以某个页面为单位针对不同的手机使用不同的布局、图片、dimen; 但是我想说,以上种种,只是一个Android开发应该具备的基本素质。 也许有人会问,这些还不够吗?而且dp、sp不已经是官方适配过了的单位吗?下面我们就来逐步剖析。 为什么官方需要使用设备独立像素适配 设备独立像素(dp、sp),又叫逻辑像素,是一种用缩放因子(scale)计算出来的、和像素有一定的换算比例的、不受设备分辨率和密度(ppi)制约的尺寸单位。 那么什么是分辨率

high DPI problems

て烟熏妆下的殇ゞ 提交于 2019-12-19 03:19:16
问题 I have a problem with the display of our .NET Windows application under high dpi settings. All forms are set to AutoScaleMode = DPI, but this does not solve all the problems. Basically labels end up expanding in size to cope woth the font being bigger, but the location of other controls does not change and we end up with lables obscuring other controls or eachother. The screen should look like this: http://www.manageinvest.com/good.jpg ..and on high DPI it ends up looking like this: bad.jpg

转:屏幕适配

心不动则不痛 提交于 2019-12-18 20:50:29
转自: here 众所周知,Android机型尺寸各种各样,于是屏幕适配就成了Android开发中很重要的一环。Android屏幕适配可能一些开发者都会遇到这样的问题,今天就来分享下屏幕适配,你会发现其实Android屏幕适配也可以很简单。 基本概念 Android屏幕适配必须要理解的一些概念,这部分可能比较枯燥,但是俗话说的好“工欲善其事,必先利器”,翻译过来就是“有什么样的枪,决定你打什么样的鸟”,一旦这些概念你理解掌握了,屏幕适配你自然而然就觉得简单多了。 px 是英文单词pixel的缩写,意为像素,屏幕上的点。我们通常所说的分辨率如480X800就是指的像素。 在设计领域中,像素是用来计算数码影像的最小单位。计算机中显示的图像并非连续的线条组成,而是由许多肉眼看不见的小点组成。如果把影像放大数倍,会发现这些连续色调其实是由许多色彩相近的小点所组成,这些小点就是构成影像的最小单位“像素”。由于是最小的独立显示单位,px均为整数,不会出现0.5px的情况。如: 看这个色彩鲜艳的LED灯(原图大小) 你能想象这才是他的本来面目吗?(放大之后) in 表示英寸,是屏幕的物理尺寸。每英寸等于2.54厘米。例如我们经常说的手机屏幕大小有,5(英)寸、4(英)寸就是指这个单位。这些尺寸是屏幕的对角线长度。如果手机的屏幕是4英寸,表示手机的屏幕(可视区域)对角线长度是4 X 2.54 =

分辨率、DPI、PPI和屏幕尺寸,你都知道是啥么?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 18:36:25
分辨率、DPI、PPI和屏幕尺寸 分辨率 DPI/PPI 坑爹的屏幕尺寸 Reference 手机开发中不免会遇到分辨率、DPI、PPI和屏幕尺寸等术语,那就弄弄清楚这些概念的真正含义。 分辨率 分辨率这个词在很多地方都有,比如相机、视频、扫描仪。这里说的就是显示器的分辨率。显示器是由一个个像素点(pixel)所组成的,一般所说的显示器分辨率是1280x720就表示这个显示器水平方向有1280个像素,垂直方向上有720个像素。但是并非分辨率越高屏幕显示效果越好,还需要根据屏幕的大小来决定。也就是要看像素的密度(pixel density),这个指标就是DPI(Dots Per Inch)或者PPI(Pixels Per Inch),即英尺屏幕上像素或者是点的个数。 DPI/PPI DPI = Dots Per Inch PPI = Pixel Per Inch 两个参数的区别就在于Dot和Pixel的区别,dot值的是显示器上每一个物理的点,而pixel指的是屏幕分辨率中的最小单位。这个两个难道会不一样么?会!当一个像素需要多于一个屏幕上的物理点来显示的时候dot就跟pixel不一样了。这个有另一个叫法叫做dppx(dot per pixel),即每个像素中有多少个点。大部分的显示器中一个像素即一个点,但目前一些比较好的屏幕和一些手机屏幕中dppx会大于1。比如说Mac

Windows Display Setting at 150% still shows 96 DPI

£可爱£侵袭症+ 提交于 2019-12-18 13:16:54
问题 On my laptop running Win7, when I set the display setting to 125%, the DPI shows up as 120 (using both graphics.DpiX and GetDeviceCaps) as expected. However, with the display at 150%, the DPI is 96 (?!), just like it is at 100%. Does anyone know a) why this is the case and b) is there any other way other than checking the DPI to detect if the display is set to anything other than 100%? I'm writing an app that I want to display a message when the display is set to >= 150%. Thanks. 回答1: On

Windows Forms DPI scaling

我们两清 提交于 2019-12-18 13:13:57
问题 My application looks good with 100% DPI setting, but when user selects different (125% or 150%) words don't fit in containers. I tried to fix this with solution I found here: Detect windows font size (100%, 125%, 150%) which is: this.AutoScaleMode = AutoScaleMode.Dpi; It fixed 150% setting (made it a little blur, but that's ok), unfortunately it didn't make the same for 125% which is being used on the PC the app is intended to run. Is there some easy fix to this or do I have to rearrange