使用 Pillow 获取 tif 文件的图像 dpi [英] Get image dpi for tif files using Pillow

查看:114
本文介绍了使用 Pillow 获取 tif 文件的图像 dpi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用枕头获取 tiff 图像 DPI?在文档中看不到.

How to get tiff image DPI using pillow? Cant see in documentation.

from PIL import Image
im = Image.open('test.tif')
print("im dpi?")

推荐答案

DPI 中的图像分辨率应该在 info 字典(有关 tiff 图像的 info 的更多信息,请参见 此处):

Image resolution in DPI should be available in info dictionary (more about info for tiff images can be found here):

print(im.info['dpi'])

不过,并非所有图像都提供此信息.

Though, not all images provide this information.

这篇关于使用 Pillow 获取 tif 文件的图像 dpi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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