Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > PIL: match for ImageMagick's display -ping

Reply
Thread Tools

PIL: match for ImageMagick's display -ping

 
 
Torsten Bronger
Guest
Posts: n/a
 
      11-07-2006
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.)
 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      11-07-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
re.sub(): replace longest match instead of leftmost match? John Gordon Python 13 12-20-2011 02:58 AM
pat-match.lisp or extend-match.lisp in Python? ekzept Python 0 08-10-2007 06:08 PM
Match doesn't match Volkan Civelek Ruby 4 07-19-2006 07:44 AM
$match = true() for empty $match?? Victor XML 2 05-17-2004 10:43 AM
Java regex can't match lengthy match? hiwa Java 0 01-29-2004 10:09 AM



Advertisments