Picture resolution and PIL

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Fri Apr 6 15:15:52 EDT 2007


Johny:
> Is it possible to find out a picture resolution by using  PIL package

By Gian Mario Tagliaretti:
import PIL.Image
a = PIL.Image.open("foo.jpg")
a.info["dpi"]
(72, 72)

(It may raise an exception if that information isn't available)
I don't know if that can be used to read the DPI tag inside a TIFF
image.
You can also read the pixel size of any image.

Bye,
bearophile




More information about the Python-list mailing list