473,399 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

PIL: retreive image resolution (dpi)

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.
Aug 22 '05 #1
3 19422
Al***************@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:an*@doxdesk.com
http://www.doxdesk.com/

Aug 22 '05 #2

<an********@doxdesk.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Al***************@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.


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

Aug 22 '05 #3
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

Aug 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: duikboot | last post by:
Hi there, In Photoshop I can, when I want to change the dpi(dots per inch) of a picture, arrange that the picture won't be resized. Do you know of a way, I can accomplish this in python with...
0
by: mchl gdbt | last post by:
Hi, I have several thousand tiffs generated by application A which are read by application B. I need to remove a few colours from the tiffs and I decided to try with the python imaging library....
2
by: Johny | last post by:
Is it possible to find out a picture resolution by using PIL package? Thanks for help L.
9
by: kombu67 | last post by:
I'm reading a series of images from a MS SQL table and saving them to directory. These are staff ID pictures from our security card app. Once I've extracted the ID photo from the security app to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.