打印图像时,是什么决定了页面上将显示多大的图像? [英] When printing an image, what determines how large it will appear on a page?

查看:138
本文介绍了打印图像时,是什么决定了页面上将显示多大的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Python的映像库,我想创建一个PNG文件.
我希望在打印此图像时,如果不进行任何缩放,它将始终以已知且一致的尺寸"在打印页面上进行打印.

Using Python's Imaging Library I want to create a PNG file.
I would like it if when printing this image, without any scaling, it would always print at a known and consistent 'size' on the printed page.

图像中是否编码了分辨率?

Is the resolution encoded in the image?

如果是,该如何指定?

即使是,这与打印机有关吗?

And even if it is, does this have any relevance when it goes to the printer?

推荐答案

从PIL 1.1.5开始,有一种获取DPI的方法:

As of PIL 1.1.5, there is a way to get the DPI:

im = ... # get image into PIL image instance
dpi = im.info["dpi"] # retrive the DPI
print dpi # (x-res, y-res)
im.info["dpi"] = new dpi # (x-res, y-res)
im.save("PNG") # uses the new DPI

这篇关于打印图像时,是什么决定了页面上将显示多大的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆