从DPI和尺寸计算缩放以获得全屏

时间:2014-04-05 20:41:03

标签: zoom pixel dpi poppler

在Poppler中,PDF文件呈现为图像, 我试图确定合适的缩放比率,以便能够渲染出适合全屏的图像。

我有所有参数,但我不知道为什么结果总是错误的。

myDPIx = 96

screenX = 1366px
screenY = 768px

imageX = 720px
imageY = 720px

zoomX = screenX/imageX
zoomY = screenY/imageY

newDPIx = myDPIx * zoomX
newDPIy = myDPIy * zoomY

我们假设我们有一个render()函数,它将被调用如下:

new_image = render(image, newDPIx, newDPIy)

不幸的是,渲染的图像太大,这意味着我的计算错了?

newImageX = 1840 
newImageY = 1045

大约 2.5 倍!

PS:如果我将缩放设置为1.4,我会得到合适的缩放,但我会尝试为所有屏幕分辨率制作这种缩放。 我错过了什么吗?

0 个答案:

没有答案
相关问题