PIL: match for ImageMagick's display -ping

Discussion in 'Python' started by Torsten Bronger, Nov 7, 2006.

  1. Hallöchen!

    I have to extract the dimensions of many bitmap files. An old Bash
    script did it with ImageMagick's "display -ping ...". "-ping" means
    that it extracts the image dimensions efficiently. I suspect it
    simply doesn't read the image itself.

    Now the Bash script has been transformed into Python+PIL. Is there
    a way to get the dimensions equally efficient here, or does the PIL
    even do this optimisation implicitly since I never access the image
    bitmap itself?

    Thank you!

    Tschö,
    Torsten.

    --
    Torsten Bronger, aquisgrana, europa vetus
    ICQ 264-296-646
    (See http://ime.webhop.org for Jabber, MSN, etc.)
     
    Torsten Bronger, Nov 7, 2006
    #1
    1. Advertising

  2. Torsten Bronger

    Steve Holden Guest

    Torsten Bronger wrote:
    > Hallöchen!
    >
    > I have to extract the dimensions of many bitmap files. An old Bash
    > script did it with ImageMagick's "display -ping ...". "-ping" means
    > that it extracts the image dimensions efficiently. I suspect it
    > simply doesn't read the image itself.
    >
    > Now the Bash script has been transformed into Python+PIL. Is there
    > a way to get the dimensions equally efficient here, or does the PIL
    > even do this optimisation implicitly since I never access the image
    > bitmap itself?
    >
    >>> import Image
    >>> i = Image.open("Hello.png")
    >>> i.size

    (142, 23)
    >>>


    The image data isn't read until an operation requires it, so this is an
    efficient way to get its size.

    regards
    Steve
    --
    Steve Holden +44 150 684 7255 +1 800 494 3119
    Holden Web LLC/Ltd http://www.holdenweb.com
    Skype: holdenweb http://holdenweb.blogspot.com
    Recent Ramblings http://del.icio.us/steve.holden
     
    Steve Holden, Nov 7, 2006
    #2
    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. Yogee

    Java v/s ImageMagick

    Yogee, Sep 6, 2005, in forum: Java
    Replies:
    7
    Views:
    778
    Andrew Thompson
    Sep 8, 2005
  2. Sebastjan Trepca

    PIL and ImageMagick scalability

    Sebastjan Trepca, Dec 26, 2005, in forum: Python
    Replies:
    0
    Views:
    401
    Sebastjan Trepca
    Dec 26, 2005
  3. Fredrik Lundh

    Re: PIL and ImageMagick scalability

    Fredrik Lundh, Dec 27, 2005, in forum: Python
    Replies:
    0
    Views:
    479
    Fredrik Lundh
    Dec 27, 2005
  4. Torsten Bronger

    PIL: match for ImageMagick's display -ping

    Torsten Bronger, Nov 7, 2006, in forum: Python
    Replies:
    0
    Views:
    241
    Torsten Bronger
    Nov 7, 2006
  5. Sverre
    Replies:
    2
    Views:
    3,568
    Sverre
    Dec 17, 2009
Loading...

Share This Page