From rowen at uw.edu Thu Jul 1 00:37:32 2010 From: rowen at uw.edu (Russell E. Owen) Date: Wed, 30 Jun 2010 15:37:32 -0700 Subject: [Image-SIG] Mac binaries to test Message-ID: I built two Mac binaries of PIL 1.1.7: one for Python 2.5, the other for Python 2.6. Both should be compatible with Mac OS X 10.3.9 and later. They are missing support for Little CMS (despite building and installing it; I don't know what went wrong), but the self test showed everything else was working fine. Please give them a try. If they are deemed suitable I hope they can be served at the official site. -- Russell Overview of how I built them: - I built libjpeg 8b, libfreetype 2.3.12 and lcms2-2.0a from source, first defining MACOSX_DEPLOYMENT_TARGET=10.4 and running configure as follows: env CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc" ./configure --disable-dependency-tracking I ran self-tests (make check) if available. The lcms tests failed with complaints about architecture even though the file command showed the right library was built with the correct architecture so I left it installed in hopes it would work (but it didn't). I then deleted the dynamic libraries from /usr/local/lib and built PIL using bdist_mpkg. PIL's self-test shows (for the Python 2.6 version): $ python selftest.py -------------------------------------------------------------------- PIL 1.1.7 TEST SUMMARY -------------------------------------------------------------------- Python modules loaded from /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-pack ages/PIL Binary modules loaded from /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-pack ages/PIL -------------------------------------------------------------------- --- PIL CORE support ok --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok *** LITTLECMS support not installed -------------------------------------------------------------------- Running selftest: --- 57 tests passed. From rowen at uw.edu Thu Jul 1 00:39:51 2010 From: rowen at uw.edu (Russell E. Owen) Date: Wed, 30 Jun 2010 15:39:51 -0700 Subject: [Image-SIG] Mac binaries to test -- the link Message-ID: Here's the link: -- Russell From Chris.Barker at noaa.gov Thu Jul 1 01:12:53 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 30 Jun 2010 16:12:53 -0700 Subject: [Image-SIG] Mac binaries to test In-Reply-To: References: Message-ID: <4C2BCF75.5000502@noaa.gov> Russell E. Owen wrote: > I built two Mac binaries of PIL 1.1.7: one for Python 2.5, the other for > Python 2.6. Both should be compatible with Mac OS X 10.3.9 and later. Russell, this is great -- thanks! It seems to work on os-x 10.5, PPC, python 2.6 > They are missing support for Little CMS I don't use CMS, though it would be nice to get that working. FWIW, macports seems to be able to build universal binaries that work (though I only tested on 10.5). Maybe you can find a hint in the port file. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From olt at bogosoft.com Fri Jul 2 14:54:00 2010 From: olt at bogosoft.com (Oliver Tonnhofer) Date: Fri, 2 Jul 2010 14:54:00 +0200 Subject: [Image-SIG] New fast quantizer for PIL In-Reply-To: <943F455E-83DB-4A23-AD1E-556C290C4D17@bogosoft.com> References: <943F455E-83DB-4A23-AD1E-556C290C4D17@bogosoft.com> Message-ID: Hi all, I want to give you an update on my new color quantizer. - I renamed some functions/structs and I've added comments that describes the algorithm step by step. - I've added MEDIANCUT, MAXCOVERAGE and FASTOCTREE constants to Image.py, so you can call img.quantize(256, Image.FASTOCTREE). I used FASTOCTREE as the name because it is an optimized version and not a full implementation of the octree algorithm. But I'm open for other names. - I fixed a small bug and it now works with all numbers of colors, from 1 to 256. - I've added a little test. - I tested it on Mac OS X 10.5/10.6, Debian 5.0 and Ubuntu 9.10. A load test showed constant memory usage (so I assume that there is no leak). The code is available at http://bitbucket.org/olt/pil-117-octree There is a new fork that also contains my other path for different ZIP compress types: http://bitbucket.org/olt/pil-117-fastpng You can get a source package here: http://bitbucket.org/olt/pil-117-fastpng/downloads/PIL-1.1.7-fastpng-a1.tar.gz Regards, Oliver On 23.06.2010, at 19:15, Oliver Tonnhofer wrote: > Hi everyone, > > I tried to improve the performance of the existing PIL image > quantizer, but the best improvements I got were only 10%. While > investigating how the median cut algorithm works, I came across the > octree color quantization algorithm. I've implemented a variation of > this algorithm and the results are very impressive. > > It shows up-to-10x improvements. The algorithm shows good image > quality for rasterized vector images like maps; gradients do not > look as good as with the median cut algorithm. > For our use case[0], serving maps, we get an overall performance > boots of ~x3.5. > > Here are some times in ms, best of 5 runs. > > rgb adaptive octree octree+rle jpeg > baboon.jpg 122.42 403.77 34.76 20.71 16.35 > gradient.png 1.45 6.60 1.01 1.21 0.95 > lena.jpg 167.83 325.08 35.53 19.26 13.11 > map.png 194.42 305.59 89.83 37.78 34.59 > rainbow.png 11.84 229.73 3.83 3.74 3.13 > wiki-en.png 7.27 12.45 2.78 1.65 1.81 > > All times include a convert/quantize and save call. > - rgb is a plain save > - adaptive is `convert('P', palette=ADAPTIVE)` > - octree the new algorithm > - octree+rle the new algorithm with RLE encoding enabled with my > compress_type patch[1] > > The images are online [2], and there is also a .tar.gz with all > images to download. > > The new quantizer is available at bitbucket[3]. You can use the new > algorithm with `img.convert(256, 2)`. > > I'd love to see that in the next PIL release. I will add some more > comments and will clean up the code a bit more, then I'm up for a > code review. Comments are welcomed already, though. > > [0] http://osm.omniscale.de/ http://mapproxy.org > [1] http://bitbucket.org/olt/pil-117/changeset/8d4661695edd > [2] http://bogosoft.com/misc/pil-octree-tests/ > [3] http://bitbucket.org/olt/pil-117-octree > > > Regards, > Oliver > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From rowen at uw.edu Sat Jul 3 01:57:41 2010 From: rowen at uw.edu (Russell E. Owen) Date: Fri, 02 Jul 2010 16:57:41 -0700 Subject: [Image-SIG] Mac binaries to test References: <4C2BCF75.5000502@noaa.gov> Message-ID: In article <4C2BCF75.5000502 at noaa.gov>, Christopher Barker wrote: > Russell E. Owen wrote: > > I built two Mac binaries of PIL 1.1.7: one for Python 2.5, the other for > > Python 2.6. Both should be compatible with Mac OS X 10.3.9 and later. > > Russell, this is great -- thanks! > > It seems to work on os-x 10.5, PPC, python 2.6 > > > They are missing support for Little CMS > > I don't use CMS, though it would be nice to get that working. > > FWIW, macports seems to be able to build universal binaries that work > (though I only tested on 10.5). Maybe you can find a hint in the port file. > > -Chris I just got Little CMS working with help from Robin Mills. It turns out that version 1.19 builds perfectly with the standard technique (Robin also included suggestions for getting 2.0a to build, but it was easier for me to use 1.19). New binaries are available here: If they work for folks I would like to make these the official Mac binaries. Frederik: please feel free to take them and serve them (preferably remove the date from the name first). -- Russell From chander.ganesan at gmail.com Mon Jul 5 21:46:22 2010 From: chander.ganesan at gmail.com (Chander Ganesan) Date: Mon, 05 Jul 2010 15:46:22 -0400 Subject: [Image-SIG] PIL Convert Alpha-transparent image to non-transparent? Message-ID: <4C32368E.5050100@gmail.com> Hi Folks, I've done quite a bit of searching on Google for this and have yet to find a working result, so hopefully someone here will know... I've got an image that has alpha transparency, it has a non-white background color (that is transparent), and several pixels are "partially" transparent. If I take the image and convert it over from RGBA to RGB, the text in the image looks "blocky". I need to convert the image to a non-transparent one (so I can pass it into tesseract for OCR) but I cannot seem to do so without loosing quality of the text in the image. Is there a standard way to do this? I've tried the following (all to no avail): - Iterate over the pixels and find those that are more than 50% transparent and convert them to white (ends up with a dithered image) - Use Paste onto a white background that has no transparency, and then convert to RGB (no luck there) - Use Image.blend to attempt to blend with a white background (at various levels), no luck there. Any help - or pointers in the right direction - would be much appreciated! Thanks! chander From janssen at parc.com Tue Jul 6 01:35:12 2010 From: janssen at parc.com (Bill Janssen) Date: Mon, 5 Jul 2010 16:35:12 PDT Subject: [Image-SIG] PIL Convert Alpha-transparent image to non-transparent? In-Reply-To: <4C32368E.5050100@gmail.com> References: <4C32368E.5050100@gmail.com> Message-ID: <9555.1278372912@parc.com> Chander Ganesan wrote: > - Iterate over the pixels and find those that are more than 50% > transparent and convert them to white (ends up with a dithered image) > - Use Paste onto a white background that has no transparency, and then > convert to RGB (no luck there) > - Use Image.blend to attempt to blend with a white background (at > various levels), no luck there. You're close. You want to use Image.paste onto that white background, but using the same image you're pasting as the optional third mask argument for the paste: background.paste(rgba_image, (0, 0), rgba_image) "rgba_image" must be the same size as "background". Bill From chris.mit7 at gmail.com Thu Jul 1 05:56:02 2010 From: chris.mit7 at gmail.com (Chris Mitchell) Date: Wed, 30 Jun 2010 23:56:02 -0400 Subject: [Image-SIG] PIL: TIFF images loaded as 15 bit signed integers Message-ID: Hey everyone, I've run into a problem where using: im = Image.open(file) data = im.getdata() results in data having negative values for pixels exceeding 32768. im.mode gives I;16B. I'm thinking maybe the file is really little endian and perhaps this is why I'm getting negative values I'm not exactly sure how plausible that scenario is. Anyone ever have this situation occur before? -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin at rootsmith.ca Fri Jul 2 06:44:29 2010 From: kevin at rootsmith.ca (Kevin J. Smith) Date: Thu, 1 Jul 2010 21:44:29 -0700 Subject: [Image-SIG] Can't open image retrieved from S3 with PIL In-Reply-To: <3114965b-705b-4b51-9cce-54be34882110@y21g2000pro.googlegroups.com> References: <3114965b-705b-4b51-9cce-54be34882110@y21g2000pro.googlegroups.com> Message-ID: Hi, I know this may have to do with my use of S3 but I'm searching for any little thread that I can hang onto to solve this problem. If I retrieve an image from boto (S3) and then try and open it with PIL I get an IOError: cannot identify image file. Here is the code: s3 = S3Connection('blah','blah') bucket = s3.get_bucket('my_bucket') key = bucket.get_key(key_name) file = StringIO() key.get_file(file) Image.open(file) # .. here I wish to crop the image before spitting it back to the calling environment I know that the file I retrieve with the "key.get_file(file)" statement is in good shape because if I take out the PIL code and turn around and set the Content-Type header to image/jpeg and fire the file object back at the browser (this code is in a web app controller) the image appears just fine! By briefly looking at the code in PIL it seems it is inspecting the first 16 bytes of the file and determining if it can recognize it but I don't understand why it isn't recognizing it. Any suggestions? Cheers -------------- next part -------------- An HTML attachment was scrubbed... URL: From chander.ganesan at gmail.com Mon Jul 5 17:54:09 2010 From: chander.ganesan at gmail.com (Chander Ganesan) Date: Mon, 05 Jul 2010 11:54:09 -0400 Subject: [Image-SIG] PIL Convert Alpha-transparent image to non-transparent? Message-ID: <4C320021.2090602@gmail.com> Hi Folks, I've done quite a bit of searching on Google for this and have yet to find a working result, so hopefully someone here will know... I've got an image that has alpha transparency, it has a non-white background color (that is transparent), and several pixels are "partially" transparent. If I take the image and convert it over from RGBA to RGB, the text in the image looks "blocky". I need to convert the image to a non-transparent one (so I can pass it into tesseract for OCR) but I cannot seem to do so without loosing quality of the text in the image. Is there a standard way to do this? I've tried the following (all to no avail): - Iterate over the pixels and find those that are more than 50% transparent and convert them to white (ends up with a dithered image) - Use Paste onto a white background that has no transparency, and then convert to RGB (no luck there) - Use Image.blend to attempt to blend with a white background (at various levels), no luck there. Any help - or pointers in the right direction - would be much appreciated! Thanks! chander From donn.ingle at gmail.com Tue Jul 6 06:25:34 2010 From: donn.ingle at gmail.com (donn) Date: Tue, 06 Jul 2010 06:25:34 +0200 Subject: [Image-SIG] PIL Convert Alpha-transparent image to non-transparent? In-Reply-To: <4C320021.2090602@gmail.com> References: <4C320021.2090602@gmail.com> Message-ID: <4C32B03E.2050602@gmail.com> I'm no PIL expert, but some thoughts: > - Iterate over the pixels and find those that are more than 50% > transparent and convert them to white (ends up with a dithered image) Why not choose a range of gray values white to black, say in steps of 10%? > - Use Paste onto a white background that has no transparency, and then > convert to RGB (no luck there) That's a good plan. Did you display (img.show() )the image to see the effect of the paste? Perhaps there is some mistake in the operation. > - Use Image.blend to attempt to blend with a white background (at > various levels), no luck there. Ah, ok, good plan again. Still, check that image out visually. I don't know tesseract, but perhaps closer reading of the docs will reveal something you are missing in re the RGB format. Another idea would be to try using Gimp automation, employing Gimp as your muscle. \d From olt at bogosoft.com Tue Jul 6 07:46:51 2010 From: olt at bogosoft.com (Oliver Tonnhofer) Date: Tue, 6 Jul 2010 07:46:51 +0200 Subject: [Image-SIG] Can't open image retrieved from S3 with PIL In-Reply-To: References: <3114965b-705b-4b51-9cce-54be34882110@y21g2000pro.googlegroups.com> Message-ID: On 02.07.2010, at 06:44, Kevin J. Smith wrote: > Here is the code: > > s3 = S3Connection('blah','blah') > bucket = s3.get_bucket('my_bucket') > key = bucket.get_key(key_name) > file = StringIO() > key.get_file(file) > Image.open(file) > # .. here I wish to crop the image before spitting it back to the calling environment Do you get any error? You could try to `file.seek(0)` before opening it with PIL. Regards, Oliver From yury at shurup.com Tue Jul 6 10:12:38 2010 From: yury at shurup.com (Yury V. Zaytsev) Date: Tue, 06 Jul 2010 10:12:38 +0200 Subject: [Image-SIG] PIL Convert Alpha-transparent image to non-transparent? In-Reply-To: <4C32368E.5050100@gmail.com> References: <4C32368E.5050100@gmail.com> Message-ID: <1278403958.7056.14.camel@mypride> On Mon, 2010-07-05 at 15:46 -0400, Chander Ganesan wrote: > I need to convert the image to a non-transparent one (so I can pass it > into tesseract for OCR) but I cannot seem to do so without loosing > quality of the text in the image. Is there a standard way to do this? > I've tried the following (all to no avail): Not really related to PIL, but you might wish to use Cuneiform, whose ImageMagick front-end can load any type of images, supported by ImageMagick. -- Sincerely yours, Yury V. Zaytsev From nils.de.reus at ivm.vu.nl Tue Jul 6 10:52:00 2010 From: nils.de.reus at ivm.vu.nl (Nils de Reus) Date: Tue, 6 Jul 2010 10:52:00 +0200 Subject: [Image-SIG] PIL Convert Alpha-transparent image to non-transparent? In-Reply-To: <4C320021.2090602@gmail.com> References: <4C320021.2090602@gmail.com> Message-ID: <57AE160B221E6F4EA096548C7DEE199B6F4F0E28@ivm-mail> Dear Chander, I am intrigued, because at least some of the methods you tried should have worked. Could you make one of these images available for testing? I would be interested to have a look at what is happening. Best regards, Nils ________________________________________ Subject: [Image-SIG] PIL Convert Alpha-transparent image to non-transparent? I've got an image that has alpha transparency, it has a non-white background color (that is transparent), and several pixels are "partially" transparent. If I take the image and convert it over from RGBA to RGB, the text in the image looks "blocky". I've tried the following (all to no avail): - Iterate over the pixels and find those that are more than 50% transparent and convert them to white - Use Paste onto a white background that has no transparency, and then convert to RGB - Use Image.blend to attempt to blend with a white background (at various levels) From kevin at rootsmith.ca Tue Jul 6 08:07:59 2010 From: kevin at rootsmith.ca (Kevin J. Smith) Date: Mon, 5 Jul 2010 23:07:59 -0700 Subject: [Image-SIG] Can't open image retrieved from S3 with PIL In-Reply-To: References: <3114965b-705b-4b51-9cce-54be34882110@y21g2000pro.googlegroups.com> Message-ID: Thanks, Oliver. That was the trick. On 5 July 2010 22:46, Oliver Tonnhofer wrote: > > On 02.07.2010, at 06:44, Kevin J. Smith wrote: > > Here is the code: > > > > s3 = S3Connection('blah','blah') > > bucket = s3.get_bucket('my_bucket') > > key = bucket.get_key(key_name) > > file = StringIO() > > key.get_file(file) > > Image.open(file) > > # .. here I wish to crop the image before spitting it back to the calling > environment > > Do you get any error? You could try to `file.seek(0)` before opening it > with PIL. > > Regards, > Oliver > > -- Never take life seriously. Nobody gets out alive anyway. -------------- next part -------------- An HTML attachment was scrubbed... URL: From memilanuk at gmail.com Tue Jul 6 15:02:02 2010 From: memilanuk at gmail.com (Monte Milanuk) Date: Tue, 6 Jul 2010 13:02:02 +0000 (UTC) Subject: [Image-SIG] Mac binaries to test -- the link References: Message-ID: Russell E. Owen uw.edu> writes: > > Here's the link: > > Just some feedback for you... the binaries installed flawlessly on my Macbook (circa early 2007, upgraded to 10.6.3 here recently). Being able to install PIL along with freetype (via mac ports) allowed me to install reportlab, which I needed for dabo... so I haven't 'used' the PIL binaries yet but everything else that required PIL installed without complaint. HTH, Monte From chris.mit7 at gmail.com Tue Jul 6 18:25:49 2010 From: chris.mit7 at gmail.com (Chris Mitchell) Date: Tue, 6 Jul 2010 12:25:49 -0400 Subject: [Image-SIG] PIL: TIFF images loaded as 16 bit signed integers Message-ID: I'm running into a problem where my image intensities are being loaded as 16 bit signed integers. The code I'm using to open the tiff file is: im = Image.open(file) self.pixels = np.array([im.getdata()], np.uint16) the filetype is a 16bit TIFF, whose intensities load fine into ImageJ. I load their intensities into a numpy 16bit array, and for the time being I've fixed this problem with this code: np.where(self.pixels<0, -1*self.pixels+(32768+self.pixels),self.pixels) That basically takes any negative values and compensates for the rollover. Does anyone have any idea why PIL is loading my TIFF files as signed integers? From barthelemy at crans.org Wed Jul 7 17:25:06 2010 From: barthelemy at crans.org (=?ISO-8859-1?Q?S=E9bastien_Barth=E9lemy?=) Date: Wed, 7 Jul 2010 17:25:06 +0200 Subject: [Image-SIG] error on the first copy(), but not the second Message-ID: Hello, I got a picture refused as erroneous on photobox (an online printing service). As I can open the picture without a problem using preview on my mac, I decided to further investigate the problem with PIL and ImageMagick. ImageMagick successfully displays the picture but prints the following error message, indicating my picture is indeed corrupted: $ display IMG_1818.JPG display: Unsupported marker type 0x19 `IMG_1818.JPG' @ error/jpeg.c/EmitMessage/235. PIL fails to read the picture the first time, but succeed the second one! The picture can then be displayed with show(). $ python Python 2.6.5 (r265:79063, Jul 6 2010, 17:00:38) [GCC 4.2.1 (Apple Inc. build 5659)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import Image >>> im = Image.open('IMG_1818.JPG') >>> im.copy() Traceback (most recent call last): File "", line 1, in File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/Image.py", line 743, in copy self.load() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/ImageFile.py", line 215, in load raise_ioerror(e) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/ImageFile.py", line 52, in raise_ioerror raise IOError(message + " when reading image file") IOError: broken data stream when reading image file >>> im.copy() I thought you might be interested to know about it. Does anyone have an explanation? I use Mac Os 10.6, with PIL 1.1.7 provided by macports. $ otool -L ./Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so ./Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so: /opt/local/lib/libjpeg.8.dylib (compatibility version 9.0.0, current version 9.1.0) /opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1) Regards. From thinkingfish at gmail.com Fri Jul 9 09:16:28 2010 From: thinkingfish at gmail.com (Yao Yue) Date: Fri, 9 Jul 2010 00:16:28 -0700 Subject: [Image-SIG] bug in Image.open() when trying to open an invalid file Message-ID: Naturally an error is raised. However the module does not release the file object, and therefore the file is locked until caller exits. --Yao From olt at bogosoft.com Fri Jul 9 16:00:13 2010 From: olt at bogosoft.com (Oliver Tonnhofer) Date: Fri, 9 Jul 2010 16:00:13 +0200 Subject: [Image-SIG] bug in Image.open() when trying to open an invalid file In-Reply-To: References: Message-ID: <326BF03E-A245-4EE4-BB13-2ED115D6163D@bogosoft.com> On 09.07.2010, at 09:16, Yao Yue wrote: > Naturally an error is raised. However the module does not release the > file object, and therefore the file is locked until caller exits. This might be helpful for you: http://www.mail-archive.com/image-sig at python.org/msg02822.html From jlu at hep.anl.gov Mon Jul 12 01:16:02 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Sun, 11 Jul 2010 18:16:02 -0500 (CDT) Subject: [Image-SIG] that's enough Message-ID: Hi- The following worked very well: >>> import Image >>> d = Image.open("a_1.jpg") >>> d.show() >>> Now, how do I turn it off before showing another image I'm on an Intel Mac, OS X Snow Leopard. Regards, Jack U. "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley From ankit at callfire.com Sat Jul 10 00:27:28 2010 From: ankit at callfire.com (Ankit Jhalaria) Date: Fri, 9 Jul 2010 15:27:28 -0700 Subject: [Image-SIG] PIL Query Message-ID: Hi I was using the PIL. I found it pretty useful. I was wondering if you could please let me know, whether I could change the image size. What I mean is if suppose I have 100 points having the same latitude and longitude, the point on the map appears (for instance as a red circle). My question to you is, can I change the radius of this circle? I was also trying to figure out where in the code I can change the location where the url is served from. So instead of serving the images form http://localhost/classic/4/4,5.png how do I change it to http://localhost/username/classic/4/4,5.png where username is taken from the database. & my last question is, is it possible that I just give the PIL the latitude,longitude and the no. of points having the same latitude and longitude[i.e. intensity], instead of repeating the lat & long coordinates. Your help will be greatly appreciated Thanks Ankit -------------- next part -------------- An HTML attachment was scrubbed... URL: From jlu at hep.anl.gov Tue Jul 13 19:00:34 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Tue, 13 Jul 2010 12:00:34 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: References: Message-ID: Thanks. Do you have a recommendation for which veersion of wxpython I should download for Mac OS X Snow Leopard (10.6)? Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Mon, 12 Jul 2010, Alec Bennett wrote: > My understanding is that show() is mainly for debugging and tests, and that > it doesn't offer very much control or efficiency. That's not to say that > what you're after can't be done, maybe someone else can help you with that, > I just don't know. > > Personally I'd suggest using WXPython, which can do what you're after fairly > easily. > > Here's one very simple way to display an image in WX: > > import wx > > class PictureWindow(wx.Frame): > ..def __init__(self, parent, id): > > ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), pos > = (50, 50), style = wx.DEFAULT_FRAME_STYLE) > ....panel = wx.Panel(self, -1) > ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap() > ....self.mainPic = wx.StaticBitmap(panel, -1, bmp) > ....self.Show() > > app = wx.App(redirect=0) > PictureWindow(None, -1) > app.MainLoop() > > > > > > On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky wrote: > >> Hi- >> The following worked very well: >> >>> import Image >>>>> d = Image.open("a_1.jpg") >>>>> d.show() >>>>> >>>>> >> Now, how do I turn >> it off before showing another image >> I'm on an Intel Mac, OS X Snow Leopard. >> Regards, >> Jack U. >> "Trust me. I have a lot of experience at this." >> General Custer's unremembered message to his men, >> just before leading them into the Little Big Horn Valley >> >> >> >> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > From Chris.Barker at noaa.gov Tue Jul 13 20:35:47 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Tue, 13 Jul 2010 11:35:47 -0700 Subject: [Image-SIG] that's enough In-Reply-To: References: Message-ID: <4C3CB203.1080304@noaa.gov> Jack Uretsky wrote: > Thanks. Do you have a recommendation for which veersion of wxpython I > should download for Mac OS X Snow Leopard (10.6)? > Regards, > Jack Use the OS-X installer for the latest version found at the wxpython site. I *think* it will work with either the Apple-supplied python or the python.org one, but it's possible that that is broken on 10.6 -- I heard a lot of issues on 10.6 (I'm running 10.5, so no no details). I'd install python 2.6 from python.org, and use the wxpython installer for that. That combination is the safest. This might be useful, too: http://wiki.wxpython.org/RecipesImagesAndGraphics Note that wxPython has some basic image stuff built in, so depending on what you need to do, you may not even need PIL. (but you may -- PIL is far more full featured) Oh, and I've enclosed a slightly more complex example. -Chris > "Trust me. I have a lot of experience at this." > General Custer's unremembered message to his men, > just before leading them into the Little Big Horn Valley > > > > > On Mon, 12 Jul 2010, Alec Bennett wrote: > >> My understanding is that show() is mainly for debugging and tests, and >> that >> it doesn't offer very much control or efficiency. That's not to say that >> what you're after can't be done, maybe someone else can help you with >> that, >> I just don't know. >> >> Personally I'd suggest using WXPython, which can do what you're after >> fairly >> easily. >> >> Here's one very simple way to display an image in WX: >> >> import wx >> >> class PictureWindow(wx.Frame): >> ..def __init__(self, parent, id): >> >> ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, >> 200), pos >> = (50, 50), style = wx.DEFAULT_FRAME_STYLE) >> ....panel = wx.Panel(self, -1) >> ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap() >> ....self.mainPic = wx.StaticBitmap(panel, -1, bmp) >> ....self.Show() >> >> app = wx.App(redirect=0) >> PictureWindow(None, -1) >> app.MainLoop() >> >> >> >> >> >> On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky wrote: >> >>> Hi- >>> The following worked very well: >>> >>>> import Image >>>>>> d = Image.open("a_1.jpg") >>>>>> d.show() >>>>>> >>>>>> >>> Now, how do I turn >>> it off before showing another image >>> I'm on an Intel Mac, OS X Snow Leopard. >>> Regards, >>> Jack U. >>> "Trust me. I have a lot of experience at this." >>> General Custer's unremembered message to his men, >>> just before leading them into the Little Big Horn Valley >>> >>> >>> >>> _______________________________________________ >>> Image-SIG maillist - Image-SIG at python.org >>> http://mail.python.org/mailman/listinfo/image-sig >>> >> > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov -------------- next part -------------- A non-text attachment was scrubbed... Name: StaticBitmap.py Type: application/x-python Size: 2739 bytes Desc: not available URL: From steve at stevemcfarlin.com Wed Jul 14 06:55:24 2010 From: steve at stevemcfarlin.com (Steve McFarlin) Date: Tue, 13 Jul 2010 21:55:24 -0700 Subject: [Image-SIG] Image Identification Error Message-ID: Hello, I can not seem to figure out why I am getting the cannot identify image file error. The image in question is a PNG. This PNG file can be loaded by PIL on another system. The PIL tests passed when installing. Are there any debug options that will print out why it can not identify the image? Is there something I should try reinstalling? -------------------------------------------------------------------- PIL 1.1.7 SETUP SUMMARY -------------------------------------------------------------------- version 1.1.7 platform linux2 2.6.5 (r265:79063, Jul 13 2010, 18:43:16) [GCC 4.3.2] -------------------------------------------------------------------- *** TKINTER support not available --- JPEG support available --- ZLIB (PNG/ZIP) support available --- FREETYPE2 support available *** LITTLECMS support not available -------------------------------------------------------------------- -------------------------------------------------------------------- PIL 1.1.7 TEST SUMMARY -------------------------------------------------------------------- Python modules loaded from ./PIL Binary modules loaded from ./PIL -------------------------------------------------------------------- --- PIL CORE support ok *** TKINTER support not installed --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok *** LITTLECMS support not installed -------------------------------------------------------------------- Running selftest: --- 57 tests passed. Thanks, Steve From yury at shurup.com Wed Jul 14 10:44:56 2010 From: yury at shurup.com (Yury V. Zaytsev) Date: Wed, 14 Jul 2010 10:44:56 +0200 Subject: [Image-SIG] that's enough In-Reply-To: References: Message-ID: <1279097096.9049.3.camel@mypride> ... or you can go for matplotlib and use its plot function to display PIL images using the NumPy array interface (see my previous postings on this list): import Image import numpy as np import pylab as pyl if __name__ == "__main__": img_name = 'ch43_roi.tiff' img = Image.open(img_name) a = np.asarray(img) p = a.copy().transpose((1, 0, 2)) pyl.imshow(p) pyl.show() -- Sincerely yours, Yury V. Zaytsev On Sun, 2010-07-11 at 18:16 -0500, Jack Uretsky wrote: > Hi- > The following worked very well: > >>> import Image > >>> d = Image.open("a_1.jpg") > >>> d.show() > >>> > > Now, how do I turn > it off before showing another image > I'm on an Intel Mac, OS X Snow Leopard. > Regards, > Jack U. > "Trust me. I have a lot of experience at this." > General Custer's unremembered message to his men, > just before leading them into the Little Big Horn Valley > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From olt at bogosoft.com Wed Jul 14 13:19:20 2010 From: olt at bogosoft.com (Oliver Tonnhofer) Date: Wed, 14 Jul 2010 13:19:20 +0200 Subject: [Image-SIG] PNG8 with full transparency (Was: New fast quantizer for PIL) In-Reply-To: References: <943F455E-83DB-4A23-AD1E-556C290C4D17@bogosoft.com> Message-ID: Hi all, I improved the new color quantizer a bit more and it now supports quantizing of RGBA images. I modified the PNGImagePlugin to store the full transparency information of paletted images. It works really great and there is no performance loss compared to RGB quantization. I've updated the test images at http://bogosoft.com/misc/pil-octree-tests/ Again, the code is available at http://bitbucket.org/olt/pil-117-octree There is a fork that also contains my other patch for different ZIP compress types: http://bitbucket.org/olt/pil-117-fastpng You can get a source package here: http://bitbucket.org/olt/pil-117-fastpng/downloads/PIL-1.1.7-fastpng-a2.tar.gz The usage: >>> img = Image.open('transparent.png') >>> img = img.quantize(256, Image.FASTOCTREE) >>> img.save('transparent8.png', transparency='full') Regards, Oliver On 02.07.2010, at 14:54, Oliver Tonnhofer wrote: > Hi all, > > I want to give you an update on my new color quantizer. > > - I renamed some functions/structs and I've added comments that describes the algorithm step by step. > > - I've added MEDIANCUT, MAXCOVERAGE and FASTOCTREE constants to Image.py, so you can call img.quantize(256, Image.FASTOCTREE). I used FASTOCTREE as the name because it is an optimized version and not a full implementation of the octree algorithm. But I'm open for other names. > > - I fixed a small bug and it now works with all numbers of colors, from 1 to 256. > > - I've added a little test. > > - I tested it on Mac OS X 10.5/10.6, Debian 5.0 and Ubuntu 9.10. A load test showed constant memory usage (so I assume that there is no leak). > > The code is available at http://bitbucket.org/olt/pil-117-octree > There is a new fork that also contains my other path for different ZIP compress types: http://bitbucket.org/olt/pil-117-fastpng > You can get a source package here: http://bitbucket.org/olt/pil-117-fastpng/downloads/PIL-1.1.7-fastpng-a1.tar.gz > > Regards, > Oliver > > > On 23.06.2010, at 19:15, Oliver Tonnhofer wrote: > >> Hi everyone, >> >> I tried to improve the performance of the existing PIL image quantizer, but the best improvements I got were only 10%. While investigating how the median cut algorithm works, I came across the octree color quantization algorithm. I've implemented a variation of this algorithm and the results are very impressive. >> >> It shows up-to-10x improvements. The algorithm shows good image quality for rasterized vector images like maps; gradients do not look as good as with the median cut algorithm. >> For our use case[0], serving maps, we get an overall performance boots of ~x3.5. >> >> Here are some times in ms, best of 5 runs. >> >> rgb adaptive octree octree+rle jpeg >> baboon.jpg 122.42 403.77 34.76 20.71 16.35 >> gradient.png 1.45 6.60 1.01 1.21 0.95 >> lena.jpg 167.83 325.08 35.53 19.26 13.11 >> map.png 194.42 305.59 89.83 37.78 34.59 >> rainbow.png 11.84 229.73 3.83 3.74 3.13 >> wiki-en.png 7.27 12.45 2.78 1.65 1.81 >> >> All times include a convert/quantize and save call. >> - rgb is a plain save >> - adaptive is `convert('P', palette=ADAPTIVE)` >> - octree the new algorithm >> - octree+rle the new algorithm with RLE encoding enabled with my compress_type patch[1] >> >> The images are online [2], and there is also a .tar.gz with all images to download. >> >> The new quantizer is available at bitbucket[3]. You can use the new algorithm with `img.convert(256, 2)`. >> >> I'd love to see that in the next PIL release. I will add some more comments and will clean up the code a bit more, then I'm up for a code review. Comments are welcomed already, though. >> >> [0] http://osm.omniscale.de/ http://mapproxy.org >> [1] http://bitbucket.org/olt/pil-117/changeset/8d4661695edd >> [2] http://bogosoft.com/misc/pil-octree-tests/ >> [3] http://bitbucket.org/olt/pil-117-octree >> >> >> Regards, >> Oliver >> >> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From wrybread at gmail.com Tue Jul 13 03:22:26 2010 From: wrybread at gmail.com (Alec Bennett) Date: Mon, 12 Jul 2010 18:22:26 -0700 Subject: [Image-SIG] that's enough In-Reply-To: References: Message-ID: My understanding is that show() is mainly for debugging and tests, and that it doesn't offer very much control or efficiency. That's not to say that what you're after can't be done, maybe someone else can help you with that, I just don't know. Personally I'd suggest using WXPython, which can do what you're after fairly easily. Here's one very simple way to display an image in WX: import wx class PictureWindow(wx.Frame): ..def __init__(self, parent, id): ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), pos = (50, 50), style = wx.DEFAULT_FRAME_STYLE) ....panel = wx.Panel(self, -1) ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap() ....self.mainPic = wx.StaticBitmap(panel, -1, bmp) ....self.Show() app = wx.App(redirect=0) PictureWindow(None, -1) app.MainLoop() On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky wrote: > Hi- > The following worked very well: > >> import Image >>>> d = Image.open("a_1.jpg") >>>> d.show() >>>> >>>> > Now, how do I turn > it off before showing another image > I'm on an Intel Mac, OS X Snow Leopard. > Regards, > Jack U. > "Trust me. I have a lot of experience at this." > General Custer's unremembered message to his men, > just before leading them into the Little Big Horn Valley > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From smcfarlin at ocsnet.net Wed Jul 14 03:33:38 2010 From: smcfarlin at ocsnet.net (Steve McFarlin) Date: Tue, 13 Jul 2010 18:33:38 -0700 Subject: [Image-SIG] IOError("cannot identify image file") Message-ID: Hello, I can not seem to figure out why I am getting the cannot identify image file error. The image in question is a PNG. This PNG file can be loaded by PIL on another system. The PIL tests passed when installing. Is there something I there a common place to look too for why the image could not be identified. -------------------------------------------------------------------- PIL 1.1.7 SETUP SUMMARY -------------------------------------------------------------------- version 1.1.7 platform linux2 2.6.5 (r265:79063, Jul 13 2010, 18:43:16) [GCC 4.3.2] -------------------------------------------------------------------- *** TKINTER support not available --- JPEG support available --- ZLIB (PNG/ZIP) support available --- FREETYPE2 support available *** LITTLECMS support not available -------------------------------------------------------------------- -------------------------------------------------------------------- PIL 1.1.7 TEST SUMMARY -------------------------------------------------------------------- Python modules loaded from ./PIL Binary modules loaded from ./PIL -------------------------------------------------------------------- --- PIL CORE support ok *** TKINTER support not installed --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok *** LITTLECMS support not installed -------------------------------------------------------------------- Running selftest: --- 57 tests passed. Thanks, Steve From wrybread at gmail.com Wed Jul 14 08:59:07 2010 From: wrybread at gmail.com (Alec Bennett) Date: Tue, 13 Jul 2010 23:59:07 -0700 Subject: [Image-SIG] that's enough In-Reply-To: <4C3CB203.1080304@noaa.gov> References: <4C3CB203.1080304@noaa.gov> Message-ID: Not to beat a dead horse, but yet another option is to use os.startfile(fname), which will launch it in your computer's default image viewer. Maybe find a program that will limit itself to a single instance, and then you won't wind up with 20 windows open if you're showing a lot of images. But still, wxpython is a really powerful and useful tool once you get past the early part of its learning curve. On Tue, Jul 13, 2010 at 11:35 AM, Christopher Barker wrote: > Jack Uretsky wrote: > >> Thanks. Do you have a recommendation for which veersion of wxpython I >> should download for Mac OS X Snow Leopard (10.6)? >> Regards, >> Jack >> > > Use the OS-X installer for the latest version found at the wxpython site. > > I *think* it will work with either the Apple-supplied python or the > python.org one, but it's possible that that is broken on 10.6 -- I heard a > lot of issues on 10.6 (I'm running 10.5, so no no details). > > I'd install python 2.6 from python.org, and use the wxpython installer for > that. That combination is the safest. > > This might be useful, too: > > http://wiki.wxpython.org/RecipesImagesAndGraphics > > Note that wxPython has some basic image stuff built in, so depending on > what you need to do, you may not even need PIL. (but you may -- PIL is far > more full featured) > > Oh, and I've enclosed a slightly more complex example. > > -Chris > > > > > > > "Trust me. I have a lot of experience at this." >> General Custer's unremembered message to his men, >> just before leading them into the Little Big Horn Valley >> >> >> >> >> On Mon, 12 Jul 2010, Alec Bennett wrote: >> >> My understanding is that show() is mainly for debugging and tests, and >>> that >>> it doesn't offer very much control or efficiency. That's not to say that >>> what you're after can't be done, maybe someone else can help you with >>> that, >>> I just don't know. >>> >>> Personally I'd suggest using WXPython, which can do what you're after >>> fairly >>> easily. >>> >>> Here's one very simple way to display an image in WX: >>> >>> import wx >>> >>> class PictureWindow(wx.Frame): >>> ..def __init__(self, parent, id): >>> >>> ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), >>> pos >>> = (50, 50), style = wx.DEFAULT_FRAME_STYLE) >>> ....panel = wx.Panel(self, -1) >>> ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap() >>> ....self.mainPic = wx.StaticBitmap(panel, -1, bmp) >>> ....self.Show() >>> >>> app = wx.App(redirect=0) >>> PictureWindow(None, -1) >>> app.MainLoop() >>> >>> >>> >>> >>> >>> On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky wrote: >>> >>> Hi- >>>> The following worked very well: >>>> >>>> import Image >>>>> >>>>>> d = Image.open("a_1.jpg") >>>>>>> d.show() >>>>>>> >>>>>>> >>>>>>> Now, how do I turn >>>> it off before showing another image >>>> I'm on an Intel Mac, OS X Snow Leopard. >>>> Regards, >>>> Jack U. >>>> "Trust me. I have a lot of experience at this." >>>> General Custer's unremembered message to his men, >>>> just before leading them into the Little Big Horn Valley >>>> >>>> >>>> >>>> _______________________________________________ >>>> Image-SIG maillist - Image-SIG at python.org >>>> http://mail.python.org/mailman/listinfo/image-sig >>>> >>>> >>> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker at noaa.gov > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spe.stani.be at gmail.com Thu Jul 15 12:18:47 2010 From: spe.stani.be at gmail.com (Stani) Date: Thu, 15 Jul 2010 12:18:47 +0200 Subject: [Image-SIG] that's enough In-Reply-To: References: <4C3CB203.1080304@noaa.gov> Message-ID: os.startfile is only available on Windows, so it won't work on Mac OS X or Linux: http://docs.python.org/library/os.html#os.startfile On Wed, Jul 14, 2010 at 8:59 AM, Alec Bennett wrote: > Not to beat a dead horse, but yet another option is to use > os.startfile(fname), which will launch it in your computer's default image > viewer. Maybe find a program that will limit itself to a single instance, > and then you won't wind up with 20 windows open if you're showing a lot of > images. > > But still, wxpython is a really powerful and useful tool once you get past > the early part of its learning curve. > > > > > On Tue, Jul 13, 2010 at 11:35 AM, Christopher Barker > wrote: >> >> Jack Uretsky wrote: >>> >>> Thanks. ?Do you have a recommendation for which veersion of wxpython I >>> should download for Mac OS X Snow Leopard (10.6)? >>> ? ? ? ? ? ?Regards, >>> ? ? ? ? ? ? ? ?Jack >> >> Use the OS-X installer for the latest version found at the wxpython site. >> >> I *think* it will work with either the Apple-supplied python or the >> python.org one, but it's possible that that is broken on 10.6 -- I heard a >> lot of issues on 10.6 (I'm running 10.5, so no no details). >> >> I'd install python 2.6 from python.org, and use the wxpython installer for >> that. That combination is the safest. >> >> This might be useful, too: >> >> http://wiki.wxpython.org/RecipesImagesAndGraphics >> >> Note that wxPython has some basic image stuff built in, so depending on >> what you need to do, you may not even need PIL. (but you may -- PIL is far >> more full featured) >> >> Oh, and I've enclosed a slightly more complex example. >> >> -Chris >> >> >> >> >> >>> "Trust me. ?I have a lot of experience at this." >>> ? ? ? ?General Custer's unremembered message to his men, >>> ? ? ? ?just before leading them into the Little Big Horn Valley >>> >>> >>> >>> >>> On Mon, 12 Jul 2010, Alec Bennett wrote: >>> >>>> My understanding is that show() is mainly for debugging and tests, and >>>> that >>>> it doesn't offer very much control or efficiency. That's not to say that >>>> what you're after can't be done, maybe someone else can help you with >>>> that, >>>> I just don't know. >>>> >>>> Personally I'd suggest using WXPython, which can do what you're after >>>> fairly >>>> easily. >>>> >>>> Here's one very simple way to display an image in WX: >>>> >>>> import wx >>>> >>>> class PictureWindow(wx.Frame): >>>> ..def __init__(self, parent, id): >>>> >>>> ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), >>>> pos >>>> = (50, 50), style = wx.DEFAULT_FRAME_STYLE) >>>> ....panel = wx.Panel(self, -1) >>>> ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap() >>>> ....self.mainPic = wx.StaticBitmap(panel, -1, bmp) >>>> ....self.Show() >>>> >>>> app = wx.App(redirect=0) >>>> PictureWindow(None, -1) >>>> app.MainLoop() >>>> >>>> >>>> >>>> >>>> >>>> On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky wrote: >>>> >>>>> Hi- >>>>> ? ? ? The following worked very well: >>>>> >>>>>> ?import Image >>>>>>>> >>>>>>>> d = Image.open("a_1.jpg") >>>>>>>> d.show() >>>>>>>> >>>>>>>> >>>>> ? ? ? Now, how do I turn >>>>> ?it off before showing another image >>>>> ? ? ? I'm on an Intel Mac, OS X Snow Leopard. >>>>> ? ? ? ? ? ? ? ? ? ? ? Regards, >>>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Jack U. >>>>> "Trust me. ?I have a lot of experience at this." >>>>> ? ? ? ? ? ? ? General Custer's unremembered message to his men, >>>>> ? ? ? ? ? ? ? just before leading them into the Little Big Horn Valley >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Image-SIG maillist ?- ?Image-SIG at python.org >>>>> http://mail.python.org/mailman/listinfo/image-sig >>>>> >>>> >>> _______________________________________________ >>> Image-SIG maillist ?- ?Image-SIG at python.org >>> http://mail.python.org/mailman/listinfo/image-sig >> >> >> -- >> Christopher Barker, Ph.D. >> Oceanographer >> >> Emergency Response Division >> NOAA/NOS/OR&R ? ? ? ? ? ?(206) 526-6959 ? voice >> 7600 Sand Point Way NE ? (206) 526-6329 ? fax >> Seattle, WA ?98115 ? ? ? (206) 526-6317 ? main reception >> >> Chris.Barker at noaa.gov >> >> _______________________________________________ >> Image-SIG maillist ?- ?Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > -- Phatch Photo Batch Processor - http://photobatch.stani.be SPE Python IDE - http://pythonide.stani.be From fredrik at pythonware.com Sun Jul 18 21:41:01 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 18 Jul 2010 21:41:01 +0200 Subject: [Image-SIG] PIL Query In-Reply-To: References: Message-ID: PIL is a image manipulation/graphics library for Python, and it doesn't provide any standard functions for e.g. plotting data on maps or serving them from a web server. From your description, it sounds like you're using some application that uses PIL, so you might want to contact the authors of that application instead. 2010/7/10 Ankit Jhalaria : > Hi > I was using the PIL. I found it pretty useful. > I was wondering if you could please let me know, whether I could change the > image size. What I mean is if suppose I have 100 points having the same > latitude and longitude, the point on the map appears (for instance as a red > circle). My question to you is, can I change the radius of this circle? > I was also trying to figure out where in the code I can change the location > where the url is served from. > So instead of serving the images form http://localhost/classic/4/4,5.png > how do I change it to > http://localhost/username/classic/4/4,5.png > where username is taken from the database. > & my last question is, is it possible that I just give the PIL the > latitude,longitude and the no. of points having the same latitude and > longitude[i.e. intensity], instead of repeating the lat & long coordinates. > Your help will be greatly appreciated > Thanks > Ankit > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From jlu at hep.anl.gov Mon Jul 19 03:12:34 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Sun, 18 Jul 2010 20:12:34 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: <1279097096.9049.3.camel@mypride> References: <1279097096.9049.3.camel@mypride> Message-ID: Hi all- I'n trying to find a binary veersion of matplotlib that I can install on my OS X Snow Leopard. I keep ending up at SourceForg, which has no downlo0ad that I can see that is intended to be a Mac package. I tried downloading and installing the matplotlib-1.0.0 file, but could not seem to be able to import from it, so it obviously was not properly installed. Help would be greatly appreciated. Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Wed, 14 Jul 2010, Yury V. Zaytsev wrote: > ... or you can go for matplotlib and use its plot function to display > PIL images using the NumPy array interface (see my previous postings on > this list): > > import Image > import numpy as np > import pylab as pyl > > if __name__ == "__main__": > > img_name = 'ch43_roi.tiff' > img = Image.open(img_name) > > a = np.asarray(img) > p = a.copy().transpose((1, 0, 2)) > > pyl.imshow(p) > pyl.show() > > -- > Sincerely yours, > Yury V. Zaytsev > > On Sun, 2010-07-11 at 18:16 -0500, Jack Uretsky wrote: >> Hi- >> The following worked very well: >>>>> import Image >>>>> d = Image.open("a_1.jpg") >>>>> d.show() >>>>> >> >> Now, how do I turn >> it off before showing another image >> I'm on an Intel Mac, OS X Snow Leopard. >> Regards, >> Jack U. >> "Trust me. I have a lot of experience at this." >> General Custer's unremembered message to his men, >> just before leading them into the Little Big Horn Valley >> >> >> >> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig > From bblais at bryant.edu Mon Jul 19 03:39:13 2010 From: bblais at bryant.edu (Brian Blais) Date: Sun, 18 Jul 2010 21:39:13 -0400 Subject: [Image-SIG] that's enough In-Reply-To: References: <1279097096.9049.3.camel@mypride> Message-ID: On Jul 18, 2010, at 21:12 , Jack Uretsky wrote: > I'n trying to find a binary veersion of matplotlib that I can > install on my OS X Snow Leopard. Hello Jack, I see you're trying to install a lot of different python packages (matplotlib is a bear to install from source!). Have you considered the enthought distribution (www.enthought.com)? It has downloads for Mac, as well as other platforms, and has all of the science-type packages already there, including matplotlib, scipy, numpy, etc... I've had great luck with that, especially when working with students who expect a single-file installation. bb -- Brian Blais bblais at bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ From Chris.Barker at noaa.gov Mon Jul 19 20:48:28 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 19 Jul 2010 11:48:28 -0700 Subject: [Image-SIG] that's enough In-Reply-To: References: <1279097096.9049.3.camel@mypride> Message-ID: <4C449DFC.8040409@noaa.gov> Brian Blais wrote: >> I'n trying to find a binary veersion of matplotlib that I can >> install on my OS X Snow Leopard. really a question for the matplotlib list, but: There was recently a binary posted to the standard matplotlib page. It is for the python.org python -- that supports the widest audience, and can make-re-distributable binaries. So if you've installed the pythonorg python (not the one Apple ships), it shouold be an easy point and click install: Look here: http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0/ for: matplotlib-1.0.0-python.org-py2.6-macosx10.4.dmg -Chris > Hello Jack, > > I see you're trying to install a lot of different python packages > (matplotlib is a bear to install from source!). Have you considered the > enthought distribution (www.enthought.com)? It has downloads for Mac, > as well as other platforms, and has all of the science-type packages > already there, including matplotlib, scipy, numpy, etc... > > I've had great luck with that, especially when working with students who > expect a single-file installation. > > > bb -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From jlu at hep.anl.gov Mon Jul 19 20:59:00 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Mon, 19 Jul 2010 13:59:00 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: References: <1279097096.9049.3.camel@mypride> Message-ID: Thanks for the tip. It ain't cheap, so I'm checking to see if we have any site licenses. Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Sun, 18 Jul 2010, Brian Blais wrote: > On Jul 18, 2010, at 21:12 , Jack Uretsky wrote: > >> I'n trying to find a binary veersion of matplotlib that I can >> install on my OS X Snow Leopard. > > Hello Jack, > > I see you're trying to install a lot of different python packages (matplotlib > is a bear to install from source!). Have you considered the enthought > distribution (www.enthought.com)? It has downloads for Mac, as well as other > platforms, and has all of the science-type packages already there, including > matplotlib, scipy, numpy, etc... > > I've had great luck with that, especially when working with students who > expect a single-file installation. > > > bb > -- > Brian Blais > bblais at bryant.edu > http://web.bryant.edu/~bblais > http://bblais.blogspot.com/ > > From jlu at hep.anl.gov Mon Jul 19 22:32:22 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Mon, 19 Jul 2010 15:32:22 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: References: Message-ID: Thanks. I'm looking into this. But my problem was how to end a display; can you do this? Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Mon, 12 Jul 2010, Alec Bennett wrote: > My understanding is that show() is mainly for debugging and tests, and that > it doesn't offer very much control or efficiency. That's not to say that > what you're after can't be done, maybe someone else can help you with that, > I just don't know. > > Personally I'd suggest using WXPython, which can do what you're after fairly > easily. > > Here's one very simple way to display an image in WX: > > import wx > > class PictureWindow(wx.Frame): > ..def __init__(self, parent, id): > > ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), pos > = (50, 50), style = wx.DEFAULT_FRAME_STYLE) > ....panel = wx.Panel(self, -1) > ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap() > ....self.mainPic = wx.StaticBitmap(panel, -1, bmp) > ....self.Show() > > app = wx.App(redirect=0) > PictureWindow(None, -1) > app.MainLoop() > > > > > > On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky wrote: > >> Hi- >> The following worked very well: >> >>> import Image >>>>> d = Image.open("a_1.jpg") >>>>> d.show() >>>>> >>>>> >> Now, how do I turn >> it off before showing another image >> I'm on an Intel Mac, OS X Snow Leopard. >> Regards, >> Jack U. >> "Trust me. I have a lot of experience at this." >> General Custer's unremembered message to his men, >> just before leading them into the Little Big Horn Valley >> >> >> >> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > From Chris.Barker at noaa.gov Mon Jul 19 22:44:58 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 19 Jul 2010 13:44:58 -0700 Subject: [Image-SIG] that's enough In-Reply-To: References: Message-ID: <4C44B94A.2080801@noaa.gov> Jack Uretsky wrote: > Thanks. I'm looking into this. But my problem was how to end a > display; can you do this? If you are doing the wxPython option -- I"d ask on that list. But while we're here: What do you want to happen when you end the display? i.e. what program flow are you looking for? -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From jlu at hep.anl.gov Mon Jul 19 23:00:08 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Mon, 19 Jul 2010 16:00:08 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: <4C44B94A.2080801@noaa.gov> References: <4C44B94A.2080801@noaa.gov> Message-ID: Good question. I have a sequence of events ocurring in real time. To each event I display a corresponing .jpg picture. The number of events may be in the hundreds. There are eight pictures. Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Mon, 19 Jul 2010, Christopher Barker wrote: > Jack Uretsky wrote: >> Thanks. I'm looking into this. But my problem was how to end a display; >> can you do this? > > If you are doing the wxPython option -- I"d ask on that list. > > But while we're here: > > What do you want to happen when you end the display? i.e. what program flow > are you looking for? > > -CHB > > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker at noaa.gov > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From Chris.Barker at noaa.gov Mon Jul 19 23:14:59 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 19 Jul 2010 14:14:59 -0700 Subject: [Image-SIG] that's enough In-Reply-To: References: <4C44B94A.2080801@noaa.gov> Message-ID: <4C44C053.108@noaa.gov> Jack Uretsky wrote: > I have a sequence of events ocurring in real time. To each event I > display a corresponing .jpg picture. The number of events may be in the > hundreds. There are eight pictures. where are these "events" coming from? In any case, one route is to have a main wxPython application. In its OnInit method, start up another thread that runs the code that listens for events. In that code, when you get an event, call: wx.CallAfter(some_func_to_update_image) In some_func_to_update_image() You, well, update the image in your wxPython code. I think I already posted an example of how to do that. You put the listening code in a separate thread, so it won't block the wxPython MainLoop -- if all you are doing is displaying these images, that may not be necessary, though you'll have to do something so that the user can at least interact enough with the GUI enough to quit it. wx.CallAfter() is a way to deal with the fact that wxPython is not thread safe, so you can't make GUI calls directly from another thread. HTH, -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From jlu at hep.anl.gov Tue Jul 20 01:18:01 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Mon, 19 Jul 2010 18:18:01 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: <4C44C053.108@noaa.gov> References: <4C44B94A.2080801@noaa.gov> <4C44C053.108@noaa.gov> Message-ID: Hi Chris- In answer to your question, this is a simulation. The "events" are program generated; I'm trying to approximate a Poisson process, so the times between event pairs are exponentially distributed. Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Mon, 19 Jul 2010, Christopher Barker wrote: > Jack Uretsky wrote: >> I have a sequence of events ocurring in real time. To each event I >> display a corresponing .jpg picture. The number of events may be in the >> hundreds. There are eight pictures. > > where are these "events" coming from? > > In any case, one route is to have a main wxPython application. In its OnInit > method, start up another thread that runs the code that listens for events. > > In that code, when you get an event, call: > > wx.CallAfter(some_func_to_update_image) > > In some_func_to_update_image() > > You, well, update the image in your wxPython code. I think I already posted > an example of how to do that. > > You put the listening code in a separate thread, so it won't block the > wxPython MainLoop -- if all you are doing is displaying these images, that > may not be necessary, though you'll have to do something so that the user can > at least interact enough with the GUI enough to quit it. > > wx.CallAfter() is a way to deal with the fact that wxPython is not thread > safe, so you can't make GUI calls directly from another thread. > > HTH, > > -Chris > > > > > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker at noaa.gov > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From chris.mit7 at gmail.com Tue Jul 20 03:33:18 2010 From: chris.mit7 at gmail.com (Chris Mitchell) Date: Mon, 19 Jul 2010 21:33:18 -0400 Subject: [Image-SIG] that's enough In-Reply-To: References: <4C44B94A.2080801@noaa.gov> <4C44C053.108@noaa.gov> Message-ID: Hey Jack, Are you trying to model fluorophores? If you want to model a Poisson process you don't need any special packages, just take the negative log of a uniformly distributed random variable from 0-1. Mathematically, this would be saying: y = r*e(-rt), where y is a uniform random variable, then take the integral and then the inverse (how you turn a uniform distribution into any distribution you want). Chris On Mon, Jul 19, 2010 at 7:18 PM, Jack Uretsky wrote: > Hi Chris- > In answer to your question, > this is a simulation. ?The "events" are program generated; I'm trying to > approximate a Poisson process, so the times between event pairs are > exponentially distributed. > ? ? ? ? ? ? ? ? ? ? ? ?Regards, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Jack > > "Trust me. ?I have a lot of experience at this." > ? ? ? ? ? ? ? ?General Custer's unremembered message to his men, > ? ? ? ? ? ? ? ?just before leading them into the Little Big Horn Valley > > > > > On Mon, 19 Jul 2010, Christopher Barker wrote: > >> Jack Uretsky wrote: >>> >>> ? ?I have a sequence of events ocurring in real time. ?To each event I >>> display a corresponing .jpg picture. ?The number of events may be in the >>> hundreds. ?There are eight pictures. >> >> where are these "events" coming from? >> >> In any case, one route is to have a main wxPython application. In its >> OnInit method, start up another thread that runs the code that listens for >> events. >> >> In that code, when you get an event, call: >> >> wx.CallAfter(some_func_to_update_image) >> >> In some_func_to_update_image() >> >> You, well, update the image in your wxPython code. I think I already >> posted an example of how to do that. >> >> You put the listening code in a separate thread, so it won't block the >> wxPython MainLoop -- if all you are doing is displaying these images, that >> may not be necessary, though you'll have to do something so that the user >> can at least interact enough with the GUI enough to quit it. >> >> wx.CallAfter() is a way to deal with the fact that wxPython is not thread >> safe, so you can't make GUI calls directly from another thread. >> >> HTH, >> >> -Chris >> >> >> >> >> >> >> -- >> Christopher Barker, Ph.D. >> Oceanographer >> >> Emergency Response Division >> NOAA/NOS/OR&R ? ? ? ? ? ?(206) 526-6959 ? voice >> 7600 Sand Point Way NE ? (206) 526-6329 ? fax >> Seattle, WA ?98115 ? ? ? (206) 526-6317 ? main reception >> >> Chris.Barker at noaa.gov >> _______________________________________________ >> Image-SIG maillist ?- ?Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From jlu at hep.anl.gov Tue Jul 20 04:33:22 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Mon, 19 Jul 2010 21:33:22 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: References: <4C44B94A.2080801@noaa.gov> <4C44C053.108@noaa.gov> Message-ID: Hi Chris- Thabks. That's really not the issue here. My problem is that I very successfully flash a picture, but then I don't know how to get rid of it to flash another one. Regards, Jack (MIT '45, '56) "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Mon, 19 Jul 2010, Chris Mitchell wrote: > Hey Jack, > > Are you trying to model fluorophores? If you want to model a Poisson > process you don't need any special packages, just take the negative > log of a uniformly distributed random variable from 0-1. > Mathematically, this would be saying: y = r*e(-rt), where y is a > uniform random variable, then take the integral and then the inverse > (how you turn a uniform distribution into any distribution you want). > > Chris > > On Mon, Jul 19, 2010 at 7:18 PM, Jack Uretsky wrote: >> Hi Chris- >> In answer to your question, >> this is a simulation. ?The "events" are program generated; I'm trying to >> approximate a Poisson process, so the times between event pairs are >> exponentially distributed. >> ? ? ? ? ? ? ? ? ? ? ? ?Regards, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Jack >> >> "Trust me. ?I have a lot of experience at this." >> ? ? ? ? ? ? ? ?General Custer's unremembered message to his men, >> ? ? ? ? ? ? ? ?just before leading them into the Little Big Horn Valley >> >> >> >> >> On Mon, 19 Jul 2010, Christopher Barker wrote: >> >>> Jack Uretsky wrote: >>>> >>>> ? ?I have a sequence of events ocurring in real time. ?To each event I >>>> display a corresponing .jpg picture. ?The number of events may be in the >>>> hundreds. ?There are eight pictures. >>> >>> where are these "events" coming from? >>> >>> In any case, one route is to have a main wxPython application. In its >>> OnInit method, start up another thread that runs the code that listens for >>> events. >>> >>> In that code, when you get an event, call: >>> >>> wx.CallAfter(some_func_to_update_image) >>> >>> In some_func_to_update_image() >>> >>> You, well, update the image in your wxPython code. I think I already >>> posted an example of how to do that. >>> >>> You put the listening code in a separate thread, so it won't block the >>> wxPython MainLoop -- if all you are doing is displaying these images, that >>> may not be necessary, though you'll have to do something so that the user >>> can at least interact enough with the GUI enough to quit it. >>> >>> wx.CallAfter() is a way to deal with the fact that wxPython is not thread >>> safe, so you can't make GUI calls directly from another thread. >>> >>> HTH, >>> >>> -Chris >>> >>> >>> >>> >>> >>> >>> -- >>> Christopher Barker, Ph.D. >>> Oceanographer >>> >>> Emergency Response Division >>> NOAA/NOS/OR&R ? ? ? ? ? ?(206) 526-6959 ? voice >>> 7600 Sand Point Way NE ? (206) 526-6329 ? fax >>> Seattle, WA ?98115 ? ? ? (206) 526-6317 ? main reception >>> >>> Chris.Barker at noaa.gov >>> _______________________________________________ >>> Image-SIG maillist ?- ?Image-SIG at python.org >>> http://mail.python.org/mailman/listinfo/image-sig >>> >> _______________________________________________ >> Image-SIG maillist ?- ?Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > From chris.mit7 at gmail.com Tue Jul 20 07:11:05 2010 From: chris.mit7 at gmail.com (Chris Mitchell) Date: Tue, 20 Jul 2010 01:11:05 -0400 Subject: [Image-SIG] that's enough In-Reply-To: References: <4C44B94A.2080801@noaa.gov> <4C44C053.108@noaa.gov> Message-ID: Here is how I do it with wxPython. You might need to change a few things to get it to work for your instance since I copied/pasted part of my image viewer program to try and make a minimal example. Basically you need to run the simulation then call self.imageholder.Refresh(), which will execute the code in your OnPaint, which is linked to ReDraw class ImageFrame(wx.Frame): def __init__(self, parent, image): wx.Frame.__init__(self, parent, title="image frame") self.image = image self.im = Image.open(image) self.parent = parent self.framenum = 0 self.imagepanel = wx.Panel(self, -1) self.imageholder = wx.StaticBitmap(self.imagepanel, -1, self.picture, (0,0)) self.imageholder.Bind(wx.EVT_PAINT, self.OnPaint) def OnPaint(self, event): self.ReDraw(wx.BufferedPaintDC(self.imageholder)) def ReDraw(self, dc): picture = wx.Image(self.image, wx.BITMAP_TYPE_TIF, self.framenum) picture=wx.BitmapFromImage(picture) dc.DrawBitmap(picture,0,0) On Mon, Jul 19, 2010 at 10:33 PM, Jack Uretsky wrote: > Hi Chris- > ? ? ? ?Thabks. That's really not the issue here. ?My problem is that I very > ?successfully flash a picture, but then I don't know how to get rid of it to > flash another one. > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Regards, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Jack (MIT '45, '56) > > > "Trust me. ?I have a lot of experience at this." > ? ? ? ? ? ? ? ?General Custer's unremembered message to his men, > ? ? ? ? ? ? ? ?just before leading them into the Little Big Horn Valley > > > > > On Mon, 19 Jul 2010, Chris Mitchell wrote: > >> Hey Jack, >> >> Are you trying to model fluorophores? ?If you want to model a Poisson >> process you don't need any special packages, just take the negative >> log of a uniformly distributed random variable from 0-1. >> Mathematically, this would be saying: y = r*e(-rt), where y is a >> uniform random variable, then take the integral and then the inverse >> (how you turn a uniform distribution into any distribution you want). >> >> Chris >> >> On Mon, Jul 19, 2010 at 7:18 PM, Jack Uretsky wrote: >>> >>> Hi Chris- >>> In answer to your question, >>> this is a simulation. ?The "events" are program generated; I'm trying to >>> approximate a Poisson process, so the times between event pairs are >>> exponentially distributed. >>> ? ? ? ? ? ? ? ? ? ? ? ?Regards, >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Jack >>> >>> "Trust me. ?I have a lot of experience at this." >>> ? ? ? ? ? ? ? ?General Custer's unremembered message to his men, >>> ? ? ? ? ? ? ? ?just before leading them into the Little Big Horn Valley >>> >>> >>> >>> >>> On Mon, 19 Jul 2010, Christopher Barker wrote: >>> >>>> Jack Uretsky wrote: >>>>> >>>>> ? ?I have a sequence of events ocurring in real time. ?To each event I >>>>> display a corresponing .jpg picture. ?The number of events may be in >>>>> the >>>>> hundreds. ?There are eight pictures. >>>> >>>> where are these "events" coming from? >>>> >>>> In any case, one route is to have a main wxPython application. In its >>>> OnInit method, start up another thread that runs the code that listens >>>> for >>>> events. >>>> >>>> In that code, when you get an event, call: >>>> >>>> wx.CallAfter(some_func_to_update_image) >>>> >>>> In some_func_to_update_image() >>>> >>>> You, well, update the image in your wxPython code. I think I already >>>> posted an example of how to do that. >>>> >>>> You put the listening code in a separate thread, so it won't block the >>>> wxPython MainLoop -- if all you are doing is displaying these images, >>>> that >>>> may not be necessary, though you'll have to do something so that the >>>> user >>>> can at least interact enough with the GUI enough to quit it. >>>> >>>> wx.CallAfter() is a way to deal with the fact that wxPython is not >>>> thread >>>> safe, so you can't make GUI calls directly from another thread. >>>> >>>> HTH, >>>> >>>> -Chris >>>> >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> Christopher Barker, Ph.D. >>>> Oceanographer >>>> >>>> Emergency Response Division >>>> NOAA/NOS/OR&R ? ? ? ? ? ?(206) 526-6959 ? voice >>>> 7600 Sand Point Way NE ? (206) 526-6329 ? fax >>>> Seattle, WA ?98115 ? ? ? (206) 526-6317 ? main reception >>>> >>>> Chris.Barker at noaa.gov >>>> _______________________________________________ >>>> Image-SIG maillist ?- ?Image-SIG at python.org >>>> http://mail.python.org/mailman/listinfo/image-sig >>>> >>> _______________________________________________ >>> Image-SIG maillist ?- ?Image-SIG at python.org >>> http://mail.python.org/mailman/listinfo/image-sig >>> > From yury at shurup.com Tue Jul 20 09:42:09 2010 From: yury at shurup.com (Yury V. Zaytsev) Date: Tue, 20 Jul 2010 09:42:09 +0200 Subject: [Image-SIG] that's enough In-Reply-To: References: <4C44B94A.2080801@noaa.gov> <4C44C053.108@noaa.gov> Message-ID: <1279611729.7488.26.camel@mypride> On Mon, 2010-07-19 at 18:18 -0500, Jack Uretsky wrote: > In answer to your question, > this is a simulation. The "events" are program generated; I'm trying to > approximate a Poisson process, so the times between event pairs are > exponentially distributed. Hi! It seems to me that you are consistently trying out wrong tools for the job. Maybe next time you should really start by explaining what you want to achieve in the first place? What you really need is pygame. It is a simple Python SDL wrapper, that is absolutely great to use for simulations visualization. This is the code you need to get what you want: # Center window on the screen os.environ["SDL_VIDEO_CENTERED"] = "1" pygame.init() pygame.display.set_mode(self.screen_size, 0) screen = pygame.display.get_surface() # CYCLE # Create the backgound background = pygame.image.load(fullpath) background = background.convert() # Display the background screen.blit(background, (0, 0)) pygame.display.flip() I have written a 2D n-body problem simulator that I used as teaching material for a Python course this spring, so if you want a more complete example I can send it to you, but either way, I think it's better off this list. -- Sincerely yours, Yury V. Zaytsev From yury at shurup.com Tue Jul 20 09:55:47 2010 From: yury at shurup.com (Yury V. Zaytsev) Date: Tue, 20 Jul 2010 09:55:47 +0200 Subject: [Image-SIG] that's enough In-Reply-To: References: <1279097096.9049.3.camel@mypride> Message-ID: <1279612547.7488.27.camel@mypride> On Mon, 2010-07-19 at 13:59 -0500, Jack Uretsky wrote: > Thanks for the tip. It ain't cheap, so I'm checking to see if we have any > site licenses. FYI it's free for academic use. -- Sincerely yours, Yury V. Zaytsev From jlu at hep.anl.gov Tue Jul 20 20:21:25 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Tue, 20 Jul 2010 13:21:25 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: <1279611729.7488.26.camel@mypride> References: <4C44B94A.2080801@noaa.gov> <4C44C053.108@noaa.gov> <1279611729.7488.26.camel@mypride> Message-ID: Hi- Thanks very much. My "more detailed explanation" seems to have confused the issue. Here is a more detailed, more detailed explaation: The principal program calculates the state of a 3-"spin" assembly, each spin can either be up or down - there are, accordingly, 8 possible states. The spins "flip" singly and randomly, as described in the Cornell ArXiV 0912.4068 (gen phys). I have prepared .jpg's showing the 8 possible configurations. When the principal program calculates a new configuration, I would like to show the relevant .jpg. There are undoubtedly a plethora of ways to illustrate the process I am discussing. Did I choose one that is too difficult for a simple python progam? Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Tue, 20 Jul 2010, Yury V. Zaytsev wrote: > On Mon, 2010-07-19 at 18:18 -0500, Jack Uretsky wrote: > >> In answer to your question, >> this is a simulation. The "events" are program generated; I'm trying to >> approximate a Poisson process, so the times between event pairs are >> exponentially distributed. > > Hi! > > It seems to me that you are consistently trying out wrong tools for the > job. Maybe next time you should really start by explaining what you want > to achieve in the first place? > > What you really need is pygame. It is a simple Python SDL wrapper, that > is absolutely great to use for simulations visualization. This is the > code you need to get what you want: > > # Center window on the screen > os.environ["SDL_VIDEO_CENTERED"] = "1" > pygame.init() > pygame.display.set_mode(self.screen_size, 0) > screen = pygame.display.get_surface() > > # CYCLE > > # Create the backgound > background = pygame.image.load(fullpath) > background = background.convert() > > # Display the background > screen.blit(background, (0, 0)) > pygame.display.flip() > > I have written a 2D n-body problem simulator that I used as teaching > material for a Python course this spring, so if you want a more complete > example I can send it to you, but either way, I think it's better off > this list. > > -- > Sincerely yours, > Yury V. Zaytsev > From jlu at hep.anl.gov Wed Jul 21 01:09:28 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Tue, 20 Jul 2010 18:09:28 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: <4C449DFC.8040409@noaa.gov> References: <1279097096.9049.3.camel@mypride> <4C449DFC.8040409@noaa.gov> Message-ID: Hi all- I'm really grateful for all the help, but my question seems to have gotten lost. I was really happy with "show', except that I could not stop the display. Is it in fact true that there is no way to stop a 'show" display of an image in order to do a subsequent 'show' display of a different image? Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Mon, 19 Jul 2010, Christopher Barker wrote: > Brian Blais wrote: >>> I'n trying to find a binary veersion of matplotlib that I can >>> install on my OS X Snow Leopard. > > really a question for the matplotlib list, but: > > There was recently a binary posted to the standard matplotlib page. > > It is for the python.org python -- that supports the widest audience, and can > make-re-distributable binaries. > > So if you've installed the pythonorg python (not the one Apple ships), it > shouold be an easy point and click install: > > Look here: > > http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0/ > > for: > > matplotlib-1.0.0-python.org-py2.6-macosx10.4.dmg > > -Chris > > > >> Hello Jack, >> >> I see you're trying to install a lot of different python packages >> (matplotlib is a bear to install from source!). Have you considered the >> enthought distribution (www.enthought.com)? It has downloads for Mac, as >> well as other platforms, and has all of the science-type packages already >> there, including matplotlib, scipy, numpy, etc... >> >> I've had great luck with that, especially when working with students who >> expect a single-file installation. >> >> >> bb > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker at noaa.gov > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From halbert at halwitz.org Wed Jul 21 02:06:11 2010 From: halbert at halwitz.org (Dan Halbert) Date: Tue, 20 Jul 2010 20:06:11 -0400 Subject: [Image-SIG] that's enough In-Reply-To: References: <1279097096.9049.3.camel@mypride> <4C449DFC.8040409@noaa.gov> Message-ID: <4C4639F3.1050803@halwitz.org> On 7/20/2010 7:09 PM, Jack Uretsky wrote: > Hi all- > I'm really grateful for all the help, but my question seems to have > gotten lost. I was really happy with "show', except that I could not stop > the display. Is it in fact true that there is no way to stop a 'show" > display of an image in order to do a subsequent 'show' display of a > different image? > Regards, > Jack show() is meant for very casual "manual" viewing of images, really for debugging. It just invokes some image display or other, depending on which platform it's running on. PIL itself has no other UI stuff built in, as its focus is an image manipulation library. You need a UI library of some kind. You might try starting with TkInter. Here are a few elementary examples of displaying images using TkInter: http://code.activestate.com/recipes/521918-pil-and-tkinter-to-display-images/ http://www.noah.org/wiki/PIL_Image_show_with_Tk From Chris.Barker at noaa.gov Wed Jul 21 03:09:39 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Tue, 20 Jul 2010 18:09:39 -0700 Subject: [Image-SIG] that's enough In-Reply-To: <4C4639F3.1050803@halwitz.org> References: <1279097096.9049.3.camel@mypride> <4C449DFC.8040409@noaa.gov> <4C4639F3.1050803@halwitz.org> Message-ID: <4C4648D3.8020104@noaa.gov> Dan Halbert wrote: > show() is meant for very casual "manual" viewing of images, really for > debugging. It just invokes some image display or other, depending on > which platform it's running on. And you got this answer right from the beginning. Essentially, PIL can't be used the way you want to use it, and you've gotten many suggestions as to other options. At least: wxPython TkInter PyGame matplotlib others? I think a couple of people have even posted code that does most f what you want. You'll just have to pick one and go look at its docs and mailing list to see how to do what you want. Or do you mean matplotlib show(), which is designed to be the last call in a script -- but look at the docs, and the matplotlib docs for ways to do what you want. The tools are out there. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From yury at shurup.com Wed Jul 21 13:42:04 2010 From: yury at shurup.com (Yury V. Zaytsev) Date: Wed, 21 Jul 2010 13:42:04 +0200 Subject: [Image-SIG] that's enough In-Reply-To: References: <4C44B94A.2080801@noaa.gov> <4C44C053.108@noaa.gov> <1279611729.7488.26.camel@mypride> Message-ID: <1279712524.7184.26.camel@mypride> Hi! Yes, this sounds like a perfect use case for pygame. Just set up a screen, then run your main loop and when a new state is calculated, blit the corresponding JPEG to the screen. I've already posted the code that you need to implement this setting. -- Sincerely yours, Yury V. Zaytsev On Tue, 2010-07-20 at 13:21 -0500, Jack Uretsky wrote: > Hi- > Thanks very much. My "more detailed explanation" seems to have > confused the issue. Here is a more detailed, more detailed explaation: > The principal program calculates the state of a 3-"spin" assembly, > each spin can either be up or down - there are, accordingly, 8 possible > states. The spins "flip" singly and randomly, as described in the Cornell > ArXiV 0912.4068 (gen phys). I have prepared .jpg's showing the 8 possible > configurations. When the principal program calculates a new > configuration, I would like to show the relevant .jpg. > There are undoubtedly a plethora of ways to illustrate the process > I am discussing. Did I choose one that is too difficult for a simple > python progam? > Regards, > Jack > > > "Trust me. I have a lot of experience at this." > General Custer's unremembered message to his men, > just before leading them into the Little Big Horn Valley > > > > > On Tue, 20 Jul 2010, Yury V. Zaytsev wrote: > > > On Mon, 2010-07-19 at 18:18 -0500, Jack Uretsky wrote: > > > >> In answer to your question, > >> this is a simulation. The "events" are program generated; I'm trying to > >> approximate a Poisson process, so the times between event pairs are > >> exponentially distributed. > > > > Hi! > > > > It seems to me that you are consistently trying out wrong tools for the > > job. Maybe next time you should really start by explaining what you want > > to achieve in the first place? > > > > What you really need is pygame. It is a simple Python SDL wrapper, that > > is absolutely great to use for simulations visualization. This is the > > code you need to get what you want: > > > > # Center window on the screen > > os.environ["SDL_VIDEO_CENTERED"] = "1" > > pygame.init() > > pygame.display.set_mode(self.screen_size, 0) > > screen = pygame.display.get_surface() > > > > # CYCLE > > > > # Create the backgound > > background = pygame.image.load(fullpath) > > background = background.convert() > > > > # Display the background > > screen.blit(background, (0, 0)) > > pygame.display.flip() > > > > I have written a 2D n-body problem simulator that I used as teaching > > material for a Python course this spring, so if you want a more complete > > example I can send it to you, but either way, I think it's better off > > this list. > > > > -- > > Sincerely yours, > > Yury V. Zaytsev > > From jlu at hep.anl.gov Wed Jul 21 20:33:38 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Wed, 21 Jul 2010 13:33:38 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: <1279712524.7184.26.camel@mypride> References: <4C44B94A.2080801@noaa.gov> <4C44C053.108@noaa.gov> <1279611729.7488.26.camel@mypride> <1279712524.7184.26.camel@mypride> Message-ID: Thanks. Sounds great. Do you have any recollection of where and when you posted? I've googled pygame with Zaytsev, and scanned all the archive titles for the year under Zaytsev, but I need further hints. Turns out that pygame is on my Mac. Regards. Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Wed, 21 Jul 2010, Yury V. Zaytsev wrote: > Hi! > > Yes, this sounds like a perfect use case for pygame. Just set up a > screen, then run your main loop and when a new state is calculated, blit > the corresponding JPEG to the screen. > > I've already posted the code that you need to implement this setting. > > -- > Sincerely yours, > Yury V. Zaytsev > > On Tue, 2010-07-20 at 13:21 -0500, Jack Uretsky wrote: >> Hi- >> Thanks very much. My "more detailed explanation" seems to have >> confused the issue. Here is a more detailed, more detailed explaation: >> The principal program calculates the state of a 3-"spin" assembly, >> each spin can either be up or down - there are, accordingly, 8 possible >> states. The spins "flip" singly and randomly, as described in the Cornell >> ArXiV 0912.4068 (gen phys). I have prepared .jpg's showing the 8 possible >> configurations. When the principal program calculates a new >> configuration, I would like to show the relevant .jpg. >> There are undoubtedly a plethora of ways to illustrate the process >> I am discussing. Did I choose one that is too difficult for a simple >> python progam? >> Regards, >> Jack >> >> >> "Trust me. I have a lot of experience at this." >> General Custer's unremembered message to his men, >> just before leading them into the Little Big Horn Valley >> >> >> >> >> On Tue, 20 Jul 2010, Yury V. Zaytsev wrote: >> >>> On Mon, 2010-07-19 at 18:18 -0500, Jack Uretsky wrote: >>> >>>> In answer to your question, >>>> this is a simulation. The "events" are program generated; I'm trying to >>>> approximate a Poisson process, so the times between event pairs are >>>> exponentially distributed. >>> >>> Hi! >>> >>> It seems to me that you are consistently trying out wrong tools for the >>> job. Maybe next time you should really start by explaining what you want >>> to achieve in the first place? >>> >>> What you really need is pygame. It is a simple Python SDL wrapper, that >>> is absolutely great to use for simulations visualization. This is the >>> code you need to get what you want: >>> >>> # Center window on the screen >>> os.environ["SDL_VIDEO_CENTERED"] = "1" >>> pygame.init() >>> pygame.display.set_mode(self.screen_size, 0) >>> screen = pygame.display.get_surface() >>> >>> # CYCLE >>> >>> # Create the backgound >>> background = pygame.image.load(fullpath) >>> background = background.convert() >>> >>> # Display the background >>> screen.blit(background, (0, 0)) >>> pygame.display.flip() >>> >>> I have written a 2D n-body problem simulator that I used as teaching >>> material for a Python course this spring, so if you want a more complete >>> example I can send it to you, but either way, I think it's better off >>> this list. >>> >>> -- >>> Sincerely yours, >>> Yury V. Zaytsev >>> > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From Chris.Barker at noaa.gov Wed Jul 21 21:02:24 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 21 Jul 2010 12:02:24 -0700 Subject: [Image-SIG] that's enough In-Reply-To: References: <4C44B94A.2080801@noaa.gov> <4C44C053.108@noaa.gov> <1279611729.7488.26.camel@mypride> <1279712524.7184.26.camel@mypride> Message-ID: <4C474440.1050907@noaa.gov> Jack Uretsky wrote: > Thanks. Sounds great. Do you have any recollection of where and when > you posted? On this list July 20th -- here it is: Yury V. Zaytsev wrote: > On Mon, 2010-07-19 at 18:18 -0500, Jack Uretsky wrote: > >> In answer to your question, >> this is a simulation. The "events" are program generated; I'm trying to >> approximate a Poisson process, so the times between event pairs are >> exponentially distributed. > > Hi! > > It seems to me that you are consistently trying out wrong tools for the > job. Maybe next time you should really start by explaining what you want > to achieve in the first place? > > What you really need is pygame. It is a simple Python SDL wrapper, that > is absolutely great to use for simulations visualization. This is the > code you need to get what you want: > > # Center window on the screen > os.environ["SDL_VIDEO_CENTERED"] = "1" > pygame.init() > pygame.display.set_mode(self.screen_size, 0) > screen = pygame.display.get_surface() > > # CYCLE > > # Create the backgound > background = pygame.image.load(fullpath) > background = background.convert() > > # Display the background > screen.blit(background, (0, 0)) > pygame.display.flip() > > I have written a 2D n-body problem simulator that I used as teaching > material for a Python course this spring, so if you want a more complete > example I can send it to you, but either way, I think it's better off > this list. > -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From janssen at parc.com Thu Jul 22 19:47:13 2010 From: janssen at parc.com (Bill Janssen) Date: Thu, 22 Jul 2010 10:47:13 PDT Subject: [Image-SIG] bug in docs for Image.rotate() Message-ID: <63801.1279820833@parc.com> Hmmm, the docs say that Image.rotate() has a "filter" keyword arg, but the code says that it's really "resample". Note that the docstring in the code is wrong, too. This is 1.1.6 I'm looking at. Bill From janssen at parc.com Thu Jul 22 21:19:07 2010 From: janssen at parc.com (Bill Janssen) Date: Thu, 22 Jul 2010 12:19:07 PDT Subject: [Image-SIG] bug in docs for Image.rotate() In-Reply-To: <63801.1279820833@parc.com> References: <63801.1279820833@parc.com> Message-ID: <67013.1279826347@parc.com> Bill Janssen wrote: > Hmmm, the docs say that Image.rotate() has a "filter" keyword arg, but > the code says that it's really "resample". Note that the docstring in > the code is wrong, too. This is 1.1.6 I'm looking at. Also wrong in 1.1.7. And, in Image.rotate(), if you specify a "resample" param and also "expand=True", the resample param is not passed on to Image.transform(). Bill From Chris.Barker at noaa.gov Sun Jul 18 21:56:56 2010 From: Chris.Barker at noaa.gov (Chris Barker) Date: Sun, 18 Jul 2010 12:56:56 -0700 Subject: [Image-SIG] PIL Query In-Reply-To: References: Message-ID: <4C435C88.5010504@noaa.gov> On 7/18/10 12:41 PM, Fredrik Lundh wrote: > PIL is a image manipulation/graphics library for Python, and it > doesn't provide any standard functions for e.g. plotting data on maps > or serving them from a web server. From your description, it sounds > like you're using some application that uses PIL, so you might want to > contact the authors of that application instead. > Or, if you really do want a library for working with geo-refrenced raster images in Python: www.gdal.org/ GDAL comes with very powerful command line tools, and bindings for use with Python. -Chris > > > 2010/7/10 Ankit Jhalaria: > >> Hi >> I was using the PIL. I found it pretty useful. >> I was wondering if you could please let me know, whether I could change the >> image size. What I mean is if suppose I have 100 points having the same >> latitude and longitude, the point on the map appears (for instance as a red >> circle). My question to you is, can I change the radius of this circle? >> I was also trying to figure out where in the code I can change the location >> where the url is served from. >> So instead of serving the images form http://localhost/classic/4/4,5.png >> how do I change it to >> http://localhost/username/classic/4/4,5.png >> where username is taken from the database. >> & my last question is, is it possible that I just give the PIL the >> latitude,longitude and the no. of points having the same latitude and >> longitude[i.e. intensity], instead of repeating the lat& long coordinates. >> Your help will be greatly appreciated >> Thanks >> Ankit >> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> >> >> > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jlu at hep.anl.gov Sat Jul 24 02:59:47 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Fri, 23 Jul 2010 19:59:47 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: References: <4C44B94A.2080801@noaa.gov> <4C44C053.108@noaa.gov> <1279611729.7488.26.camel@mypride> <1279712524.7184.26.camel@mypride> Message-ID: Hi all- Maybe someone can set me straight, but this whold dialog is beginning to sound like the answer to the little girl's question, "Mom, where did I come from?" After Mom's erudite exposition of biology 101, the little girl said, "Dorothy said she came from Wichita, where did I come from?". Regards, jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley From peter_zyj at hotmail.com Sun Jul 25 15:29:33 2010 From: peter_zyj at hotmail.com (=?gb2312?B?1uzp8779?=) Date: Sun, 25 Jul 2010 21:29:33 +0800 Subject: [Image-SIG] the question about the PIL installation on cygwin Message-ID: hi, supporter i am trying to get PIL on my PC cygwin/windows, python 2.6.5, and PIL 1.1.7 but one big fault suspend me!! $ python setup.py install running install running build running build_py running build_ext building '_imaging' extension gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_LIBZ -I/usr/include/freetype2 -IlibImaging -I/usr/include -I/usr/include/python2.6 -c _imaging.c -o build/temp.cygwin-1.7.5-i686-2.6/_imaging.o unable to execute gcc: No such file or directory error: command 'gcc' failed with exit status 1 i don't know what file or folder that GCC can not find?? i also find some other guy met with such problems, but no solution put forwarded or i can not find it on internet :) sorry for the ridiculous question , i am the amateur pythoner BRs Carl _________________________________________________________________ ???????????????? http://cn.bing.com/search?q=%E5%A4%A9%E6%B0%94%E9%A2%84%E6%8A%A5&form=MICHJ2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From yury at shurup.com Tue Jul 27 19:22:37 2010 From: yury at shurup.com (Yury V. Zaytsev) Date: Tue, 27 Jul 2010 19:22:37 +0200 Subject: [Image-SIG] the question about the PIL installation on cygwin In-Reply-To: References: Message-ID: <1280251357.15362.26.camel@mypride> On Sun, 2010-07-25 at 21:29 +0800, ??? wrote: > > i don't know what file or folder that GCC can not find?? You don't have GCC installed at all. Install gcc first... -- Sincerely yours, Yury V. Zaytsev From jlu at hep.anl.gov Tue Jul 27 21:38:10 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Tue, 27 Jul 2010 14:38:10 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: References: Message-ID: Hi Alec Well, Ive downloaded wxpython, and am trying to run your little example, so far with no success; but that's mostly because my thumbs keep getting in the way. As I understand what you've programmed, it includes a frame, labels, etc. I just want to exhibit my bare .jpg, and then make it go away. Does that let me eliminate some lines in your example" Regards, Jack ps I've also ordered a book on pygames, as another approach to my problem. "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Mon, 12 Jul 2010, Alec Bennett wrote: > My understanding is that show() is mainly for debugging and tests, and that > it doesn't offer very much control or efficiency. That's not to say that > what you're after can't be done, maybe someone else can help you with that, > I just don't know. > > Personally I'd suggest using WXPython, which can do what you're after fairly > easily. > > Here's one very simple way to display an image in WX: > > import wx > > class PictureWindow(wx.Frame): > ..def __init__(self, parent, id): > > ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), pos > = (50, 50), style = wx.DEFAULT_FRAME_STYLE) > ....panel = wx.Panel(self, -1) > ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap() > ....self.mainPic = wx.StaticBitmap(panel, -1, bmp) > ....self.Show() > > app = wx.App(redirect=0) > PictureWindow(None, -1) > app.MainLoop() > > > > > > On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky wrote: > >> Hi- >> The following worked very well: >> >>> import Image >>>>> d = Image.open("a_1.jpg") >>>>> d.show() >>>>> >>>>> >> Now, how do I turn >> it off before showing another image >> I'm on an Intel Mac, OS X Snow Leopard. >> Regards, >> Jack U. >> "Trust me. I have a lot of experience at this." >> General Custer's unremembered message to his men, >> just before leading them into the Little Big Horn Valley >> >> >> >> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > From jlu at hep.anl.gov Thu Jul 29 04:56:57 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Wed, 28 Jul 2010 21:56:57 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: <4C4639F3.1050803@halwitz.org> References: <1279097096.9049.3.camel@mypride> <4C449DFC.8040409@noaa.gov> <4C4639F3.1050803@halwitz.org> Message-ID: Hi all- I suspect that my phrasing was a distraction. There is a python command that brings up an X11 window. Is there a python command that make the window go away? This is a general question, independent of the particular context of my program. Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Tue, 20 Jul 2010, Dan Halbert wrote: > On 7/20/2010 7:09 PM, Jack Uretsky wrote: >> Hi all- >> I'm really grateful for all the help, but my question seems to have >> gotten lost. I was really happy with "show', except that I could not stop >> the display. Is it in fact true that there is no way to stop a 'show" >> display of an image in order to do a subsequent 'show' display of a >> different image? >> Regards, >> Jack > show() is meant for very casual "manual" viewing of images, really for > debugging. It just invokes some image display or other, depending on which > platform it's running on. > > PIL itself has no other UI stuff built in, as its focus is an image > manipulation library. You need a UI library of some kind. You might try > starting with TkInter. Here are a few elementary examples of displaying > images using TkInter: > http://code.activestate.com/recipes/521918-pil-and-tkinter-to-display-images/ > http://www.noah.org/wiki/PIL_Image_show_with_Tk > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From donn.ingle at gmail.com Thu Jul 29 11:13:04 2010 From: donn.ingle at gmail.com (donn) Date: Thu, 29 Jul 2010 11:13:04 +0200 Subject: [Image-SIG] that's enough In-Reply-To: References: <1279097096.9049.3.camel@mypride> <4C449DFC.8040409@noaa.gov> <4C4639F3.1050803@halwitz.org> Message-ID: <4C514620.3050806@gmail.com> On 29/07/2010 04:56, Jack Uretsky wrote: > I suspect that my phrasing was a distraction. There is a python > command that brings up an X11 window. Is there a python command that > make the window go away? > This is a general question, independent of the particular context > of my program. You've already been given all the best info: If you want to work with images, and you want some control over that, then use a gui toolkit. Your choices: Tk, WxWidgets, GTK, QT and then it gets harder. If you want to open a given image file without much control, then simply fire-off a call to your o/s to open file 'X' using program 'Y' with popen or subprocess (see Python docs). To close program 'Y', make sure you keep its process-id and then use similar means to call kill. Some image viewers may even replace the last image with the new one, so you can leave it open. Think 'scripting by pipes' if you don't want to use a gui toolkit. \d From jlu at hep.anl.gov Thu Jul 29 17:38:08 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Thu, 29 Jul 2010 10:38:08 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: <4C514620.3050806@gmail.com> References: <1279097096.9049.3.camel@mypride> <4C449DFC.8040409@noaa.gov> <4C4639F3.1050803@halwitz.org> <4C514620.3050806@gmail.com> Message-ID: Thank you. I am new to these "toolkits", but this gives me some clues that I can follow up. Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Thu, 29 Jul 2010, donn wrote: > On 29/07/2010 04:56, Jack Uretsky wrote: >> I suspect that my phrasing was a distraction. There is a python >> command that brings up an X11 window. Is there a python command that >> make the window go away? >> This is a general question, independent of the particular context >> of my program. > You've already been given all the best info: If you want to work with images, > and you want some control over that, then use a gui toolkit. Your choices: > Tk, WxWidgets, GTK, QT and then it gets harder. > > If you want to open a given image file without much control, then simply > fire-off a call to your o/s to open file 'X' using program 'Y' with popen or > subprocess (see Python docs). > To close program 'Y', make sure you keep its process-id and then use similar > means to call kill. Some image viewers may even replace the last image with > the new one, so you can leave it open. > > Think 'scripting by pipes' if you don't want to use a gui toolkit. > > \d > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From olaf at dtrx.de Fri Jul 30 09:42:47 2010 From: olaf at dtrx.de (Olaf Dietrich) Date: Fri, 30 Jul 2010 09:42:47 +0200 Subject: [Image-SIG] ImageOps.fit(): centering parameter (PIL 1.1.7) Message-ID: <20100730074247.GA4255@gracvn.ikra.med.uni-muenchen.de> Does the centering parameter of ImageOps.fit() really work as intended (i.e. as described in the documentation)? # @param centering Control the cropping position. Use (0.5, 0.5) for # center cropping (e.g. if cropping the width, take 50% off of the # left side, and therefore 50% off the right side). (0.0, 0.0) # will crop from the top left corner (i.e. if cropping the width, # take all of the crop off of the right side, and if cropping the # height, take all of it off the bottom). (1.0, 0.0) will crop # from the bottom left corner, etc. (i.e. if cropping the width, # take all of the crop off the left side, and if cropping the height # take none from the top, and therefore all off the bottom). The relevant code should be (from ImageOps.py): bleedPixels = ( int((float(bleed) * float(image.size[0])) + 0.5), int((float(bleed) * float(image.size[1])) + 0.5) ) liveArea = ( bleedPixels[0], bleedPixels[1], image.size[0] - bleedPixels[0] - 1, image.size[1] - bleedPixels[1] - 1 ) ... # make the crop leftSide = int(liveArea[0] + (float(liveSize[0]-cropWidth) * centering[0])) if leftSide < 0: leftSide = 0 topSide = int(liveArea[1] + (float(liveSize[1]-cropHeight) * centering[1])) if topSide < 0: topSide = 0 So, liveArea[0] = bleedPixels[0] = bleed * image.size[0] should describe the border that is cropped (by default from left _and_ right). This works - independent from centering[0] - for the symmetric case. But leftSide will only be equal to liveArea[0] if either centering[0]==0 (which is _not_ the default case) or if liveSize[0]-cropWidth==0, which seems to be the case in all my examples. But the latter means that changing centering[0] does not have any effect on the cropped area (which is what I do indeed observe). So I wonder if I do not understand the documentation correctly or if the code does not really do what it should do ... Following the description above, I would have expected something along the lines: # make the crop leftSide = int(liveArea[0] * 2 * centering[0]) topSide = int(liveArea[1] * 2 * centering[1]) instead of the above ...? Thanks for any hints Olaf From jlu at hep.anl.gov Fri Jul 30 17:48:09 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Fri, 30 Jul 2010 10:48:09 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: References: Message-ID: Hi- I must be misunderstanding your e-mail. When I try to copy what your wrote (I now have wxpython), I get an exception, as follows: _______________________________ >>> import wx >>> >>> class PictureWindow(wx.Frame): ... def__init__(self, parent, id): File "", line 2 def__init__(self, parent, id): ^ SyntaxError: invalid syntax ___________________________________ Please clarify. Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Mon, 12 Jul 2010, Alec Bennett wrote: > My understanding is that show() is mainly for debugging and tests, and that > it doesn't offer very much control or efficiency. That's not to say that > what you're after can't be done, maybe someone else can help you with that, > I just don't know. > > Personally I'd suggest using WXPython, which can do what you're after fairly > easily. > > Here's one very simple way to display an image in WX: > > import wx > > class PictureWindow(wx.Frame): > ..def __init__(self, parent, id): > > ....wx.Frame.__init__(self, parent, id, "Window Title", size=(200, 200), pos > = (50, 50), style = wx.DEFAULT_FRAME_STYLE) > ....panel = wx.Panel(self, -1) > ....bmp = wx.Image("page1.jpg", wx.BITMAP_TYPE_ANY).ConvertToBitmap() > ....self.mainPic = wx.StaticBitmap(panel, -1, bmp) > ....self.Show() > > app = wx.App(redirect=0) > PictureWindow(None, -1) > app.MainLoop() > > > > > > On Sun, Jul 11, 2010 at 4:16 PM, Jack Uretsky wrote: > >> Hi- >> The following worked very well: >> >>> import Image >>>>> d = Image.open("a_1.jpg") >>>>> d.show() >>>>> >>>>> >> Now, how do I turn >> it off before showing another image >> I'm on an Intel Mac, OS X Snow Leopard. >> Regards, >> Jack U. >> "Trust me. I have a lot of experience at this." >> General Custer's unremembered message to his men, >> just before leading them into the Little Big Horn Valley >> >> >> >> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > From donn.ingle at gmail.com Fri Jul 30 18:06:20 2010 From: donn.ingle at gmail.com (donn) Date: Fri, 30 Jul 2010 18:06:20 +0200 Subject: [Image-SIG] that's enough In-Reply-To: References: Message-ID: <4C52F87C.4000205@gmail.com> On 30/07/2010 17:48, Jack Uretsky wrote: > def__init__(self, parent, id): > ^ > SyntaxError: invalid syntax I imagine the spacing in the email was not preserved, but even so, Python is giving you a little arrow "^" to go look at.... def, SPACE, dunder-init... etc. def __init... \d From jlu at hep.anl.gov Fri Jul 30 19:20:52 2010 From: jlu at hep.anl.gov (Jack Uretsky) Date: Fri, 30 Jul 2010 12:20:52 -0500 (CDT) Subject: [Image-SIG] that's enough In-Reply-To: <4C52F87C.4000205@gmail.com> References: <4C52F87C.4000205@gmail.com> Message-ID: Thanks. I see the arrow, which seems to point to a colon, which is in the original that I'm trying to copy. That's why I'm asking for clarification. Regards, Jack "Trust me. I have a lot of experience at this." General Custer's unremembered message to his men, just before leading them into the Little Big Horn Valley On Fri, 30 Jul 2010, donn wrote: > On 30/07/2010 17:48, Jack Uretsky wrote: >> def__init__(self, parent, id): >> ^ >> SyntaxError: invalid syntax > I imagine the spacing in the email was not preserved, but even so, Python is > giving you a little arrow "^" to go look at.... > > def, SPACE, dunder-init... etc. > def __init... > > > \d > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From olaf at dtrx.de Thu Jul 29 09:26:07 2010 From: olaf at dtrx.de (Olaf Dietrich) Date: Thu, 29 Jul 2010 09:26:07 +0200 Subject: [Image-SIG] ImageOps.fit(): centering parameter (PIL 1.1.7) Message-ID: <20100729072607.GA3977@gracvn.ikra.med.uni-muenchen.de> Does the centering parameter of ImageOps.fit() really work as intended (i.e. as described in the documentation)? # @param centering Control the cropping position. Use (0.5, 0.5) for # center cropping (e.g. if cropping the width, take 50% off of the # left side, and therefore 50% off the right side). (0.0, 0.0) # will crop from the top left corner (i.e. if cropping the width, # take all of the crop off of the right side, and if cropping the # height, take all of it off the bottom). (1.0, 0.0) will crop # from the bottom left corner, etc. (i.e. if cropping the width, # take all of the crop off the left side, and if cropping the height # take none from the top, and therefore all off the bottom). The relevant code should be (from ImageOps.py): bleedPixels = ( int((float(bleed) * float(image.size[0])) + 0.5), int((float(bleed) * float(image.size[1])) + 0.5) ) liveArea = ( bleedPixels[0], bleedPixels[1], image.size[0] - bleedPixels[0] - 1, image.size[1] - bleedPixels[1] - 1 ) ... # make the crop leftSide = int(liveArea[0] + (float(liveSize[0]-cropWidth) * centering[0])) if leftSide < 0: leftSide = 0 topSide = int(liveArea[1] + (float(liveSize[1]-cropHeight) * centering[1])) if topSide < 0: topSide = 0 So, liveArea[0] = bleedPixels[0] = bleed * image.size[0] should describe the border that is cropped (by default from left _and_ right). This works - independent from centering[0] - for the symmetric case. But leftSide will only be equal to liveArea[0] if either centering[0]==0 (which is _not_ the default case) or if liveSize[0]-cropWidth==0, which seems to be the case in all my examples. But the latter means that changing centering[0] does not have any effect on the cropped area (which is what I do indeed observe). So I wonder if I do not understand the documentation correctly or if the code does not really do what it should do ... Thanks for any hints Olaf From wrybread at gmail.com Fri Jul 30 18:33:12 2010 From: wrybread at gmail.com (Alec Bennett) Date: Fri, 30 Jul 2010 09:33:12 -0700 Subject: [Image-SIG] that's enough In-Reply-To: <4C52F87C.4000205@gmail.com> References: <4C52F87C.4000205@gmail.com> Message-ID: You didn't delete the periods that I put in to simulate indentations. On Fri, Jul 30, 2010 at 9:06 AM, donn wrote: > On 30/07/2010 17:48, Jack Uretsky wrote: > >> def__init__(self, parent, id): >> ^ >> SyntaxError: invalid syntax >> > I imagine the spacing in the email was not preserved, but even so, Python > is giving you a little arrow "^" to go look at.... > > def, SPACE, dunder-init... etc. > def __init... > > > \d > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aclark at aclark.net Sat Jul 31 08:52:25 2010 From: aclark at aclark.net (Alex Clark) Date: Sat, 31 Jul 2010 02:52:25 -0400 Subject: [Image-SIG] Pillow, the "friendly" PIL fork Message-ID: Hi all, I have been wanting to tackle this for sometime, and finally got around to it tonight. I've created a "friendly" fork of PIL called "Pillow": http://pypi.python.org/pypi/Pillow/1.0 Some background: I've been doing Plone development for the past 5 years or so, and PIL has always "been an issue". I won't get into what the issues are now, but I assume folks know them. By "friendly" fork, I mean, I don't wish any ill-will towards the author (thank you Fredrik, for such a wonderful package!), and developer community. I am just trying to gauge what the reaction to the fork will be, and if any progress can be made toward solving "the issues". (It's almost 3:00AM here, I will clarify further, I just wanted folks to be aware of my actions.) If nothing else, please consider this an experiment and/or educational endeavor. Looking forward to hearing everyone's thoughts, Alex -- Alex Clark ? http://aclark.net Author ? Plone 3.3 Site Administration ? http://aclark.net/admin From fetchinson at googlemail.com Sat Jul 31 16:29:51 2010 From: fetchinson at googlemail.com (Daniel Fetchinson) Date: Sat, 31 Jul 2010 16:29:51 +0200 Subject: [Image-SIG] Pillow, the "friendly" PIL fork In-Reply-To: References: Message-ID: > I have been wanting to tackle this for sometime, and finally got around to > it tonight. I've created a "friendly" fork of PIL called "Pillow": > http://pypi.python.org/pypi/Pillow/1.0 > > Some background: I've been doing Plone development for the past 5 years or > so, and PIL has always "been an issue". I won't get into what the issues are > now, but I assume folks know them. Well, I actually don't know what the "issues" are, but am very interested in hearing them! > By "friendly" fork, I mean, I don't wish any ill-will towards the author > (thank you Fredrik, for such a wonderful package!), and developer community. > I am just trying to gauge what the reaction to the fork will be, and if any > progress can be made toward solving "the issues". It would really be helpful for us if you described what "issues" you are aiming to solve. Without that I'm not even sure I'd like to spend too much time evaluating your fork. But if it turns out that you aim to tackle issues that I also have a problem with, I will surely give Pillow a try. Cheers, Daniel > (It's almost 3:00AM here, I will clarify further, I just wanted folks to be > aware of my actions.) > > If nothing else, please consider this an experiment and/or educational > endeavor. > > > > Looking forward to hearing everyone's thoughts, > > > > Alex > > > > > > -- > Alex Clark ? http://aclark.net > Author ? Plone 3.3 Site Administration ? http://aclark.net/admin > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -- Psss, psss, put it down! - http://www.cafepress.com/putitdown