How to get tiff image DPI using pillow? Cant see in documentation.
from PIL import Image
im = Image.open('test.tif')
print("im dpi?")
To find out an image's DPI in Windows, right-click on the file name and select Properties > Details. You'll see the DPI in the Image section, labeled Horizontal Resolution and Vertical Resolution. On a Mac, you need to open the image in Preview and select Tools > Adjust Size. It's labeled Resolution.
Pillow builds on this, adding more features and support for Python 3. It supports a range of image file formats such as PNG, JPEG, PPM, GIF, TIFF, and BMP.
Right-click on the image file and click Properties at the bottom of the menu. In the Properties menu, click the Details tab. Scroll down to the Image section of the menu, you'll see two values that give you your image's DPI: Horizontal Resolution and Vertical Resolution.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With