简体   繁体   中英

Get image dpi for tif files using Pillow

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM