473,609 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1655
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("Hel lo.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
1931
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 (apparently because I'm using Windows). I could use other file formats, but I'm not too keen on the results I'm getting from using e.g. .tif. Basically I need to copy (publication quality) images created in dislin and paste them into word...
3
5492
by: querypk | last post by:
Hi I would like to know how to resize an Image without using python Imaging library.
4
9573
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 (maybe 1000 lines max) * each line is composed of an x, y, name and a png image filename * for each line, open the png image and position it in the master image at the location given by x & y * save off the master image to a png at the end
0
1087
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 use for processing. If we use PIL the processing will be done with the same process that handles other requests and that will probably slow them down when there will be a peak. If we use ImageMagick you create new process that does the image...
2
8435
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, mostly to make the resized smaller images look good. How do I display a PIL image with wxPython?
2
8763
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() function on the PNG files I get the following error: Traceback (most recent call last): File "<pyshell#2>", line 1, in <module>
5
3737
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 (pair.com) doesn't have PIL installed and I'm too much of a stupid newbie to figure out how to get it to work with them (access denied while installing it, of course). Also, they don't have any python interface setup for GD.
8
1334
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 the people that did the scanning put a colored (hot pink) separator page between the individual documents. I was wondering if there was any way to utilize PIL to scan through the individual files, look at some small section on the page, and...
0
264
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, Alex
0
1319
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 results than PIL's rotate method. However, I love PIL and don't want to have to shell out to imagemagick or use it's python bindings if I can stay with my beloved Python Imaging Library.
0
8129
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8074
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8220
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8404
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6056
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5509
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2530
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1386
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.