From janssen at parc.com Mon Mar 1 04:44:20 2010 From: janssen at parc.com (Bill Janssen) Date: Sun, 28 Feb 2010 19:44:20 PST Subject: [Image-SIG] gamma bug present in PIL 1.1.7 Message-ID: <2599.1267415060@parc.com> The gamma bug detailed in http://www.4p8.com/eric.brasseur/gamma.html appears to be present in PIL 1.1.7. Bill From spe.stani.be at gmail.com Mon Mar 1 21:49:46 2010 From: spe.stani.be at gmail.com (Stani) Date: Mon, 1 Mar 2010 21:49:46 +0100 Subject: [Image-SIG] Radius bug with GaussianBlur In-Reply-To: References: Message-ID: <2078a7ad1003011249n1026bbap24f4dd2988b711e5@mail.gmail.com> Strange indeed. The same is true for UnsharpMask: class UnsharpMask(Filter): name = "UnsharpMask" def __init__(self, radius=2, percent=150, threshold=3): self.radius = 2 self.percent = percent self.threshold = threshold def filter(self, image): return image.unsharp_mask(self.radius, self.percent, self.threshold) http://svn.effbot.org/public/tags/pil-1.1.7a1-20090317/PIL/ImageFilter.py On Mon, Feb 22, 2010 at 4:38 PM, Tiberio Uricchio wrote: > Hi, > i just wanted to report a simple bug in ImageFilter.GaussianBlur: > > class GaussianBlur(Filter): > ? ?name = "GaussianBlur" > > ? ?def __init__(self, radius=2): > ? ? ? ?self.radius = 2 > > ? ?def filter(self, image): > ? ? ? ?return image.gaussian_blur(self.radius) > > As you can see, radius is always fixed at value 2 instead of using the > argument value. > > Tiberio > _______________________________________________ > 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 k.e.garsha at gmail.com Mon Mar 1 04:50:20 2010 From: k.e.garsha at gmail.com (Karl Garsha) Date: Sun, 28 Feb 2010 20:50:20 -0700 Subject: [Image-SIG] PIL 1.1.6 can't convert 16-bit (I; 16) to 8-bit ('L')--Windows 32-bit Message-ID: <9cd318911002281950o30f201d1ieb86ea99c498097b@mail.gmail.com> Greetings, I'm reading in a 16-bit monochrome image using PIL on windows and can't seem to work with the resulting image object. I've confirmed the image data is good..I can open and view it with ImageJ and the dimensions are correct. I'm using PIL 1.1.6 as part of the Enthought Python distribution...I'm stumped. I've appended relevant code I'm trying with my interpreter below: I'm hoping perhaps someone can help...I need to take 16-bit monochrome images (*.tiff in this case) and get them into 8-bit space...thanks in advance for any insight into what I can do to solve this. print im.mode,im.size I;16 (832, 656) print im.getextrema() None # this doesn't seem right....can PIL 1.1.6 apply this method to 16-bit unsigned int image objects? lut=[] len(lut) 0 for i in range (65536): lut.append(int(i/256)) len(lut) 65536 im3=im.point(lut,'L') Traceback (most recent call last): File "", line 1, in File "C:\Python26\lib\site-packages\PIL\Image.py", line 1109, in point return self._new(self.im.point(lut, mode)) ValueError: wrong number of lut entries -------------- next part -------------- An HTML attachment was scrubbed... URL: From cannon.el at gmail.com Tue Mar 2 17:37:11 2010 From: cannon.el at gmail.com (Laura & Edward Cannon) Date: Tue, 2 Mar 2010 08:37:11 -0800 Subject: [Image-SIG] PIL 1.1.6 can't convert 16-bit (I; 16) to 8-bit ('L')--Windows 32-bit In-Reply-To: <9cd318911002281950o30f201d1ieb86ea99c498097b@mail.gmail.com> References: <9cd318911002281950o30f201d1ieb86ea99c498097b@mail.gmail.com> Message-ID: How I would convert the image is im.convert("L") I have had success using this method for a variety of less common formats, and it handles all the conversion for you. Edward On Sun, Feb 28, 2010 at 7:50 PM, Karl Garsha wrote: > Greetings, > > I'm reading in a 16-bit monochrome image using PIL on windows and can't seem > to work with the resulting image object. > > I've confirmed the image data is good..I can open and view it with ImageJ > and the dimensions are correct. > > I'm using PIL 1.1.6 as part of the Enthought Python distribution...I'm > stumped. I've appended relevant code I'm trying with my interpreter below: > > I'm hoping perhaps someone can help...I need to take 16-bit monochrome > images (*.tiff in this case) and get them into 8-bit space...thanks in > advance for any insight into what I can do to solve this. > > print im.mode,im.size > I;16 (832, 656) > > print im.getextrema() > None # this doesn't seem right....can PIL 1.1.6 apply this method to 16-bit > unsigned int image objects? > > lut=[] > len(lut) > 0 > for i in range (65536): > ??? lut.append(int(i/256)) > > len(lut) > 65536 > > im3=im.point(lut,'L') > Traceback (most recent call last): > ? File "", line 1, in > ? File "C:\Python26\lib\site-packages\PIL\Image.py", line 1109, in point > ??? return self._new(self.im.point(lut, mode)) > ValueError: wrong number of lut entries > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From fredrik at pythonware.com Tue Mar 2 22:42:12 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 2 Mar 2010 22:42:12 +0100 Subject: [Image-SIG] PIL 1.1.6 can't convert 16-bit (I; 16) to 8-bit ('L')--Windows 32-bit In-Reply-To: <9cd318911002281950o30f201d1ieb86ea99c498097b@mail.gmail.com> References: <9cd318911002281950o30f201d1ieb86ea99c498097b@mail.gmail.com> Message-ID: <368a5cd51003021342p492772aap42f38f69139c10d4@mail.gmail.com> PIL has very limited support for the I;16 and I;16L modes; it's usually best to convert them to mode I (or F) and move on from there. Try doing: im = im.convert("I") before applying getextrema and point(lut, "L") to the image. On Mon, Mar 1, 2010 at 4:50 AM, Karl Garsha wrote: > Greetings, > > I'm reading in a 16-bit monochrome image using PIL on windows and can't seem > to work with the resulting image object. > > I've confirmed the image data is good..I can open and view it with ImageJ > and the dimensions are correct. > > I'm using PIL 1.1.6 as part of the Enthought Python distribution...I'm > stumped. I've appended relevant code I'm trying with my interpreter below: > > I'm hoping perhaps someone can help...I need to take 16-bit monochrome > images (*.tiff in this case) and get them into 8-bit space...thanks in > advance for any insight into what I can do to solve this. > > print im.mode,im.size > I;16 (832, 656) > > print im.getextrema() > None # this doesn't seem right....can PIL 1.1.6 apply this method to 16-bit > unsigned int image objects? > > lut=[] > len(lut) > 0 > for i in range (65536): > ??? lut.append(int(i/256)) > > len(lut) > 65536 > > im3=im.point(lut,'L') > Traceback (most recent call last): > ? File "", line 1, in > ? File "C:\Python26\lib\site-packages\PIL\Image.py", line 1109, in point > ??? return self._new(self.im.point(lut, mode)) > ValueError: wrong number of lut entries > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From olt at bogosoft.com Thu Mar 4 14:31:02 2010 From: olt at bogosoft.com (Oliver Tonnhofer) Date: Thu, 4 Mar 2010 14:31:02 +0100 Subject: [Image-SIG] PIL PNG encoding performance Message-ID: <83CEF932-7548-4BD9-91CA-1CB6F1078BE1@bogosoft.com> Hi, I found out that the default PNG(ZIP) encoding options do not offer the best performance and output sizes. At least for "vector" images like street maps. I changed the options of deflateInit2 in ZipEncode.c and tested the performance of Z_FILTERED, Z_DEFAULT_STRATEGY, Z_HUFFMAN_ONLY and Z_RLE and I tested different compression levels for some of the strategies. I found out that Z_RLE offers the best performance while offering good compression, at least for my test image. I tested with timeit. ----- t = timeit.Timer("img.save('/dev/null', 'png')", "import Image; img = Image.open('test.png')") print name, min(t.repeat(3, 10)), ----- Here are my raw results, together with the resulting file size. default0 is the Z_DEFAULT_STRATEGY with compression level 0, etc. default 0.785417079926 296276 default0 0.171308040619 974861 default1 0.356842041016 323340 default3 0.441128969193 310072 default5 0.562795162201 298403 default7 0.990942001343 295061 default9 7.42386984825 289238 huffman 0.482778072357 409161 huffman1 0.450232982635 409161 filtered 0.821682929993 307535 filtered1 0.360295057297 323340 rle 0.341444015503 307691 For comparison the same tests as JPEG with different quality levels. jpeg 0.515193939209 181315 jpeg85 0.553126096725 243813 jpeg90 0.587316989899 305299 jpeg95 0.649972915649 431085 jpeg98 0.728760004044 602096 jpeg99 0.771711111069 718724 I really would like to have more options in Image.save to choose different compression levels/strategies. I would like to add that to PIL and have some questions on how to add that. At the moment save for PNG accepts only the `optimize` option which enables the best/slowest compression level (9). I think it would be bad for backwards compatibility to use this option to set the actual compression level. What about compress_level and compress_type for the options? I would add constants for the types in Image.py. Any opinions or suggestions on that? I would do a fork on bitbucket then and start hacking. Regards, Oliver From olt at bogosoft.com Fri Mar 5 11:23:23 2010 From: olt at bogosoft.com (Oliver Tonnhofer) Date: Fri, 5 Mar 2010 11:23:23 +0100 Subject: [Image-SIG] PIL PNG encoding performance In-Reply-To: <83CEF932-7548-4BD9-91CA-1CB6F1078BE1@bogosoft.com> References: <83CEF932-7548-4BD9-91CA-1CB6F1078BE1@bogosoft.com> Message-ID: On 04.03.2010, at 14:31, Oliver Tonnhofer wrote: > Any opinions or suggestions on that? I would do a fork on bitbucket > then and start hacking. Ok, I just started :) I added compress_level and compress_type as save options for png files. The default behaviour is identical to 1.1.7. Anyone care to review? http://bitbucket.org/olt/pil-117/changeset/8d4661695edd/ I load the ZLIB constants (Z_RLE, etc) into the _imaging module and then into Image. I'm not sure if that's OK, or if I should create some new constant values. I did not prefix the constants, but maybe it is time to start with it. BILINEAR, RLE, FLOYDSTEINBERG, ADAPTIVE, ... it's getting a bit confusing. Regards, Oliver From marc.haberkorn at gmail.com Sat Mar 6 19:57:57 2010 From: marc.haberkorn at gmail.com (Marc Haberkorn) Date: Sat, 6 Mar 2010 13:57:57 -0500 Subject: [Image-SIG] Problem w/ .jpg on Windows Message-ID: Hello all, I'm using PIL 1.1.7 on Windows XP. You can see in the following code that I am unable to open .jpg files. I AM able to open .png files, but not .jpg. I've also copied the output of selftest.py to show that .jpg shows as being setup properly. Can anyone suggest a next step to resolve this problem? Thank you! C:\WINDOWS>python Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import Image >>> i = Image.open('c:\\25.jpg') Traceback (most recent call last): File "", line 1, in File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1980, in open raise IOError("cannot identify image file") IOError: cannot identify image file >>> C:\temp\PIL\Imaging-1.1.7>python selftest.py -------------------------------------------------------------------- PIL 1.1.7 TEST SUMMARY -------------------------------------------------------------------- Python modules loaded from .\PIL Binary modules loaded from c:\python25\lib\site-packages\PIL -------------------------------------------------------------------- *** PIL CORE support not installed *** TKINTER support not installed --- JPEG support ok --- ZLIB (PNG/ZIP) support ok *** FREETYPE2 support not installed *** LITTLECMS support not installed -------------------------------------------------------------------- Running selftest: --- 57 tests passed. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik at pythonware.com Thu Mar 11 14:46:07 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 11 Mar 2010 14:46:07 +0100 Subject: [Image-SIG] Problem w/ .jpg on Windows In-Reply-To: References: Message-ID: <368a5cd51003110546s5adb30dawcd219149d26b77e@mail.gmail.com> Is this a prebuilt version or something you built yourself? It might be that the selftest picks a different PYD file than your stand-alone script. Adding "print Image.core" to your test script will tell you what version the script is picking up; compare that to the "loaded from" lines in the test output to see if you're using the same version. On Sat, Mar 6, 2010 at 7:57 PM, Marc Haberkorn wrote: > Hello all, > > I'm using PIL 1.1.7 on Windows XP. > > You can see in the following code that I am unable to open .jpg files.? I AM > able to open .png files, but not .jpg.? I've also copied the output of > selftest.py to show that .jpg shows as being setup properly.? Can anyone > suggest a next step to resolve this problem? > > Thank you! > > C:\WINDOWS>python > Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] > on win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> import Image >>>> i = Image.open('c:\\25.jpg') > Traceback (most recent call last): > ? File "", line 1, in > ? File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1980, in open > ??? raise IOError("cannot identify image file") > IOError: cannot identify image file >>>> > > C:\temp\PIL\Imaging-1.1.7>python selftest.py > -------------------------------------------------------------------- > PIL 1.1.7 TEST SUMMARY > -------------------------------------------------------------------- > Python modules loaded from .\PIL > Binary modules loaded from c:\python25\lib\site-packages\PIL > -------------------------------------------------------------------- > *** PIL CORE support not installed > *** TKINTER support not installed > --- JPEG support ok > --- ZLIB (PNG/ZIP) support ok > *** FREETYPE2 support not installed > *** LITTLECMS support not installed > -------------------------------------------------------------------- > Running selftest: > --- 57 tests passed. > > > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From fredrik at pythonware.com Thu Mar 11 14:49:39 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 11 Mar 2010 14:49:39 +0100 Subject: [Image-SIG] PIL PNG encoding performance In-Reply-To: References: <83CEF932-7548-4BD9-91CA-1CB6F1078BE1@bogosoft.com> Message-ID: <368a5cd51003110549n6d8cdde8ob994ccf055866e39@mail.gmail.com> On Fri, Mar 5, 2010 at 11:23 AM, Oliver Tonnhofer wrote: > > On 04.03.2010, at 14:31, Oliver Tonnhofer wrote: >> >> Any opinions or suggestions on that? I would do a fork on bitbucket then >> and start hacking. > > Ok, I just started :) > I added compress_level and compress_type as save options for png files. The > default behaviour is identical to 1.1.7. > > Anyone care to review? > http://bitbucket.org/olt/pil-117/changeset/8d4661695edd/ Thanks. I'll take a look when I find the time (and borrow the code if that's fine with you). > I load the ZLIB constants (Z_RLE, etc) into the _imaging module and then > into Image. I'm not sure if that's OK, or if I should create some new > constant values. > > I did not prefix the constants, but maybe it is time to start with it. > BILINEAR, RLE, FLOYDSTEINBERG, ADAPTIVE, ... it's getting a bit confusing. Well, they all have the "Image." prefix :) Not sure somewhat specialized encoder-specific settings should live in that namespace, though; might be better to put them in the codec module itself. I'll think of something. From fredrik at pythonware.com Thu Mar 11 14:53:42 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 11 Mar 2010 14:53:42 +0100 Subject: [Image-SIG] Bug Report: PIL font management clipping tops of characters (addendum) In-Reply-To: <7F24AB15-5A47-47A8-B777-B5D1E20EE93B@nasa.gov> References: <7F24AB15-5A47-47A8-B777-B5D1E20EE93B@nasa.gov> Message-ID: <368a5cd51003110553q3081fe2l9e4bd61930723d66@mail.gmail.com> Some issues related to this were fixed in 1.1.7, but there are apparently a few more things that can go wrong. Some of this is caused by semi-weird font metrics in some truetype files; the internal API relies on being able to determine a pixel-level bounding box before rendering, and it's likely that we have to change that to make this work for all cases & fonts. On Fri, Feb 26, 2010 at 3:06 PM, Bridgman, William T. wrote: > Also happens with > Python 2.5.1 (Mac OS X 10.5.+), PIL 1.1.7 > > This happens with at least > Python 2.4 (LInux) PIL 1.1.6 > Python 2.6 (Mac OS X 10.5.+), PIL 1.1.6 > > Release notes for 1.1.7 suggest something like this might have been fixed in > 1.1.6b1 but no clear indication in 1.1.7. > > Tom > -- > Dr. William T."Tom" Bridgman ? ? ? ? ? ? ? Scientific Visualization Studio > Global Science & Technology, Inc. ? ? ? ? ?NASA/Goddard Space Flight Center > Email: William.T.Bridgman at nasa.gov ? ? ? ? Code 610.3 > Phone: 301-286-1346 ? ? ? ? ? ? ? ? ? ? ? ?Greenbelt, MD 20771 > FAX: ? 301-286-1634 ? ? ? ? ? ? ? ? ? ? ? ?http://svs.gsfc.nasa.gov/ > > > > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From olt at bogosoft.com Thu Mar 11 14:59:31 2010 From: olt at bogosoft.com (Oliver Tonnhofer) Date: Thu, 11 Mar 2010 14:59:31 +0100 Subject: [Image-SIG] PIL PNG encoding performance In-Reply-To: <368a5cd51003110549n6d8cdde8ob994ccf055866e39@mail.gmail.com> References: <83CEF932-7548-4BD9-91CA-1CB6F1078BE1@bogosoft.com> <368a5cd51003110549n6d8cdde8ob994ccf055866e39@mail.gmail.com> Message-ID: <7C8C7C6E-33F1-44E8-BC05-384107EF33A8@bogosoft.com> On 11.03.2010, at 14:49, Fredrik Lundh wrote: > On Fri, Mar 5, 2010 at 11:23 AM, Oliver Tonnhofer > wrote: >> Anyone care to review? >> http://bitbucket.org/olt/pil-117/changeset/8d4661695edd/ > > Thanks. I'll take a look when I find the time (and borrow the code if > that's fine with you). Sure. Do whatever you want, these changesets are CC0. Regards, Oliver From fredrik at pythonware.com Thu Mar 11 15:38:25 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 11 Mar 2010 15:38:25 +0100 Subject: [Image-SIG] ImageStat silent convert In-Reply-To: References: Message-ID: <368a5cd51003110638v5d9f959ei2abd605301b6b047@mail.gmail.com> Sounds like a bug. What does the getextrema() method return for the same image? On Wed, Feb 17, 2010 at 6:57 AM, Laura & Edward Cannon wrote: > while using PIL 1.16 recently, I noticed that ImageStat seems to do a > silent convert to mode L when given a mode F image. Looping though the > image manually using the im.load() access object gives me a different > maximum than ImageStat.Stat(im).extrema. Is this intentional? it > doesn't seem to be documented. Is it perhaps been fixed? > Edward > Unicorn School > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From cannon.el at gmail.com Fri Mar 12 05:01:08 2010 From: cannon.el at gmail.com (Laura & Edward Cannon) Date: Thu, 11 Mar 2010 20:01:08 -0800 Subject: [Image-SIG] ImageStat silent convert In-Reply-To: <368a5cd51003110638v5d9f959ei2abd605301b6b047@mail.gmail.com> References: <368a5cd51003110638v5d9f959ei2abd605301b6b047@mail.gmail.com> Message-ID: getextrema() returns the correct values, seems like the problem is just in the ImageStat code. Edward Unicorn School On Thu, Mar 11, 2010 at 6:38 AM, Fredrik Lundh wrote: > Sounds like a bug. ?What does the getextrema() method return for the same image? > > > > On Wed, Feb 17, 2010 at 6:57 AM, Laura & Edward Cannon > wrote: >> while using PIL 1.16 recently, I noticed that ImageStat seems to do a >> silent convert to mode L when given a mode F image. Looping though the >> image manually using the im.load() access object gives me a different >> maximum than ImageStat.Stat(im).extrema. Is this intentional? it >> doesn't seem to be documented. Is it perhaps been fixed? >> Edward >> Unicorn School >> _______________________________________________ >> Image-SIG maillist ?- ?Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > From edward at unicornschool.org Sun Mar 14 03:40:53 2010 From: edward at unicornschool.org (Edward Cannon) Date: Sat, 13 Mar 2010 18:40:53 -0800 Subject: [Image-SIG] window 7 and PIL 1.1.7 Message-ID: I just got a new windows 7 machine. I installed python 2.6 and it works just fine. I downloaded the PIL 1.1.7 installer and I get the following error "python 2.6 required, which was not found in the registry." Any ideas? Edward Unicorn School From ecormier137 at googlemail.com Sun Mar 14 10:39:31 2010 From: ecormier137 at googlemail.com (Ed Cormier) Date: Sun, 14 Mar 2010 09:39:31 +0000 Subject: [Image-SIG] window 7 and PIL 1.1.7 In-Reply-To: References: Message-ID: <4B9CAED3.2060706@googlemail.com> If I remember rightly, you need to add a link to python.exe to your PATH variable. Try Start Icon -> Right click on "Computer" and go to Advanced System Settings. Then go to "Environment Variables" on the Advanced Tab. Find "Path" in the list of system variables at the bottom and add a link to the python.exe file at the end. Hope you find it. Another Edward. > I just got a new windows 7 machine. I installed python 2.6 and it > works just fine. I downloaded the PIL 1.1.7 installer and I get the > following error "python 2.6 required, which was not found in the > registry." Any ideas? > Edward > Unicorn School > > From fredrik at pythonware.com Sun Mar 14 14:47:56 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 14 Mar 2010 14:47:56 +0100 Subject: [Image-SIG] window 7 and PIL 1.1.7 In-Reply-To: References: Message-ID: <368a5cd51003140647q5a7df3d3s53e72722a620d77e@mail.gmail.com> 32-bit or 64-bit Windows 7 (and Python)? The PythonWare builds are all 32-bit. PIL uses the standard Python binary installers, so you might want to look for solutions in other Python forums as well. And if nothing else helps, there's always this: http://effbot.org/zone/python-register.htm (which may or may not do the right thing on Windows 7; haven't tested, but I seem to remember that people have used it successfully on Vista) On Sun, Mar 14, 2010 at 3:40 AM, Edward Cannon wrote: > I just got a new windows 7 machine. I installed python 2.6 and it > works just fine. I downloaded the PIL 1.1.7 installer and I get the > following error "python 2.6 required, which was not found in the > registry." Any ideas? > Edward > Unicorn School > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From fredrik at pythonware.com Sun Mar 14 14:59:49 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 14 Mar 2010 14:59:49 +0100 Subject: [Image-SIG] window 7 and PIL 1.1.7 In-Reply-To: <368a5cd51003140647q5a7df3d3s53e72722a620d77e@mail.gmail.com> References: <368a5cd51003140647q5a7df3d3s53e72722a620d77e@mail.gmail.com> Message-ID: <368a5cd51003140659j790fbe46j8b1003bfd37ff52d@mail.gmail.com> On Sun, Mar 14, 2010 at 2:47 PM, Fredrik Lundh wrote: > 32-bit or 64-bit Windows 7 (and Python)? ?The PythonWare builds are all 32-bit. At this time, at least -- I'm looking into ways to get 64-bit builds into the normal workflow. In the meantime, contributions are welcome (that's true for Mac OS X builds too). (does anyone here know what happened to that Python build farm they were working on some time back, btw?) From edward at unicornschool.org Mon Mar 15 00:20:29 2010 From: edward at unicornschool.org (Edward Cannon) Date: Sun, 14 Mar 2010 16:20:29 -0700 Subject: [Image-SIG] window 7 and PIL 1.1.7 In-Reply-To: <368a5cd51003140659j790fbe46j8b1003bfd37ff52d@mail.gmail.com> References: <368a5cd51003140647q5a7df3d3s53e72722a620d77e@mail.gmail.com> <368a5cd51003140659j790fbe46j8b1003bfd37ff52d@mail.gmail.com> Message-ID: 64 bit Windows and Python, that might be the problem. I did try the register python script, it seemed to think there was a python version installed (there is), and therefore did not help. I will look around for 64 bit builds or see what I can do. Edward On Sun, Mar 14, 2010 at 6:59 AM, Fredrik Lundh wrote: > On Sun, Mar 14, 2010 at 2:47 PM, Fredrik Lundh wrote: >> 32-bit or 64-bit Windows 7 (and Python)? ?The PythonWare builds are all 32-bit. > > At this time, at least -- I'm looking into ways to get 64-bit builds > into the normal workflow. ?In the meantime, contributions are welcome > (that's true for Mac OS X builds too). > > (does anyone here know what happened to that Python build farm they > were working on some time back, btw?) > > > From Thomash04 at hotmail.co.uk Tue Mar 16 11:15:44 2010 From: Thomash04 at hotmail.co.uk (thomas1984) Date: Tue, 16 Mar 2010 03:15:44 -0700 (PDT) Subject: [Image-SIG] Desperate GUI Help Please!! Message-ID: <27915646.post@talk.nabble.com> Hello, I need to make a GUI which has a fixed window size approx 390 (width) X 6020 (height) It needs to have a fileMenu containing "File" "About" "Exit". In the "file" menu it needs a menuItem called "new route". When you click on "new route" it needs to display a new window with a listBox.. When a user selects an item from the list box and clicks OK - it should pass this value to the original window. The difficulty here is that the main body of the GUI window, needs to display an image BUT it needs to be an image that is able to be drawed on. Below is my code for drawing on the image....... It is an EXAMPLE - but i need it like this i.e. by importing the ImageDraw library. # Do the proper imports for this script from Tkinter import * import os, sys import Image import ImageDraw # Load the image try: im = Image.open("C:\Documents and Settings\Administrator\Desktop\mm.gif") except: print "Unable to load image" exit(1) # Get a drawing surface for the image draw = ImageDraw.Draw(im) # Draw the circle #draw.ellipse((0,0)+im.size) # Draw the line #draw.line((0,0)+im.size) # and show off the result draw.line((0, 0) + (0,55), fill=000, width=22) draw.text((50, 50), "hey") im.show() Below is my code for the list box example...... from Tkinter import * class ListBoxTest : def __init__(self) : self.root = Tk() self.list_box_1 = Listbox(self.root) self.list_box_1.pack() self.delete_button = Button(self.root, text="Delete", command=self.DeleteSelection) self.delete_button.pack() def DeleteSelection(self) : items = self.list_box_1.curselection() pos = 0 for i in items : idx = int(i) - pos self.list_box_1.delete( idx,idx ) pos = pos + 1 def Show(self) : for i in range(0, 10) : s = "Item " + str(i) self.list_box_1.insert( END,s ) self.root.mainloop() lbt=ListBoxTest() lbt.Show() Below is my code for the Canvas and Window BUT the canvas does not hold an image I have drew on........ from Tkinter import * class AppUI(Frame): def __init__(self, master=None): Frame.__init__(self, master, relief=SUNKEN, bd=2) self.menubar = Menu(self) menu = Menu(self.menubar, tearoff=0) self.menubar.add_cascade(label="File", menu=menu) menu.add_command(label="New") menu = Menu(self.menubar, tearoff=0) self.menubar.add_cascade(label="Edit", menu=menu) menu.add_command(label="Cut") menu.add_command(label="Copy") menu.add_command(label="Paste") try: self.master.config(menu=self.menubar) except AttributeError: # master is a toplevel window (Python 1.4/Tkinter 1.63) self.master.tk.call(master, "config", "-menu", self.menubar) canvas = Canvas(width = 300, height = 200, bg = 'white') canvas.pack(expand = YES, fill = BOTH) gif1 = PhotoImage(file = 'mm.gif') canvas.create_image(50, 10, image = gif1, anchor = NW) canvas.pack() root = Tk() app = AppUI(root) app.pack() root.mainloop() ---- Is there anyone here who can put these elements together and maybe make this GUI for me? I'm really stuck and as you can see by the code examples I have gave this a shot, but I don't know how to finish it off - If someone can do this for me - it would be great as I can look at the code and learn. -- View this message in context: http://old.nabble.com/Desperate-GUI-Help-Please%21%21-tp27915646p27915646.html Sent from the Python - image-sig mailing list archive at Nabble.com. From fredrik at pythonware.com Tue Mar 16 16:26:11 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 16 Mar 2010 16:26:11 +0100 Subject: [Image-SIG] Desperate GUI Help Please!! In-Reply-To: <27915646.post@talk.nabble.com> References: <27915646.post@talk.nabble.com> Message-ID: <368a5cd51003160826m787f215co9a49ba9ef992281a@mail.gmail.com> The Tkinter toolkit comes with a canvas widget that's probably a better choice for the drawing parts of your application. Tkinter itself is a bit outside the scope for this mailing list; you'll probably have more luck on the tkinter-discuss list: http://mail.python.org/mailman/listinfo/tkinter-discuss or in the main Python forum. On Tue, Mar 16, 2010 at 11:15 AM, thomas1984 wrote: > > Hello, > > I need to make a GUI which has a fixed window size approx 390 (width) X 6020 > (height) > > It needs to have a fileMenu containing "File" "About" "Exit". In the "file" > menu it needs a menuItem called "new route". > > When you click on "new route" it needs to display a new window with a > listBox.. When a user selects an item from the list box and clicks OK - it > should pass this value to the original window. > > The difficulty here is that the main body of the GUI window, needs to > display an image BUT it needs to be an image that is able to be drawed on. > > Below is my code for drawing on the image....... It is an EXAMPLE - but i > need it like this i.e. by importing the ImageDraw library. > > # Do the proper imports for this script > from Tkinter import * > import os, sys > import Image > import ImageDraw > # Load the image > try: > im = Image.open("C:\Documents and Settings\Administrator\Desktop\mm.gif") > except: > print "Unable to load image" > exit(1) > # Get a drawing surface for the image > draw = ImageDraw.Draw(im) > # Draw the circle > #draw.ellipse((0,0)+im.size) > # Draw the line > #draw.line((0,0)+im.size) > # and show off the result > draw.line((0, 0) + (0,55), fill=000, width=22) > draw.text((50, 50), "hey") > im.show() > > Below is my code for the list box example...... > > from Tkinter import * > class ListBoxTest : > def __init__(self) : > self.root = Tk() > self.list_box_1 = Listbox(self.root) > self.list_box_1.pack() > self.delete_button = Button(self.root, text="Delete", > command=self.DeleteSelection) > self.delete_button.pack() > def DeleteSelection(self) : > items = self.list_box_1.curselection() > pos = 0 > for i in items : > idx = int(i) - pos > self.list_box_1.delete( idx,idx ) > pos = pos + 1 > def Show(self) : > for i in range(0, 10) : > s = "Item " + str(i) > self.list_box_1.insert( END,s ) > self.root.mainloop() > lbt=ListBoxTest() > lbt.Show() > > > Below is my code for the Canvas and Window BUT the canvas does not hold an > image I have drew on........ > > from Tkinter import * > > class AppUI(Frame): > > def __init__(self, master=None): > Frame.__init__(self, master, relief=SUNKEN, bd=2) > > self.menubar = Menu(self) > > menu = Menu(self.menubar, tearoff=0) > self.menubar.add_cascade(label="File", menu=menu) > menu.add_command(label="New") > > menu = Menu(self.menubar, tearoff=0) > self.menubar.add_cascade(label="Edit", menu=menu) > menu.add_command(label="Cut") > menu.add_command(label="Copy") > menu.add_command(label="Paste") > > try: > self.master.config(menu=self.menubar) > except AttributeError: > # master is a toplevel window (Python 1.4/Tkinter 1.63) > self.master.tk.call(master, "config", "-menu", self.menubar) > > canvas = Canvas(width = 300, height = 200, bg = 'white') > canvas.pack(expand = YES, fill = BOTH) > > gif1 = PhotoImage(file = 'mm.gif') > canvas.create_image(50, 10, image = gif1, anchor = NW) > canvas.pack() > > root = Tk() > > app = AppUI(root) > app.pack() > > root.mainloop() > > > ---- Is there anyone here who can put these elements together and maybe make > this GUI for me? I'm really stuck and as you can see by the code examples I > have gave this a shot, but I don't know how to finish it off - If someone > can do this for me - it would be great as I can look at the code and learn. > -- > View this message in context: http://old.nabble.com/Desperate-GUI-Help-Please%21%21-tp27915646p27915646.html > Sent from the Python - image-sig mailing list archive at Nabble.com. > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From clive at evclose.freeserve.co.uk Sat Mar 20 21:10:37 2010 From: clive at evclose.freeserve.co.uk (clive sinclair) Date: Sat, 20 Mar 2010 20:10:37 +0000 Subject: [Image-SIG] PIL Fonts Message-ID: <4BA52BBD.10901@evclose.freeserve.co.uk> I am running Python 2.6 and have just installed PIL 1.1.7 running on Win 2000. When I try to get a font object eg by font = ImageFont.truetype("C:\WINNT\Fonts\arial.ttf", 15) I get an exception File "C:\Python26\lib\site-packages\PIL\ImageFont.py", line 134, in __init__ self.font = core.getfont(file, size, index, encoding) IOError: cannot open resource. Looking into Class FreeTypeFont I see that _imagingft service is required. This file is present in C:\Python26\Lib\site-packages\PIL. Should this file be installed during the Python2.6 setup? What should I do to fix this problem? I had basically the same problem with PIL 1.1.6. C Sinclair From fredrik at pythonware.com Sat Mar 20 21:53:00 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat, 20 Mar 2010 21:53:00 +0100 Subject: [Image-SIG] PIL Fonts In-Reply-To: <4BA52BBD.10901@evclose.freeserve.co.uk> References: <4BA52BBD.10901@evclose.freeserve.co.uk> Message-ID: <368a5cd51003201353u58c14a3fjec0b4eee26222100@mail.gmail.com> On Sat, Mar 20, 2010 at 9:10 PM, clive sinclair wrote: > I am running Python 2.6 and have just installed PIL 1.1.7 running on Win > 2000. > > When I try to get a font object eg by > font = ImageFont.truetype("C:\WINNT\Fonts\arial.ttf", 15) > I get an exception > ?File "C:\Python26\lib\site-packages\PIL\ImageFont.py", line 134, in > __init__ > ? ?self.font = core.getfont(file, size, index, encoding) > IOError: cannot open resource. > > Looking into Class FreeTypeFont I see that _imagingft service is required. > This file is present in C:\Python26\Lib\site-packages\PIL. > Should this file be installed during the Python2.6 setup? What should I do > to fix this problem? I had basically the same problem with PIL 1.1.6. Python interprets the "\a" in your string as a control character: >>> "C:\WINNT\Fonts\arial.ttf" 'C:\\WINNT\\Fonts\x07rial.ttf' See http://docs.python.org/reference/lexical_analysis.html#string-literals for a list of such escape codes. To fix this, use forward slashes (they work on both Unix and Windows), double the backslashes, or use "raw" strings. Your favourite Python tutorial should have more information on how to work with file names. From janssen at parc.com Sat Mar 20 23:13:10 2010 From: janssen at parc.com (Bill Janssen) Date: Sat, 20 Mar 2010 15:13:10 PDT Subject: [Image-SIG] language lawyer needed: PIL fails on Adobe Illustrator EPS... Message-ID: <52453.1269123190@parc.com> I think I need a language lawyer. I'm finding that PIL 1.1.7 can't import EPS files output by Adobe Illustrator. It chokes on the following sequence of lines in the header: %!PS-Adobe-3.0 EPSF-3.0 %%Creator: Adobe Illustrator(R) 8.0 %%AI8_CreatorVersion: 13.0.0 %%For: (Administrator) () %%CreationDate: 8/20/2008 6:47 PM %%BoundingBox: 0 0 2801 2801 %%HiResBoundingBox: 0 0 2800.5 2800.5 %%DocumentProcessColors: Cyan Magenta Yellow Black %%DocumentSuppliedResources: procset Adobe_level2_AI5 1.2 0 %%+ procset AGM_Gradient 1.0 0 %%+ procset Adobe_ColorImage_AI6 1.3 0 %%+ procset Adobe_Illustrator_AI5 1.3 0 %%+ procset Adobe_pattern_AI5 1.0 0 %%+ procset Adobe_cshow 2.0 8 %%+ procset Adobe_shading_AI8 1.0 0 %AI5_FileFormat 4.0 %AI3_ColorUsage: Color %AI3_IncludePlacedImages [...] When I look at it with pdb, the problem seems to be the %AI5 and %AI3 lines -- they don't match the header line template, though I believe they are valid Postscript comments: (Pdb) !Image.open("/project/uplib/samples/postscript/badfoo.eps") !Image.open("/project/uplib/samples/postscript/badfoo.eps") *** IOError: bad EPS header (Pdb) l 201 if k[:8] == "PS-Adobe": 202 self.info[k[:8]] = k[9:] 203 else: 204 self.info[k] = "" 205 else: 206 -> raise IOError, "bad EPS header" 207 208 s = fp.readline() 209 210 if s[:1] != "%": 211 break (Pdb) p s '%AI3_ColorUsage: Color' (Pdb) field <_sre.SRE_Pattern object at 0x4798a0> (Pdb) field.match(s) (Pdb) ^D So, are Postscript comments allowed in the DSC headers? That is, is this a PIL bug or an Illustrator bug. Bill From fredrik at pythonware.com Sun Mar 21 16:54:19 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 21 Mar 2010 16:54:19 +0100 Subject: [Image-SIG] language lawyer needed: PIL fails on Adobe Illustrator EPS... In-Reply-To: <52453.1269123190@parc.com> References: <52453.1269123190@parc.com> Message-ID: <368a5cd51003210854y7887a3ebi6cee7bf1b3a3f6f0@mail.gmail.com> Haven't checked the DSC spec in ages, but given your observation, it'd probably make sense to skip all non-DSC comments no matter what the spec actually says. Can you provide a patch (or a sample file)? On Sat, Mar 20, 2010 at 11:13 PM, Bill Janssen wrote: > I think I need a language lawyer. ?I'm finding that PIL 1.1.7 can't > import EPS files output by Adobe Illustrator. ?It chokes on the > following sequence of lines in the header: > > %!PS-Adobe-3.0 EPSF-3.0 > %%Creator: Adobe Illustrator(R) 8.0 > %%AI8_CreatorVersion: 13.0.0 > %%For: (Administrator) () > %%CreationDate: 8/20/2008 6:47 PM > %%BoundingBox: 0 0 2801 2801 > %%HiResBoundingBox: 0 0 2800.5 2800.5 > %%DocumentProcessColors: Cyan Magenta Yellow Black > %%DocumentSuppliedResources: procset Adobe_level2_AI5 1.2 0 > %%+ procset AGM_Gradient 1.0 0 > %%+ procset Adobe_ColorImage_AI6 1.3 0 > %%+ procset Adobe_Illustrator_AI5 1.3 0 > %%+ procset Adobe_pattern_AI5 1.0 0 > %%+ procset Adobe_cshow 2.0 8 > %%+ procset Adobe_shading_AI8 1.0 0 > %AI5_FileFormat 4.0 > %AI3_ColorUsage: Color > %AI3_IncludePlacedImages > [...] > > When I look at it with pdb, the problem seems to be the %AI5 and %AI3 > lines -- they don't match the header line template, though I believe > they are valid Postscript comments: > > (Pdb) !Image.open("/project/uplib/samples/postscript/badfoo.eps") > !Image.open("/project/uplib/samples/postscript/badfoo.eps") > *** IOError: bad EPS header > (Pdb) l > 201 ? ? ? ? ? ? ? ? ? ? ? ? if k[:8] == "PS-Adobe": > 202 ? ? ? ? ? ? ? ? ? ? ? ? ? ? self.info[k[:8]] = k[9:] > 203 ? ? ? ? ? ? ? ? ? ? ? ? else: > 204 ? ? ? ? ? ? ? ? ? ? ? ? ? ? self.info[k] = "" > 205 ? ? ? ? ? ? ? ? ? ? else: > 206 ?-> ? ? ? ? ? ? ? ? ? ? raise IOError, "bad EPS header" > 207 > 208 ? ? ? ? ? ? ? ? s = fp.readline() > 209 > 210 ? ? ? ? ? ? ? ? if s[:1] != "%": > 211 ? ? ? ? ? ? ? ? ? ? break > (Pdb) p s > '%AI3_ColorUsage: Color' > (Pdb) field > <_sre.SRE_Pattern object at 0x4798a0> > (Pdb) field.match(s) > (Pdb) ^D > > So, are Postscript comments allowed in the DSC headers? ?That is, is > this a PIL bug or an Illustrator bug. > > Bill > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From janssen at parc.com Sun Mar 21 19:14:02 2010 From: janssen at parc.com (Bill Janssen) Date: Sun, 21 Mar 2010 11:14:02 PDT Subject: [Image-SIG] language lawyer needed: PIL fails on Adobe Illustrator EPS... In-Reply-To: <368a5cd51003210854y7887a3ebi6cee7bf1b3a3f6f0@mail.gmail.com> References: <52453.1269123190@parc.com> <368a5cd51003210854y7887a3ebi6cee7bf1b3a3f6f0@mail.gmail.com> Message-ID: <55032.1269195242@parc.com> Fredrik Lundh wrote: > Haven't checked the DSC spec in ages, but given your observation, it'd > probably make sense to skip all non-DSC comments no matter what the > spec actually says. Yes, I agree. > Can you provide a patch (or a sample file)? Yes, I think so. Bill From janssen at parc.com Sun Mar 21 19:37:31 2010 From: janssen at parc.com (Bill Janssen) Date: Sun, 21 Mar 2010 11:37:31 PDT Subject: [Image-SIG] language lawyer needed: PIL fails on Adobe Illustrator EPS... In-Reply-To: <368a5cd51003210854y7887a3ebi6cee7bf1b3a3f6f0@mail.gmail.com> References: <52453.1269123190@parc.com> <368a5cd51003210854y7887a3ebi6cee7bf1b3a3f6f0@mail.gmail.com> Message-ID: <56056.1269196651@parc.com> Here you go. Bill --- Imaging-1.1.7/PIL/EpsImagePlugin.py 2009-10-31 17:44:11.000000000 -0700 +++ modImaging/PIL/EpsImagePlugin.py 2010-03-21 11:32:54.000000000 -0700 @@ -202,6 +202,12 @@ self.info[k[:8]] = k[9:] else: self.info[k] = "" + + elif s[0] == '%': + # handle non-DSC Postscript comments that some + # tools mistakenly put in the Comments section + pass + else: raise IOError, "bad EPS header" From clemchan at ymail.com Tue Mar 23 05:42:09 2010 From: clemchan at ymail.com (Clement Chan) Date: Mon, 22 Mar 2010 21:42:09 -0700 (PDT) Subject: [Image-SIG] (no subject) Message-ID: <587045.42933.qm@web59411.mail.ac4.yahoo.com> Hello, Is there an estimate on when will the PIL be released for 3.x? How do I participate in that effort if I want to help out. Thanks Clement -- Clement Chan clemchan at ymail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From solstice.dhiver at gmail.com Wed Mar 31 10:55:26 2010 From: solstice.dhiver at gmail.com (solsTiCe d'Hiver) Date: Wed, 31 Mar 2010 10:55:26 +0200 Subject: [Image-SIG] [BUG] [PIL 1.1.17] Image.show() on unix displays image twice if xv and display are installed Message-ID: <1270025726.17078.2.camel@soho.example.org> hello, I was using the .show() function on an Image object, and I had the surprise to see 2 windows poping-up on my screen. One is xv and the other one is display. There is a little bug in ImageShow.py because the Viewer.show() is a procedure and does not return anything. Well, in fact, it returns None which is interpreted as False. Hence the bug. cheers From akats at cs.toronto.edu Wed Mar 31 18:58:03 2010 From: akats at cs.toronto.edu (Anatoliy Kats) Date: Wed, 31 Mar 2010 12:58:03 -0400 Subject: [Image-SIG] Image.open won't work after reload(Image) Message-ID: <4BB37F1B.2080204@cs.toronto.edu> Hi all, I'm not sure if this is a known bug. If I reload(Image), then opening the image will not work under Python 2.6 on Ubuntu 9.04. Here is my console output: >>> import Image >>> im = Image.open('/w/197/visionData1/bahenHallway/peopleSeq3/frame1300.ppm') >>> import numpy as np >>> im2 = np.asarray(im); >>> im2[[1:10], [1:10]] File "", line 1 im2[[1:10], [1:10]] ^ SyntaxError: invalid syntax >>> im2[1:10][:, 1:10] array([[[255, 239, 216], [255, 243, 219], [255, 246, 222], [255, 248, 223], [255, 251, 225], [255, 252, 226], [255, 253, 227], [255, 253, 226], [255, 250, 223]], ...ETC... dtype=uint8) >>> reload(Image) >>> im = Image.open('/w/197/visionData1/bahenHallway/peopleSeq3/frame1300.ppm') Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1917, in open raise IOError("cannot identify image file") IOError: cannot identify image file >>> im3 = Image.open('/w/197/visionData1/bahenHallway/peopleSeq3/frame1300.ppm') Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1917, in open raise IOError("cannot identify image file") IOError: cannot identify image file >>> From fredrik at pythonware.com Wed Mar 31 22:19:18 2010 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 31 Mar 2010 22:19:18 +0200 Subject: [Image-SIG] (no subject) In-Reply-To: <587045.42933.qm@web59411.mail.ac4.yahoo.com> References: <587045.42933.qm@web59411.mail.ac4.yahoo.com> Message-ID: I have a rough 3.X port sitting in a local repo, waiting for some spare cycles to do a bit of merging to get it up to par with the 1.1.7 release. Once that's done, I'll post the repo somewhere so more people can hammer on it. Stay tuned. On Tue, Mar 23, 2010 at 5:42 AM, Clement Chan wrote: > > Hello, > > Is there an estimate on when will the PIL be released for 3.x? How do I participate in that effort if I want to help out. > > Thanks > Clement > -- > Clement Chan > clemchan at ymail.com > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig >