470,826 Members | 1,811 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,826 developers. It's quick & easy.

PIL: match for ImageMagick's display -ping

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.)
Nov 7 '06 #1
1 1526
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

Nov 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Duncan Smith | last post: by
3 posts views Thread by querypk | last post: by
4 posts views Thread by Callum Prentice | last post: by
reply views Thread by Sebastjan Trepca | last post: by
2 posts views Thread by Odalrick | last post: by
2 posts views Thread by Craig | last post: by
5 posts views Thread by cbmeeks | last post: by
8 posts views Thread by Larry Bates | last post: by
reply views Thread by Alex K | last post: by
reply views Thread by IanJSparks | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.