PIL: retreive image resolution (dpi)

A

AlexGreif.2609394

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

Could somebody
please tell me how to get these metadata infos in PIL?

thanks,
Alex.
 
A

and-google

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).
 
T

Terry Reedy

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

Digital images intrinsically have a size in pixels, not a 'resolution'.
Resolutions (dpi or whatever) represent relationships and transformations
between images and physical substrates. Somes images have an input
transform, though for digital cameras, the input dpi or dpm(illimeter) of
the ccd imager is seldom useful. Some have one *or more* output
transforms. Some have both. So I think the option i/o transforms are best
thought of and kept as 'extra' data. (The same applies to strings and I/O
formats.)

Terry J. Reedy


Terry J. Reedy
 
D

Do Re Mi chel La Si Do

Hi !


The size of a image is an element ; but resolution is another. It is the
link, between the image and the reality. Size AND resolution can to give the
scale.

Exemple : when you scan a document, the size (in pixels) is not sufficient,
for to reproduce the document. Size + resolution, yes.


@-salutations

Michel Claveau
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top