473,387 Members | 1,859 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,387 software developers and data experts.

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 1641
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Duncan Smith | last post by:
Hello, Can anyone advise me how to crop an EPS image generated by dislin. I can't figure out how to crop the image before generating it. Using PIL to crop the generated image I get an IOError...
3
by: querypk | last post by:
Hi I would like to know how to resize an Image without using python Imaging library.
4
by: Callum Prentice | last post by:
i need a "script" that i can use locally as well as online that will: * create a large (maybe something like 2k x 2k) master image in memory * open a text file and read all the lines from it...
0
by: Sebastjan Trepca | last post by:
Hi everyone! I have a question about image processing. We have a website which will process a lot of images a day.It will be running Apache(worker) with mod_python. My question is what should we...
2
by: Odalrick | last post by:
I'm making a simple program to crop and scale images, essentially make thumbnails from a user defined subset of the image. I'm planning to use Python Image Library to crop and resize the images,...
2
by: Craig | last post by:
Hi there, I'm trying to convert some PNG files to bitmap files which can then be converted to X11 bitmaps using the im.tobitmap() function. But the error I get when using the im.tobitmap()...
5
by: cbmeeks | last post by:
I have created an image hosting site and when a user uploads an image, I want a service to run on the server to create a few thumbnails while the user does other things. My stupid host...
8
by: Larry Bates | last post by:
I have a project that I wanted to solicit some advice on from this group. I have millions of pages of scanned documents with each page in and individual .JPG file. When the documents were scanned...
0
by: Alex K | last post by:
Hello, Would anyone know how to generate thumbnails with rounded corners using PIL? I'm also considering imagemagick if PIL turns out not to be appropriate for the task. Thank you so much, ...
0
by: IanJSparks | last post by:
I've been doing some image rotation with PIL and comparing the images with imagemagick's convert -rotate output. Imagemagick uses an RBS / Paeth rotation algorithm that appears to give better...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.