PIL: retreive image resolution (dpi)

and-google at doxdesk.com and-google at doxdesk.com
Mon Aug 22 07:12:49 EDT 2005


AlexGreif.2609394 at bloglines.com wrote:

> I looked at the PIL Image class but cannot see a posibility to retreive
> the image resolution dots per inch (or pixels per inch)

Not all formats provide a DPI value; since PIL doesn't do anything with
DPI it's not part of the main interface.

For PNG and JPEG at least the value may be retrievable from the extra
info dictionary (image.info['dpi']) when loaded from a file that sets
it. Expect an (x, y) tuple (not necessarily square-pixel).

-- 
And Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/




More information about the Python-list mailing list