user3654650
user3654650

Reputation: 6133

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?")

Upvotes: 23

Views: 34664

Answers (1)

Marcin
Marcin

Reputation: 238957

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.

Upvotes: 39

Related Questions