PIL: retreive image resolution (dpi)

Discussion in 'Python' started by AlexGreif.2609394@bloglines.com, Aug 22, 2005.

  1. Guest

    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, 2005
    #1
    1. Advertising

  2. Guest

    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:
    http://www.doxdesk.com/
     
    , Aug 22, 2005
    #2
    1. Advertising

  3. Terry Reedy Guest

    <> wrote in message
    news:...
    > 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
     
    Terry Reedy, Aug 22, 2005
    #3
  4. 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
     
    Do Re Mi chel La Si Do, Aug 22, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ixtlan
    Replies:
    5
    Views:
    8,251
    Steven Green
    Oct 20, 2003
  2. duikboot
    Replies:
    2
    Views:
    4,816
    Fredrik Lundh
    Dec 17, 2003
  3. Yofnik
    Replies:
    3
    Views:
    489
    Yofnik
    Jan 27, 2007
  4. Steve Yates
    Replies:
    6
    Views:
    1,124
    Donkey Hottie
    Aug 10, 2009
  5. Sverre
    Replies:
    2
    Views:
    3,569
    Sverre
    Dec 17, 2009
Loading...

Share This Page