From fredrik at pythonware.com Thu Oct 1 13:10:32 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 1 Oct 2009 13:10:32 +0200 Subject: [Image-SIG] Windows CRT issues with Python 2.6 In-Reply-To: <368a5cd50909280707n3bf75b9ma779907b7fe15fbb@mail.gmail.com> References: <368a5cd50909280625o471fb496ra96b5b151a058d80@mail.gmail.com> <4AC0BE40.5010801@gmail.com> <368a5cd50909280707n3bf75b9ma779907b7fe15fbb@mail.gmail.com> Message-ID: <368a5cd50910010410m30070acfne864598696499605@mail.gmail.com> I've replaced the 1.1.6 binary at effbot.org/downloads with one built under 2.6.2. The installer is 130k larger thanks to a 3x larger wininst executable (!?), but the binary extensions are slightly smaller than before, so I'll assume it's the manifests that have disappeared. On Mon, Sep 28, 2009 at 4:07 PM, Fredrik Lundh wrote: > Ah, sneaky. ?I'm pretty sure the current binary distribution was built > when 2.6 was new, and I didn't really expect them to tweak > build-related issues in an incremental release :) > > I'll push out a new build asap; will ping the list when it's available. > > Thanks! > > > > On Mon, Sep 28, 2009 at 3:46 PM, Koen van de Sande > wrote: >> The fix was applied to the main Python distribution (2.6.2 has it for sure, >> 2.6.0/2.6.1 does not). Any extension built with 2.6.2 or higher should be >> fine, as it will not get an embedded manifest. >> So just rebuild with Python Windows version 2.6.2. I see in the PIL source >> tree that it uses a setup.py build_ext call, so no changes to PIL should be >> needed. >> >> Koen >> _______________________________________________ >> Image-SIG maillist ?- ?Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > From flashk at gmail.com Fri Oct 2 00:10:33 2009 From: flashk at gmail.com (Farshid Lashkari) Date: Thu, 1 Oct 2009 15:10:33 -0700 Subject: [Image-SIG] Windows CRT issues with Python 2.6 In-Reply-To: <368a5cd50910010410m30070acfne864598696499605@mail.gmail.com> References: <368a5cd50909280625o471fb496ra96b5b151a058d80@mail.gmail.com> <4AC0BE40.5010801@gmail.com> <368a5cd50909280707n3bf75b9ma779907b7fe15fbb@mail.gmail.com> <368a5cd50910010410m30070acfne864598696499605@mail.gmail.com> Message-ID: <978d1eac0910011510x3a4f96bdr6e0f21858b398e7a@mail.gmail.com> I just tried the new installer ( http://effbot.org/media/downloads/PIL-1.1.6.win32-py2.6.exe), but the pyd files still contain embedded manifests. The installer says it was built Oct 1, 2009 with Python 2.6.2, so that should be the latest version. I took a closer look at the changes made from that bug report. The change was only made to the PCbuild/pyd.vsprops file, which I don't believe will affect 3rd party extensions. I see that Koen submitted a patch for msvc9compiler.py that will strip the runtime from the manifest, but that doesn't appear to have been committed. So I'm not really sure how 3rd party extension developers can build pyd files without embedded manifests. On Thu, Oct 1, 2009 at 4:10 AM, Fredrik Lundh wrote: > I've replaced the 1.1.6 binary at effbot.org/downloads with one built > under 2.6.2. The installer is 130k larger thanks to a 3x larger > wininst executable (!?), but the binary extensions are slightly > smaller than before, so I'll assume it's the manifests that have > disappeared. > > > > On Mon, Sep 28, 2009 at 4:07 PM, Fredrik Lundh > wrote: > > Ah, sneaky. I'm pretty sure the current binary distribution was built > > when 2.6 was new, and I didn't really expect them to tweak > > build-related issues in an incremental release :) > > > > I'll push out a new build asap; will ping the list when it's available. > > > > Thanks! > > > > > > > > On Mon, Sep 28, 2009 at 3:46 PM, Koen van de Sande > > wrote: > >> The fix was applied to the main Python distribution (2.6.2 has it for > sure, > >> 2.6.0/2.6.1 does not). Any extension built with 2.6.2 or higher should > be > >> fine, as it will not get an embedded manifest. > >> So just rebuild with Python Windows version 2.6.2. I see in the PIL > source > >> tree that it uses a setup.py build_ext call, so no changes to PIL should > be > >> needed. > >> > >> Koen > >> _______________________________________________ > >> 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 fredrik at pythonware.com Fri Oct 2 11:32:41 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 2 Oct 2009 11:32:41 +0200 Subject: [Image-SIG] Windows CRT issues with Python 2.6 In-Reply-To: <978d1eac0910011510x3a4f96bdr6e0f21858b398e7a@mail.gmail.com> References: <368a5cd50909280625o471fb496ra96b5b151a058d80@mail.gmail.com> <4AC0BE40.5010801@gmail.com> <368a5cd50909280707n3bf75b9ma779907b7fe15fbb@mail.gmail.com> <368a5cd50910010410m30070acfne864598696499605@mail.gmail.com> <978d1eac0910011510x3a4f96bdr6e0f21858b398e7a@mail.gmail.com> Message-ID: <368a5cd50910020232q66af8debya0e32138df3540f@mail.gmail.com> Ok, I can apply Koen's patch locally and rebuild, if that makes sense. What's the quickest way to look for embedded manifests in the PYD:s? dumpbin doesn't seem to say anything about that, so I assume I have to use some other tool. On Fri, Oct 2, 2009 at 12:10 AM, Farshid Lashkari wrote: > I just tried the new installer > (http://effbot.org/media/downloads/PIL-1.1.6.win32-py2.6.exe), but the pyd > files still contain embedded manifests. The installer says it was built Oct > 1, 2009 with Python 2.6.2, so that should be the latest version. > I took a closer look at the changes made from that bug report. The change > was only made to the?PCbuild/pyd.vsprops file, which I don't believe will > affect 3rd party extensions. I see that Koen submitted a patch > for?msvc9compiler.py that will strip the runtime from the manifest, but that > doesn't appear to have been committed. So I'm not really sure how 3rd party > extension developers can build pyd files without embedded manifests. > On Thu, Oct 1, 2009 at 4:10 AM, Fredrik Lundh > wrote: >> >> I've replaced the 1.1.6 binary at effbot.org/downloads with one built >> under 2.6.2. ?The installer is 130k larger thanks to a 3x larger >> wininst executable (!?), but the binary extensions are slightly >> smaller than before, so I'll assume it's the manifests that have >> disappeared. >> >> >> >> On Mon, Sep 28, 2009 at 4:07 PM, Fredrik Lundh >> wrote: >> > Ah, sneaky. ?I'm pretty sure the current binary distribution was built >> > when 2.6 was new, and I didn't really expect them to tweak >> > build-related issues in an incremental release :) >> > >> > I'll push out a new build asap; will ping the list when it's available. >> > >> > Thanks! >> > >> > >> > >> > On Mon, Sep 28, 2009 at 3:46 PM, Koen van de Sande >> > wrote: >> >> The fix was applied to the main Python distribution (2.6.2 has it for >> >> sure, >> >> 2.6.0/2.6.1 does not). Any extension built with 2.6.2 or higher should >> >> be >> >> fine, as it will not get an embedded manifest. >> >> So just rebuild with Python Windows version 2.6.2. I see in the PIL >> >> source >> >> tree that it uses a setup.py build_ext call, so no changes to PIL >> >> should be >> >> needed. >> >> >> >> Koen >> >> _______________________________________________ >> >> 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 olt at omniscale.de Fri Oct 2 12:06:42 2009 From: olt at omniscale.de (Oliver Tonnhofer) Date: Fri, 2 Oct 2009 12:06:42 +0200 Subject: [Image-SIG] Image.open should close file when it cannot identify image Message-ID: Hi, I want to remove files that PIL can't open. But the following fails on Windows, because Image.open doesn't close the file. ---- import os import Image try: f = open('test.test', 'w') f.close() Image.open('test.test') finally: os.remove('test.test') ---- results in: WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'test.test' Below is a simple fix. Regards, Oliver PS: please cc me on replies to the list. ---- --- PIL/Image.py.orig 2009-10-02 12:02:26.000000000 +0200 +++ PIL/Image.py 2009-10-02 12:03:12.000000000 +0200 @@ -1913,6 +1913,9 @@ except (SyntaxError, IndexError, TypeError): pass + if filename: + fp.close() + raise IOError("cannot identify image file") # From fredrik at pythonware.com Fri Oct 2 12:30:38 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 2 Oct 2009 12:30:38 +0200 Subject: [Image-SIG] Image.open should close file when it cannot identify image In-Reply-To: References: Message-ID: <368a5cd50910020330l69cc5c58k7749957e7ca73694@mail.gmail.com> On Fri, Oct 2, 2009 at 12:06 PM, Oliver Tonnhofer wrote: > Hi, > > I want to remove files that PIL can't open. But the following fails on > Windows, because Image.open doesn't close the file. Unless you hang on to the image object, Python will close things when the image object itself goes away. Your workaround doesn't handle anything that might happen during open; to force the file to be closed if it cannot be fully read no matter what caused the problem, I'd recommend doing something like: file = open(filename, "rb") try: im = Image.open(file) im.load() except StandardError: file.close() # force close ... process unreadable file ... else: ... process image ... > > ---- > import os > import Image > try: > ? ?f = open('test.test', 'w') > ? ?f.close() > ? ?Image.open('test.test') > finally: > ? ?os.remove('test.test') > ---- > results in: > WindowsError: [Error 32] The process cannot access the file because it is > being > used by another process: 'test.test' > > > Below is a simple fix. > > Regards, > Oliver > > PS: please cc me on replies to the list. > > ---- > --- PIL/Image.py.orig ? 2009-10-02 12:02:26.000000000 +0200 > +++ PIL/Image.py ? ? ? ?2009-10-02 12:03:12.000000000 +0200 > @@ -1913,6 +1913,9 @@ > ? ? ? ? except (SyntaxError, IndexError, TypeError): > ? ? ? ? ? ? pass > > + ? ?if filename: > + ? ? ? ?fp.close() > + > ? ? raise IOError("cannot identify image file") > > ?# > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From koenvandesande at gmail.com Fri Oct 2 13:17:16 2009 From: koenvandesande at gmail.com (Koen van de Sande) Date: Fri, 02 Oct 2009 14:17:16 +0300 Subject: [Image-SIG] Windows CRT issues with Python 2.6 In-Reply-To: <368a5cd50910020232q66af8debya0e32138df3540f@mail.gmail.com> References: <368a5cd50909280625o471fb496ra96b5b151a058d80@mail.gmail.com> <4AC0BE40.5010801@gmail.com> <368a5cd50909280707n3bf75b9ma779907b7fe15fbb@mail.gmail.com> <368a5cd50910010410m30070acfne864598696499605@mail.gmail.com> <978d1eac0910011510x3a4f96bdr6e0f21858b398e7a@mail.gmail.com> <368a5cd50910020232q66af8debya0e32138df3540f@mail.gmail.com> Message-ID: <4AC5E13C.508@gmail.com> Open it in a hex editor, and look for the word manifest. This is what it looks like with dependency: PAPADDINGXXPADDINGPADDINGX and after the patch it looks like this: PAPAD I've pinged the issue, as the patch should be applied to the main Python distribution. Koen Fredrik Lundh wrote: > Ok, I can apply Koen's patch locally and rebuild, if that makes sense. > > What's the quickest way to look for embedded manifests in the PYD:s? > dumpbin doesn't seem to say anything about that, so I assume I have to > use some other tool. > > > > On Fri, Oct 2, 2009 at 12:10 AM, Farshid Lashkari wrote: > >> I just tried the new installer >> (http://effbot.org/media/downloads/PIL-1.1.6.win32-py2.6.exe), but the pyd >> files still contain embedded manifests. The installer says it was built Oct >> 1, 2009 with Python 2.6.2, so that should be the latest version. >> I took a closer look at the changes made from that bug report. The change >> was only made to the PCbuild/pyd.vsprops file, which I don't believe will >> affect 3rd party extensions. I see that Koen submitted a patch >> for msvc9compiler.py that will strip the runtime from the manifest, but that >> doesn't appear to have been committed. So I'm not really sure how 3rd party >> extension developers can build pyd files without embedded manifests. >> On Thu, Oct 1, 2009 at 4:10 AM, Fredrik Lundh >> wrote: >> >>> I've replaced the 1.1.6 binary at effbot.org/downloads with one built >>> under 2.6.2. The installer is 130k larger thanks to a 3x larger >>> wininst executable (!?), but the binary extensions are slightly >>> smaller than before, so I'll assume it's the manifests that have >>> disappeared. >>> >>> >>> >>> On Mon, Sep 28, 2009 at 4:07 PM, Fredrik Lundh >>> wrote: >>> >>>> Ah, sneaky. I'm pretty sure the current binary distribution was built >>>> when 2.6 was new, and I didn't really expect them to tweak >>>> build-related issues in an incremental release :) >>>> >>>> I'll push out a new build asap; will ping the list when it's available. >>>> >>>> Thanks! >>>> >>>> >>>> >>>> On Mon, Sep 28, 2009 at 3:46 PM, Koen van de Sande >>>> wrote: >>>> >>>>> The fix was applied to the main Python distribution (2.6.2 has it for >>>>> sure, >>>>> 2.6.0/2.6.1 does not). Any extension built with 2.6.2 or higher should >>>>> be >>>>> fine, as it will not get an embedded manifest. >>>>> So just rebuild with Python Windows version 2.6.2. I see in the PIL >>>>> source >>>>> tree that it uses a setup.py build_ext call, so no changes to PIL >>>>> should be >>>>> needed. >>>>> >>>>> Koen >>>>> _______________________________________________ >>>>> 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 cgohlke at uci.edu Fri Oct 2 17:36:29 2009 From: cgohlke at uci.edu (Christoph Gohlke) Date: Fri, 02 Oct 2009 08:36:29 -0700 Subject: [Image-SIG] Windows CRT issues with Python 2.6 In-Reply-To: <368a5cd50910020232q66af8debya0e32138df3540f@mail.gmail.com> References: <368a5cd50909280625o471fb496ra96b5b151a058d80@mail.gmail.com> <4AC0BE40.5010801@gmail.com> <368a5cd50909280707n3bf75b9ma779907b7fe15fbb@mail.gmail.com> <368a5cd50910010410m30070acfne864598696499605@mail.gmail.com> <978d1eac0910011510x3a4f96bdr6e0f21858b398e7a@mail.gmail.com> <368a5cd50910020232q66af8debya0e32138df3540f@mail.gmail.com> Message-ID: <4AC61DFD.5020500@uci.edu> Hi, you can use Dependency Walker . If the patch is working, pyd files will depend on MSVCR90.DLL, otherwise %WINDIR%\winsxs\...\MSVCR90.DLL There are two issues with Koen's patch (both easy to fix). It does not work for 64-bit Python and it also processes exe files build with setuptools. Christoph On 11:59, Fredrik Lundh wrote: > Ok, I can apply Koen's patch locally and rebuild, if that makes sense. > > What's the quickest way to look for embedded manifests in the PYD:s? > dumpbin doesn't seem to say anything about that, so I assume I have to > use some other tool. > > > > On Fri, Oct 2, 2009 at 12:10 AM, Farshid Lashkari wrote: >> I just tried the new installer >> (http://effbot.org/media/downloads/PIL-1.1.6.win32-py2.6.exe), but the pyd >> files still contain embedded manifests. The installer says it was built Oct >> 1, 2009 with Python 2.6.2, so that should be the latest version. >> I took a closer look at the changes made from that bug report. The change >> was only made to the PCbuild/pyd.vsprops file, which I don't believe will >> affect 3rd party extensions. I see that Koen submitted a patch >> for msvc9compiler.py that will strip the runtime from the manifest, but that >> doesn't appear to have been committed. So I'm not really sure how 3rd party >> extension developers can build pyd files without embedded manifests. >> On Thu, Oct 1, 2009 at 4:10 AM, Fredrik Lundh >> wrote: >>> >>> I've replaced the 1.1.6 binary at effbot.org/downloads with one built >>> under 2.6.2. The installer is 130k larger thanks to a 3x larger >>> wininst executable (!?), but the binary extensions are slightly >>> smaller than before, so I'll assume it's the manifests that have >>> disappeared. >>> >>> >>> >>> On Mon, Sep 28, 2009 at 4:07 PM, Fredrik Lundh >>> wrote: >>>> Ah, sneaky. I'm pretty sure the current binary distribution was built >>>> when 2.6 was new, and I didn't really expect them to tweak >>>> build-related issues in an incremental release :) >>>> >>>> I'll push out a new build asap; will ping the list when it's available. >>>> >>>> Thanks! >>>> >>>> >>>> >>>> On Mon, Sep 28, 2009 at 3:46 PM, Koen van de Sande >>>> wrote: >>>>> The fix was applied to the main Python distribution (2.6.2 has it for >>>>> sure, >>>>> 2.6.0/2.6.1 does not). Any extension built with 2.6.2 or higher should >>>>> be >>>>> fine, as it will not get an embedded manifest. >>>>> So just rebuild with Python Windows version 2.6.2. I see in the PIL >>>>> source >>>>> tree that it uses a setup.py build_ext call, so no changes to PIL >>>>> should be >>>>> needed. >>>>> >>>>> Koen >>>>> _______________________________________________ >>>>> 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 flashk at gmail.com Fri Oct 2 18:00:28 2009 From: flashk at gmail.com (Farshid Lashkari) Date: Fri, 2 Oct 2009 09:00:28 -0700 Subject: [Image-SIG] Windows CRT issues with Python 2.6 In-Reply-To: <4AC61DFD.5020500@uci.edu> References: <368a5cd50909280625o471fb496ra96b5b151a058d80@mail.gmail.com> <4AC0BE40.5010801@gmail.com> <368a5cd50909280707n3bf75b9ma779907b7fe15fbb@mail.gmail.com> <368a5cd50910010410m30070acfne864598696499605@mail.gmail.com> <978d1eac0910011510x3a4f96bdr6e0f21858b398e7a@mail.gmail.com> <368a5cd50910020232q66af8debya0e32138df3540f@mail.gmail.com> <4AC61DFD.5020500@uci.edu> Message-ID: <978d1eac0910020900l2791ad77m21e69bdc046aa5a2@mail.gmail.com> I use Resource Hacker (http://www.angusj.com/resourcehacker/), it allows you to view and edit all embedded resources of EXE/DLL files. It's a very handy application. Dependency Walker is really nice too. Regarding the issue, wouldn't it just be better to compile the pyd without any embedded manifest file, instead of trying to parse and remove certain sections? I'm not familiar with how distutils works, but for my own Visual Studio projects I pass the /MANIFEST:NO option to the linker and it will not generate an embedded manifest file. On Fri, Oct 2, 2009 at 8:36 AM, Christoph Gohlke wrote: > Hi, > > you can use Dependency Walker . If the > patch is working, pyd files will depend on MSVCR90.DLL, otherwise > %WINDIR%\winsxs\...\MSVCR90.DLL > > There are two issues with Koen's patch (both easy to fix). It does not work > for 64-bit Python and it also processes exe files build with setuptools. > > Christoph > > > On 11:59, Fredrik Lundh wrote: > >> Ok, I can apply Koen's patch locally and rebuild, if that makes sense. >> >> What's the quickest way to look for embedded manifests in the PYD:s? >> dumpbin doesn't seem to say anything about that, so I assume I have to >> use some other tool. >> >> >> >> On Fri, Oct 2, 2009 at 12:10 AM, Farshid Lashkari >> wrote: >> >>> I just tried the new installer >>> (http://effbot.org/media/downloads/PIL-1.1.6.win32-py2.6.exe), but the >>> pyd >>> files still contain embedded manifests. The installer says it was built >>> Oct >>> 1, 2009 with Python 2.6.2, so that should be the latest version. >>> I took a closer look at the changes made from that bug report. The change >>> was only made to the PCbuild/pyd.vsprops file, which I don't believe will >>> affect 3rd party extensions. I see that Koen submitted a patch >>> for msvc9compiler.py that will strip the runtime from the manifest, but >>> that >>> doesn't appear to have been committed. So I'm not really sure how 3rd >>> party >>> extension developers can build pyd files without embedded manifests. >>> On Thu, Oct 1, 2009 at 4:10 AM, Fredrik Lundh >>> wrote: >>> >>>> >>>> I've replaced the 1.1.6 binary at effbot.org/downloads with one built >>>> under 2.6.2. The installer is 130k larger thanks to a 3x larger >>>> wininst executable (!?), but the binary extensions are slightly >>>> smaller than before, so I'll assume it's the manifests that have >>>> disappeared. >>>> >>>> >>>> >>>> On Mon, Sep 28, 2009 at 4:07 PM, Fredrik Lundh >>>> wrote: >>>> >>>>> Ah, sneaky. I'm pretty sure the current binary distribution was built >>>>> when 2.6 was new, and I didn't really expect them to tweak >>>>> build-related issues in an incremental release :) >>>>> >>>>> I'll push out a new build asap; will ping the list when it's available. >>>>> >>>>> Thanks! >>>>> >>>>> >>>>> >>>>> On Mon, Sep 28, 2009 at 3:46 PM, Koen van de Sande >>>>> wrote: >>>>> >>>>>> The fix was applied to the main Python distribution (2.6.2 has it for >>>>>> sure, >>>>>> 2.6.0/2.6.1 does not). Any extension built with 2.6.2 or higher should >>>>>> be >>>>>> fine, as it will not get an embedded manifest. >>>>>> So just rebuild with Python Windows version 2.6.2. I see in the PIL >>>>>> source >>>>>> tree that it uses a setup.py build_ext call, so no changes to PIL >>>>>> should be >>>>>> needed. >>>>>> >>>>>> Koen >>>>>> _______________________________________________ >>>>>> 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 >>>> >>> >>> >>> >> _______________________________________________ > 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 bentson at holmsjoen.com Sun Oct 4 00:56:00 2009 From: bentson at holmsjoen.com (Randolph Bentson) Date: Sat, 3 Oct 2009 15:56:00 -0700 Subject: [Image-SIG] fix for wide line directional dependence In-Reply-To: <20090930145631.GA2641@holmsjoen.com> References: <20090930145631.GA2641@holmsjoen.com> Message-ID: <20091003225600.GB30249@holmsjoen.com> On Wed, Sep 30, 2009 at 07:56:32AM -0700, Randolph Bentson wrote: > I've found that wide lines drawn with PIL 1.1.6 have a directional > dependence, e.g., lines from (0,0) to (-100,0) are thinner than those > from (0,0) to (0,-100). A few days ago I posted a hack which reduced the magnitude of the problem. The following patch does a better job at little additional cost. I've introduced variables dX and dY to improve the readability of the code which computes the values of the pixel-based dx and dy values. The reference to "diagonal lines" doesn't implement proper antialiasing, but it improves things with modest code change.) Feedback is welcome because I do hope this'll get in the 1.1.7 release. --- OLD_Draw.c 2009-10-03 14:44:31.000000000 -0700 +++ Draw.c 2009-10-03 15:42:41.000000000 -0700 @@ -665,6 +665,7 @@ Edge e[4]; + int dX, dY; int dx, dy; double d; @@ -675,18 +676,34 @@ return 0; } - dx = x1-x0; - dy = y1-y0; + dX = x1-x0; + dY = y1-y0; - if (dx == 0 && dy == 0) { + if (dX == 0 && dY == 0) { draw->point(im, x0, y0, ink); return 0; } - d = width / sqrt(dx*dx + dy*dy) / 2.0; + d = width / sqrt(dX*dX + dY*dY) / 2.0; - dx = (int) (d * (y1-y0) + 0.5); - dy = (int) (d * (x1-x0) + 0.5); + /* Negative values are rounded down and positive + values are rounded up, else the deltas disappear! + */ + if (dY < 0) dx = (int) (d * dY - 0.5); + else dx = (int) (d * dY + 0.5); + if (dX < 0) dy = (int) (d * dX - 0.5); + else dy = (int) (d * dX + 0.5); + + /* This is necessary because diagonal lines are too wide. + */ + if ( 4*(dx*dx+dy*dy) > (width*width) ){ + if (abs(dx) > abs(dy)) + if (dx < 0) dx ++; + else dx --; + else + if (dy < 0) dy ++; + else dy --; + } add_edge(e+0, x0 - dx, y0 + dy, x1 - dx, y1 + dy); add_edge(e+1, x1 - dx, y1 + dy, x1 + dx, y1 - dy); -- Randolph Bentson bentson at holmsjoen.com From mark.wendell at gmail.com Sun Oct 4 18:47:58 2009 From: mark.wendell at gmail.com (Mark Wendell) Date: Sun, 4 Oct 2009 10:47:58 -0600 Subject: [Image-SIG] image warping with pil Message-ID: I'm assuming that PIL doesn't provide any non-linear image warping functions natively. Has anyone used the PIL tools to do this, though? I'm looking for a method or algorithm to warp an image based on an arbitrary vector field. All the better if it's a pure-python implementation. thanks in advance, Mark -- -- Mark Wendell From fredrik at pythonware.com Mon Oct 5 10:53:42 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 5 Oct 2009 10:53:42 +0200 Subject: [Image-SIG] Some issue with easy_install and PIL/Imaging In-Reply-To: <4AC3864C.3070704@simplistix.co.uk> References: <4AAA557E.70508@simplistix.co.uk> <368a5cd50909280601i39c065fbob8fa33166162072f@mail.gmail.com> <4AC3864C.3070704@simplistix.co.uk> Message-ID: <368a5cd50910050153l4fdddafcp31255ff0a366efdb@mail.gmail.com> The problem is that too many people arguing for eggs do this by sending nastygrams, which doesn't really provide much motivation for doing anything about it (I don't do asshole-driven development). The public review PIL got a couple a minutes ago matches some of the private mail I've gotten: no egg - worst seen ever, remove it from pypi or provide an egg (jensens, 2009-10-05, 0 points) On Wed, Sep 30, 2009 at 6:24 PM, Chris Withers wrote: > Fredrik Lundh wrote: >> >> On Fri, Sep 11, 2009 at 3:49 PM, Chris Withers >> wrote: >>> >>> Klein St?phane wrote: >>>> >>>> Resume : >>>> 1. first question : why PIL package in "pypi" don't work ? >>> >>> Because Fred Lundh have his package distributions unfortunate names that >>> setuptools doesn't like... >> >> It used to support this, but no longer does. ?To me, that says more >> about the state of setuptools than it does about the state of PIL, >> which has been using the same naming convention for 15 years. > > Yep, but it is now in the minority, and consistency in package naming is > always good. > > Would there be any problems for you in naming the distribution in a > setuptools-friendly way from the next point release? > > cheers, > > Chris > > -- > Simplistix - Content Management, Batch Processing & Python Consulting > ? ? ? ? ? - http://www.simplistix.co.uk > From chris at simplistix.co.uk Mon Oct 5 11:19:09 2009 From: chris at simplistix.co.uk (Chris Withers) Date: Mon, 05 Oct 2009 10:19:09 +0100 Subject: [Image-SIG] Some issue with easy_install and PIL/Imaging In-Reply-To: <368a5cd50910050153l4fdddafcp31255ff0a366efdb@mail.gmail.com> References: <4AAA557E.70508@simplistix.co.uk> <368a5cd50909280601i39c065fbob8fa33166162072f@mail.gmail.com> <4AC3864C.3070704@simplistix.co.uk> <368a5cd50910050153l4fdddafcp31255ff0a366efdb@mail.gmail.com> Message-ID: <4AC9BA0D.7010504@simplistix.co.uk> Fredrik Lundh wrote: > The problem is that too many people arguing for eggs do this by > sending nastygrams, which doesn't really provide much motivation for > doing anything about it (I don't do asshole-driven development). Indeed, I couldn't agree more, and I'm sorry you've been subjected to this. My (hopefully more polite) request still stands though: >> Would there be any problems for you in naming the distribution in a >> setuptools-friendly way from the next point release? > The > public review PIL got a couple a minutes ago matches some of the > private mail I've gotten: > > no egg - worst seen ever, remove it from pypi or provide an egg > (jensens, 2009-10-05, 0 points) *sigh* Interesting timing, myself and Doug Hellmann have been trying to persuade Martin von Lewis that while ratings are fine, the commenting system is likely to be abused: https://sourceforge.net/tracker/?func=detail&atid=513503&aid=2866081&group_id=66150 https://sourceforge.net/tracker/?func=detail&atid=513503&aid=2872293&group_id=66150 I'll put in a request to have that comment removed... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk From koenvandesande at gmail.com Mon Oct 5 19:50:10 2009 From: koenvandesande at gmail.com (Koen van de Sande) Date: Mon, 05 Oct 2009 19:50:10 +0200 Subject: [Image-SIG] Windows CRT issues with Python 2.6 In-Reply-To: <978d1eac0910020900l2791ad77m21e69bdc046aa5a2@mail.gmail.com> References: <978d1eac0910020900l2791ad77m21e69bdc046aa5a2@mail.gmail.com> Message-ID: <4ACA31D2.9090109@gmail.com> To check for the manifest, I just open it up in a hex editor and look for the word "manifest". That will get you to the XML part of the file, and you can see what's happening. Please note that if you turn manifests off, you assume that your extension has no other dependencies. And for things like TCL/TK, Windows Common Controls, there can be additional dependencies in the XML file. So, only remove the dependency on the runtimes, otherwise you break things with additional dependencies. Koen From JSeth at eastech.org Fri Oct 9 14:27:01 2009 From: JSeth at eastech.org (Joni Seth) Date: Fri, 09 Oct 2009 08:27:01 -0400 Subject: [Image-SIG] Cannot get PIL to install with jpeg support&In-Reply-To=<00F4C884-D55B-48C9-9927-7A5ECB007662@pharmacy.arizona.edu> Message-ID: <4ACEF3D5020000EA00020F30@gw.eastech.org> Hello Bruce, I found your post regarding "Cannot get PIL to install with jpeg support", because I am having the exact same problem. Unfortunately, I also noticed that no one responded to your question. Did you ever find out how to get this to work? I sure would appreciate it if you could share any "secrets" that you have come across... it must be a great secret. thank you, Joni Seth Joni Seth IT Support Specialist Eastern Center for Arts and Technology 3075 Terwood Rd Willow Grove, Pa 19090 (215) 784-4800 x274 jseth at eastech.org CONFIDENTIALITY NOTICE: This e-mail is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you have received this communication in error, please do not, print, disclose, copy, retain or redistribute it. Please delete the original message after notifying the sender by e-mail at the address shown. Thank you for your compliance. Eastern Center for Arts and Technology CONFIDENTIALITY NOTICE: This E-Mail is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you have received this communication in error, please do not print, disclose, copy, retain or redistribute it. Please delete the original message after notifying the sender by E-Mail at the address shown. Thank you for your compliance. Eastern Center for Arts and Technology CONFIDENTIALITY NOTICE: This E-Mail is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you have received this communication in error, please do not print, disclose, copy, retain or redistribute it. Please delete the original message after notifying the sender by E-Mail at the address shown. Thank you for your compliance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fbuchinger at gmail.com Mon Oct 12 14:55:47 2009 From: fbuchinger at gmail.com (Franz Buchinger) Date: Mon, 12 Oct 2009 14:55:47 +0200 Subject: [Image-SIG] How to get quality of picture In-Reply-To: <300427.14251.qm@web57603.mail.re1.yahoo.com> References: <200909281508202036150@ucweb.com> <368a5cd50909280543w3b79d173j35e73a9cc3c48055@mail.gmail.com> <300427.14251.qm@web57603.mail.re1.yahoo.com> Message-ID: As Frederik already mentioned, you can extract the quantisation table of an opened JPEG file with the .quantization attribute. To determine the quality setting of the jpeg, you can calculate some hash (e.g. md5) for the quantisation table and compare it to hashes from jpeg files saved at different quality settings. PIL and most other FOSS image processing apps (GIMP, Imagemagick) depend on libjpeg and its builtin quantisation tables. This means that you can easily determine the quality of images processed with these apps. JPEGs saved in commercial apps like Photoshop, Lightroom or directly taken from a camera however bring their own quality settings and quantisation tables. An image exported with the "Save for Web" dialog in Photoshop for example can come in 12 different quality settings, each corresponding to a different quantisation table which have nothing in common with the ones libjpeg is using. In short words: you need a huge database of quantisation table hashes to reliably identify the quality setting of an arbitrary jpeg. Therefore, I recommend to make use of exiftool's jpegdigest database, which holds thousands of quantisation table hashes: http://cpansearch.perl.org/src/EXIFTOOL/Image-ExifTool-7.89/lib/Image/ExifTool/JPEGDigest.pm You only have to port the jpegdigest hashing algorithm from perl to python and convert the database to a dictionary. kind regards, Franz 2009/9/29 David Berthelot > Here's some code that does the trick. > > It returns a tuple: > (coefficient, (luminance_coefficient,luminance_error), > (chrominance_coefficient,chrominance_error)) > > Note: > - The 2nd and 3rd returned items are only useful if you're interested in > the error (sometimes the error is 0 if the program used a JPEG table that is > the same as the one used by PIL). > - Fredrik: You can freely use the code and embed it in PIL if you're > satisfied with its quality > > Code: > def get_jpeg_quantization_tables(f): > """Returns the JPEG quantization tables of a filename or file > descriptor""" > from functools import partial > import Image > import numpy as N > fd = Image.open(f) > if fd.format == 'BMP': > return N.ones((8,8)),N.ones((8,8)) > q = fd.quantization > ql,qc = > map(partial(N.array,dtype='uint8'),(q.get(0,N.zeros(64)),q.get(1,N.zeros(64)))) > # Now reorder the JPEG quantification coefficients as 8x8 matrices > jpeg_natural_order = N.array([ 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, > 32, 25, 18, 11, 4, 5, 12, > 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, > 6, 7, 14, 21, 28, 35, 42, > 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, > 30, 37, 44, 51, 58, 59, 52, > 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, > 55, 62, 63]) > rql = N.zeros(64,'f') > rqc = N.zeros(64,'f') > for x,y in N.ndenumerate(jpeg_natural_order): > rql[y] = ql[x] > rqc[y] = qc[x] > return rql.reshape(8,8),rqc.reshape(8,8) # Luminance/Chrominance > > def guess_jpeg_quality(f,ctables=[]): > from StringIO import StringIO > import numpy as N > import Image > # Compute the tables for quality = 1..100 by saving fakes files in > memory > if not ctables: > tables = N.zeros((100,2,8,8),'f') > for x in xrange(100): > fd = StringIO() > Image.new('RGB',(64,64)).save(fd,"jpeg",quality=1+x) > fd.seek(0) > ql,qc = get_jpeg_quantization_tables(fd) > tables[x][0] = ql > tables[x][1] = qc > ctables.append(tables) > else: > tables = ctables[0] > # Use a weighting matrix w to put more emphasis on the comparison of > lower DCT harmonics > w = 1./N.outer(1+N.arange(8)/7.,1+N.arange(8)/7.) > ql,qc = get_jpeg_quantization_tables(f) > # Compute errors on Luminance and Chrominance tables > errsl,errsc = [],[] > for x in xrange(100): > errsl.append((N.square((ql-tables[x][0])*w).mean(),x)) > errsc.append((N.square((qc-tables[x][1])*w).mean(),x)) > # Select minimal error coefficients > lmin = min(errsl) > cmin = min(errsc) > # Weight coefficients average (more emphasis put on luminance since it > affects most visual perception) > q = int(round(lmin[1]*.8 + cmin[1]*.2)) > return q,lmin,cmin > > > > ------------------------------ > *From:* Fredrik Lundh > *To:* qiaohl > *Cc:* image-sig > *Sent:* Monday, September 28, 2009 5:43:00 AM > *Subject:* Re: [Image-SIG] How to get quality of picture > > The quality setting is used to create a quantization table which is > then used by the compression algorithm. There's no pre-defined > mapping between quality and the contents of the quantization table for > JPEG (different implementations do different things), but some > applications attempt to guess by comparing the quantization tables in > the file with known mapping algorithms. I'm not aware of any such > code for Python. > > If you want to tinker with this, you can access the quantization table > of an opened JPEG file via the "quantization" attribute. > > > > On Mon, Sep 28, 2009 at 9:08 AM, qiaohl wrote: > > Hi,all > > Is there any function in PIL to get the value of JPEG quality(1-100)? > I > > know there are functions to set this value, But I found no function to > get > > this value of an existing JPEG file. > > > > Thanks! > > > > > > 2009-09-28 > > ________________________________ > > qiaohl > > _______________________________________________ > > 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 > > > _______________________________________________ > 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 johnson at pharmacy.arizona.edu Mon Oct 12 17:35:08 2009 From: johnson at pharmacy.arizona.edu (Bruce Johnson) Date: Mon, 12 Oct 2009 08:35:08 -0700 Subject: [Image-SIG] Cannot get PIL to install with jpeg support&In-Reply-To=<00F4C884-D55B-48C9-9927-7A5ECB007662@pharmacy.arizona.edu> In-Reply-To: <4ACEF3D5020000EA00020F30@gw.eastech.org> References: <4ACEF3D5020000EA00020F30@gw.eastech.org> Message-ID: <34DE80A7-177B-4390-9F24-AF68E157F7C9@pharmacy.arizona.edu> On Oct 9, 2009, at 5:27 AM, Joni Seth wrote: > Hello Bruce, > I found your post regarding "Cannot get PIL to install with jpeg > support", because I am having the exact same problem. Unfortunately, > I also noticed that no one responded to your question. Did you ever > find out how to get this to work? I sure would appreciate it if you > could share any "secrets" that you have come across... it must be a > great secret. It turned out to be an error with the selftest.py stuff; jpeg was installed correctly all along. Here's the web reference I found explaining it: if the above link breaks. -- Bruce Johnson University of Arizona College of Pharmacy Information Technology Group Institutions do not have opinions, merely customs From r1chardj0n3s at gmail.com Tue Oct 13 07:25:54 2009 From: r1chardj0n3s at gmail.com (Richard Jones) Date: Tue, 13 Oct 2009 16:25:54 +1100 Subject: [Image-SIG] ImageTk.PhotoImage Bus Error on Snow Leopard Message-ID: <9229EC3F-0BDA-4E5A-AC8C-6437B9F8329A@gmail.com> I'm getting a Bus Error attempting to use ImageTk.PhotoImage on Snow Leopard. I've compiled PIL myself. I'm using the system Tcl/Tk (8.4). The selftest.py runs fine. The code I'm attempting is: import Tkinter as tk root = tk.Tk() image = Image.open('Images/lena.jpg') photo = ImageTk.PhotoImage(image) and I get the Bus Error on the last line. gdb (which I'm quite rusty at driving) says: >>> photo = ImageTk.PhotoImage(image) Reading symbols for shared libraries ... done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00000028 0x16e72a28 in Tk_GetImageMasterData () (gdb) I've manually traced and I know the code is breaking somewhere in PyImagingPhotoPut. I've confirmed the image data loads OK (Image.load) by using the same image code in a pyglet program and displaying it. Any suggestions? Richard From Lbrannma at yahoo.com Fri Oct 16 00:52:23 2009 From: Lbrannma at yahoo.com (LL) Date: Fri, 16 Oct 2009 00:52:23 +0200 Subject: [Image-SIG] Broken pipe converting eps to png using PIL Message-ID: Hi.. all of the following code executes interactively except the last line. Converting a .jpg file to .png works fine. I'm using the PIL version for Python 2.6. Any suggestions will be greatly appreciated. Thanks, Lance ------------------------------------ PythonWin 2.6.3 (r263:75183, Oct 5 2009, 14:41:55) [MSC v.1500 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information. >>> import os >>> import zlib >>> import Image >>> os.chdir("c:\\foo") >>> img = Image.open("foo1.eps") >>> img.save("foo1.png") Traceback (most recent call last): File "", line 1, in File "C:\Python26\lib\site-packages\PIL\Image.py", line 1372, in save self.load() File "C:\Python26\lib\site-packages\PIL\EpsImagePlugin.py", line 283, in load self.im = Ghostscript(self.tile, self.size, self.fp) File "C:\Python26\lib\site-packages\PIL\EpsImagePlugin.py", line 72, in Ghostscript gs.write(s) IOError: [Errno 32] Broken pipe >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From cannon.el at gmail.com Fri Oct 16 06:55:12 2009 From: cannon.el at gmail.com (Laura & Edward Cannon) Date: Thu, 15 Oct 2009 21:55:12 -0700 Subject: [Image-SIG] unexpected result when using Image.composite Message-ID: I am using Image.composite to combine two images and am getting unexpected results. Partially transparent areas are appearing discolored. When I preform the same operation in the Gimp, the result is as expected. A script demonstrating the problem is import Image fg = Image.open("a0001.png") bg = Image.open("bg.png").resize(fg.size, Image.ANTIALIAS) Image.composite(fg, bg, fg).save("out.png") I have attached the source files for reference. Any insight into this problem would be appreciated. Edward Cannon -------------- next part -------------- A non-text attachment was scrubbed... Name: a0001.png Type: image/png Size: 93173 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: bg.png Type: image/png Size: 212882 bytes Desc: not available URL: From Lbrannma at yahoo.com Sat Oct 17 14:38:38 2009 From: Lbrannma at yahoo.com (LL) Date: Sat, 17 Oct 2009 14:38:38 +0200 Subject: [Image-SIG] Broken pipe converting eps to png using PIL References: Message-ID: <0CA6386B74114FF1BFDFA7A39094EAF2@leb65dd463c13e> Hi.. here is an update regarding my eps to png problem. I am running XP... and discovered that my AFPL Ghostscript executable is entitled gswin32 rather than gs. I edited the PIL file EpsImagePlugin.py file (see below) but still have the same problem. Probably my thinking was incorrect.. since converting from .jpg to .png via the PIL (file.open then save) works fine. Perhaps there is a separate Ghostview within Python 2.6,... but I searched for gs.exe in my Python installation directory and did not find anything. I'm still puzzled File "C:\Python26\lib\site-packages\PIL\EpsImagePlugin.py", line 72, in Ghostscript C:\Progra~1\gs\gs8.53\bin\gswin32.write(s) IOError: [Errno 32] Broken pipe ----- Original Message ----- From: LL To: image-sig at python.org Sent: Friday, October 16, 2009 12:52 AM Subject: [Image-SIG] Broken pipe converting eps to png using PIL Hi.. all of the following code executes interactively except the last line. Converting a .jpg file to .png works fine. I'm using the PIL version for Python 2.6. Any suggestions will be greatly appreciated. Thanks, Lance ------------------------------------ PythonWin 2.6.3 (r263:75183, Oct 5 2009, 14:41:55) [MSC v.1500 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information. >>> import os >>> import zlib >>> import Image >>> os.chdir("c:\\foo") >>> img = Image.open("foo1.eps") >>> img.save("foo1.png") Traceback (most recent call last): File "", line 1, in File "C:\Python26\lib\site-packages\PIL\Image.py", line 1372, in save self.load() File "C:\Python26\lib\site-packages\PIL\EpsImagePlugin.py", line 283, in load self.im = Ghostscript(self.tile, self.size, self.fp) File "C:\Python26\lib\site-packages\PIL\EpsImagePlugin.py", line 72, in Ghostscript gs.write(s) IOError: [Errno 32] Broken pipe >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From cannon.el at gmail.com Mon Oct 19 03:50:11 2009 From: cannon.el at gmail.com (Laura & Edward Cannon) Date: Sun, 18 Oct 2009 18:50:11 -0700 Subject: [Image-SIG] unexpected result when using Image.composite In-Reply-To: References: Message-ID: I have discovered the source of the problem. the bg image is mode RGBA, when I convert it to RGB, the result is as expected. On Thu, Oct 15, 2009 at 9:55 PM, Laura & Edward Cannon wrote: > I am using Image.composite to combine two images and am getting > unexpected results. Partially transparent areas are appearing > discolored. When I preform the same operation in the Gimp, the result > is as expected. A script demonstrating the problem is > > import Image > > fg = Image.open("a0001.png") > bg = Image.open("bg.png").resize(fg.size, Image.ANTIALIAS) > Image.composite(fg, bg, fg).save("out.png") > > > I have attached the source files for reference. Any insight into this > problem would be appreciated. > Edward Cannon > From ivan.mincik at gmail.com Mon Oct 19 23:05:53 2009 From: ivan.mincik at gmail.com (Ivan Mincik) Date: Mon, 19 Oct 2009 23:05:53 +0200 Subject: [Image-SIG] transparency in palette mode ( "P" ) images Message-ID: <1ed604b80910191405t3dc73f7bx4453c00dadd5a556@mail.gmail.com> Dear list, I have PNG image in palette mode, with 256 color palette. Every color has different level of transparency. For example: Color Table (RGB with 256 entries) 0: 0,0,0,0 1: 238,238,238,154 2: 253,253,109,154 3: 0,0,0,2 4: 0,0,0,4 5: 0,0,0,8 6: 0,0,0,6 7: 237,237,237,154 8: 0,0,0,14 9: 35,35,15,153 10: 1,1,0,138 I am trying just to open and save this image using PIL. #!/usr/bin/python import Image im = Image.open('test.png') im.save('out.png', transparency=0 ) After running this code, the resulting image is loosing transparency information for each color and it is set to 255. Color Table (RGB with 256 entries) 0: 0,0,0,0 1: 238,238,238,255 2: 253,253,109,255 3: 0,0,0,255 4: 0,0,0,255 5: 0,0,0,255 6: 0,0,0,255 7: 237,237,237,255 8: 0,0,0,255 9: 35,35,15,255 10: 1,1,0,255 Is there any way how to save the image with exactly same palette as original image ? For anybody wanting to look at this problem, You can download my test image here: http://gista.sk/dl/test.png Thanks, Ivan From ivan.mincik at gista.sk Tue Oct 20 18:53:44 2009 From: ivan.mincik at gista.sk (Ivan Mincik) Date: Tue, 20 Oct 2009 18:53:44 +0200 Subject: [Image-SIG] transparency in palette mode ( "P" ) images In-Reply-To: References: <1ed604b80910191405t3dc73f7bx4453c00dadd5a556@mail.gmail.com> Message-ID: <200910201853.49236.ivan.mincik@gista.sk> On Tuesday 20 October 2009, you wrote: > The problem seems to be that you set transparency=0 in your save. > Leave it out ( im.save("out.png") ) and you should be fine. Many thanks for reply, but I think You are not right. If I save without 'transparency=0' I will loose my transparent background at all - it will be black. With 'transparency=0' I loose only transparency of my drawing, backround is OK. My test image is here: http://gista.sk/dl/test.png > If you just need to change the name try shutil.copy in the standard library. > > On Mon, Oct 19, 2009 at 2:05 PM, Ivan Mincik wrote: > > Dear list, > > I have PNG image in ?palette mode, with 256 color palette. Every color > > has different level of transparency. > > For example: > > ?Color Table (RGB with 256 entries) > > ? ?0: 0,0,0,0 > > ? ?1: 238,238,238,154 > > ? ?2: 253,253,109,154 > > ? ?3: 0,0,0,2 > > ? ?4: 0,0,0,4 > > ? ?5: 0,0,0,8 > > ? ?6: 0,0,0,6 > > ? ?7: 237,237,237,154 > > ? ?8: 0,0,0,14 > > ? ?9: 35,35,15,153 > > ? 10: 1,1,0,138 > > > > I am trying just to open and save this image using PIL. > > #!/usr/bin/python > > import Image > > > > im = Image.open('test.png') > > im.save('out.png', transparency=0 ) > > > > After running this code, the resulting image is loosing transparency > > information for each color and it is set to 255. > > ?Color Table (RGB with 256 entries) > > ? ?0: 0,0,0,0 > > ? ?1: 238,238,238,255 > > ? ?2: 253,253,109,255 > > ? ?3: 0,0,0,255 > > ? ?4: 0,0,0,255 > > ? ?5: 0,0,0,255 > > ? ?6: 0,0,0,255 > > ? ?7: 237,237,237,255 > > ? ?8: 0,0,0,255 > > ? ?9: 35,35,15,255 > > ? 10: 1,1,0,255 > > > > Is there any way how to save the image with exactly same palette as > > original image ? > > > > For anybody wanting to look at this problem, You can download my test > > image here: > > http://gista.sk/dl/test.png > > > > Thanks, > > Ivan > > _______________________________________________ > > Image-SIG maillist ?- ?Image-SIG at python.org > > http://mail.python.org/mailman/listinfo/image-sig > > > -- Ivan Mincik Gista s.r.o. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. URL: From ivan.mincik at gista.sk Tue Oct 20 20:38:40 2009 From: ivan.mincik at gista.sk (Ivan Mincik) Date: Tue, 20 Oct 2009 20:38:40 +0200 Subject: [Image-SIG] transparency in palette mode ( "P" ) images In-Reply-To: <1ed604b80910201137p49040c5akfa767474d13eb006@mail.gmail.com> References: <1ed604b80910191405t3dc73f7bx4453c00dadd5a556@mail.gmail.com> <200910201853.49236.ivan.mincik@gista.sk> <1ed604b80910201137p49040c5akfa767474d13eb006@mail.gmail.com> Message-ID: <1ed604b80910201138w49293906v42ceb73855e04f9f@mail.gmail.com> On Tue, Oct 20, 2009 at 8:33 PM, Laura & Edward Cannon wrote: > Hm.. you seem to be right. One thing you might do is im = > Image.open("test.png").convert("RGBA") which seems to solve the > transparency problem, at the expense of a slightly larger image file. > Looking closer I think that PIL seems to support only RGB palettes > rather than RGBA palettes as does the PNG specification. Converting to > RGBA would make editing work as expected, and would preserve all > transparency information. Thanks, between open() and save() I have some image processing which is unusable without correct saving. If you just need to move/rename the image, > try shutil.copy in the standard library. > Edward > > On Tue, Oct 20, 2009 at 9:53 AM, Ivan Mincik wrote: >> On Tuesday 20 October 2009, you wrote: >>> The problem seems to be that you set transparency=0 in your save. >>> Leave it out ( im.save("out.png") ) and you should be fine. >> >> Many thanks for reply, but I think You are not right. If I save without 'transparency=0' I will loose my transparent background at all - it will be black. ?With ?'transparency=0' I loose only transparency of my drawing, backround is OK. >> My test image is here: http://gista.sk/dl/test.png >> >> >>> If you just need to change the name try shutil.copy in the standard library. >>> >>> On Mon, Oct 19, 2009 at 2:05 PM, Ivan Mincik wrote: >>> > Dear list, >>> > I have PNG image in ?palette mode, with 256 color palette. Every color >>> > has different level of transparency. >>> > For example: >>> > ?Color Table (RGB with 256 entries) >>> > ? ?0: 0,0,0,0 >>> > ? ?1: 238,238,238,154 >>> > ? ?2: 253,253,109,154 >>> > ? ?3: 0,0,0,2 >>> > ? ?4: 0,0,0,4 >>> > ? ?5: 0,0,0,8 >>> > ? ?6: 0,0,0,6 >>> > ? ?7: 237,237,237,154 >>> > ? ?8: 0,0,0,14 >>> > ? ?9: 35,35,15,153 >>> > ? 10: 1,1,0,138 >>> > >>> > I am trying just to open and save this image using PIL. >>> > #!/usr/bin/python >>> > import Image >>> > >>> > im = Image.open('test.png') >>> > im.save('out.png', transparency=0 ) >>> > >>> > After running this code, the resulting image is loosing transparency >>> > information for each color and it is set to 255. >>> > ?Color Table (RGB with 256 entries) >>> > ? ?0: 0,0,0,0 >>> > ? ?1: 238,238,238,255 >>> > ? ?2: 253,253,109,255 >>> > ? ?3: 0,0,0,255 >>> > ? ?4: 0,0,0,255 >>> > ? ?5: 0,0,0,255 >>> > ? ?6: 0,0,0,255 >>> > ? ?7: 237,237,237,255 >>> > ? ?8: 0,0,0,255 >>> > ? ?9: 35,35,15,255 >>> > ? 10: 1,1,0,255 >>> > >>> > Is there any way how to save the image with exactly same palette as >>> > original image ? >>> > >>> > For anybody wanting to look at this problem, You can download my test >>> > image here: >>> > http://gista.sk/dl/test.png >>> > >>> > Thanks, >>> > Ivan >>> > _______________________________________________ >>> > Image-SIG maillist ?- ?Image-SIG at python.org >>> > http://mail.python.org/mailman/listinfo/image-sig >>> > >>> >> >> >> >> -- >> Ivan Mincik >> Gista s.r.o. >> > From ivan.mincik at gista.sk Tue Oct 20 20:51:13 2009 From: ivan.mincik at gista.sk (Ivan Mincik) Date: Tue, 20 Oct 2009 20:51:13 +0200 Subject: [Image-SIG] transparency in palette mode ( "P" ) images In-Reply-To: References: <1ed604b80910191405t3dc73f7bx4453c00dadd5a556@mail.gmail.com> <200910201853.49236.ivan.mincik@gista.sk> Message-ID: <1ed604b80910201151i3e5776bel5578ebbfe8e1cd0b@mail.gmail.com> On Tue, Oct 20, 2009 at 8:33 PM, Laura & Edward Cannon wrote: > Hm.. you seem to be right. One thing you might do is im = > Image.open("test.png").convert("RGBA") which seems to solve the > transparency problem, at the expense of a slightly larger image file. No, even if using convert("RGBA") I get incorrect result :( > Looking closer I think that PIL seems to support only RGB palettes > rather than RGBA palettes as does the PNG specification. Converting to > RGBA would make editing work as expected, and would preserve all > transparency information. If you just need to move/rename the image, > try shutil.copy in the standard library. > Edward > > On Tue, Oct 20, 2009 at 9:53 AM, Ivan Mincik wrote: >> On Tuesday 20 October 2009, you wrote: >>> The problem seems to be that you set transparency=0 in your save. >>> Leave it out ( im.save("out.png") ) and you should be fine. >> >> Many thanks for reply, but I think You are not right. If I save without 'transparency=0' I will loose my transparent background at all - it will be black. ?With ?'transparency=0' I loose only transparency of my drawing, backround is OK. >> My test image is here: http://gista.sk/dl/test.png >> >> >>> If you just need to change the name try shutil.copy in the standard library. >>> >>> On Mon, Oct 19, 2009 at 2:05 PM, Ivan Mincik wrote: >>> > Dear list, >>> > I have PNG image in ?palette mode, with 256 color palette. Every color >>> > has different level of transparency. >>> > For example: >>> > ?Color Table (RGB with 256 entries) >>> > ? ?0: 0,0,0,0 >>> > ? ?1: 238,238,238,154 >>> > ? ?2: 253,253,109,154 >>> > ? ?3: 0,0,0,2 >>> > ? ?4: 0,0,0,4 >>> > ? ?5: 0,0,0,8 >>> > ? ?6: 0,0,0,6 >>> > ? ?7: 237,237,237,154 >>> > ? ?8: 0,0,0,14 >>> > ? ?9: 35,35,15,153 >>> > ? 10: 1,1,0,138 >>> > >>> > I am trying just to open and save this image using PIL. >>> > #!/usr/bin/python >>> > import Image >>> > >>> > im = Image.open('test.png') >>> > im.save('out.png', transparency=0 ) >>> > >>> > After running this code, the resulting image is loosing transparency >>> > information for each color and it is set to 255. >>> > ?Color Table (RGB with 256 entries) >>> > ? ?0: 0,0,0,0 >>> > ? ?1: 238,238,238,255 >>> > ? ?2: 253,253,109,255 >>> > ? ?3: 0,0,0,255 >>> > ? ?4: 0,0,0,255 >>> > ? ?5: 0,0,0,255 >>> > ? ?6: 0,0,0,255 >>> > ? ?7: 237,237,237,255 >>> > ? ?8: 0,0,0,255 >>> > ? ?9: 35,35,15,255 >>> > ? 10: 1,1,0,255 >>> > >>> > Is there any way how to save the image with exactly same palette as >>> > original image ? >>> > >>> > For anybody wanting to look at this problem, You can download my test >>> > image here: >>> > http://gista.sk/dl/test.png >>> > >>> > Thanks, >>> > Ivan >>> > _______________________________________________ >>> > Image-SIG maillist ?- ?Image-SIG at python.org >>> > http://mail.python.org/mailman/listinfo/image-sig >>> > >>> >> >> >> >> -- >> Ivan Mincik >> Gista s.r.o. >> > From ivan.mincik at gista.sk Tue Oct 20 22:22:05 2009 From: ivan.mincik at gista.sk (Ivan Mincik) Date: Tue, 20 Oct 2009 22:22:05 +0200 Subject: [Image-SIG] transparency in palette mode ( "P" ) images In-Reply-To: References: <1ed604b80910191405t3dc73f7bx4453c00dadd5a556@mail.gmail.com> <200910201853.49236.ivan.mincik@gista.sk> <1ed604b80910201151i3e5776bel5578ebbfe8e1cd0b@mail.gmail.com> Message-ID: <1ed604b80910201322o64a5642dtd101f1af90218201@mail.gmail.com> On Tue, Oct 20, 2009 at 9:02 PM, David Kwast wrote: > On Tue, Oct 20, 2009 at 4:51 PM, Ivan Mincik wrote: >> >> On Tue, Oct 20, 2009 at 8:33 PM, Laura & Edward Cannon >> wrote: >> > Hm.. you seem to be right. One thing you might do is im = >> > Image.open("test.png").convert("RGBA") which seems to solve the >> > transparency problem, at the expense of a slightly larger image file. >> >> No, even if using convert("RGBA") I get incorrect result :( > > Maybe the problem is in the decoder. Can't you use a PNG in RGBA mode > instead of P mode? No, I need to process images in P mode and have resulting image also in P mode. If it is a bug, you have to do a workaround before or > after you open the PNG with PIL. I do not see possibility of any workaround. Converting to RGBA does not help. From cannon.el at gmail.com Tue Oct 20 20:33:32 2009 From: cannon.el at gmail.com (Laura & Edward Cannon) Date: Tue, 20 Oct 2009 11:33:32 -0700 Subject: [Image-SIG] transparency in palette mode ( "P" ) images In-Reply-To: <200910201853.49236.ivan.mincik@gista.sk> References: <1ed604b80910191405t3dc73f7bx4453c00dadd5a556@mail.gmail.com> <200910201853.49236.ivan.mincik@gista.sk> Message-ID: Hm.. you seem to be right. One thing you might do is im = Image.open("test.png").convert("RGBA") which seems to solve the transparency problem, at the expense of a slightly larger image file. Looking closer I think that PIL seems to support only RGB palettes rather than RGBA palettes as does the PNG specification. Converting to RGBA would make editing work as expected, and would preserve all transparency information. If you just need to move/rename the image, try shutil.copy in the standard library. Edward On Tue, Oct 20, 2009 at 9:53 AM, Ivan Mincik wrote: > On Tuesday 20 October 2009, you wrote: >> The problem seems to be that you set transparency=0 in your save. >> Leave it out ( im.save("out.png") ) and you should be fine. > > Many thanks for reply, but I think You are not right. If I save without 'transparency=0' I will loose my transparent background at all - it will be black. ?With ?'transparency=0' I loose only transparency of my drawing, backround is OK. > My test image is here: http://gista.sk/dl/test.png > > >> If you just need to change the name try shutil.copy in the standard library. >> >> On Mon, Oct 19, 2009 at 2:05 PM, Ivan Mincik wrote: >> > Dear list, >> > I have PNG image in ?palette mode, with 256 color palette. Every color >> > has different level of transparency. >> > For example: >> > ?Color Table (RGB with 256 entries) >> > ? ?0: 0,0,0,0 >> > ? ?1: 238,238,238,154 >> > ? ?2: 253,253,109,154 >> > ? ?3: 0,0,0,2 >> > ? ?4: 0,0,0,4 >> > ? ?5: 0,0,0,8 >> > ? ?6: 0,0,0,6 >> > ? ?7: 237,237,237,154 >> > ? ?8: 0,0,0,14 >> > ? ?9: 35,35,15,153 >> > ? 10: 1,1,0,138 >> > >> > I am trying just to open and save this image using PIL. >> > #!/usr/bin/python >> > import Image >> > >> > im = Image.open('test.png') >> > im.save('out.png', transparency=0 ) >> > >> > After running this code, the resulting image is loosing transparency >> > information for each color and it is set to 255. >> > ?Color Table (RGB with 256 entries) >> > ? ?0: 0,0,0,0 >> > ? ?1: 238,238,238,255 >> > ? ?2: 253,253,109,255 >> > ? ?3: 0,0,0,255 >> > ? ?4: 0,0,0,255 >> > ? ?5: 0,0,0,255 >> > ? ?6: 0,0,0,255 >> > ? ?7: 237,237,237,255 >> > ? ?8: 0,0,0,255 >> > ? ?9: 35,35,15,255 >> > ? 10: 1,1,0,255 >> > >> > Is there any way how to save the image with exactly same palette as >> > original image ? >> > >> > For anybody wanting to look at this problem, You can download my test >> > image here: >> > http://gista.sk/dl/test.png >> > >> > Thanks, >> > Ivan >> > _______________________________________________ >> > Image-SIG maillist ?- ?Image-SIG at python.org >> > http://mail.python.org/mailman/listinfo/image-sig >> > >> > > > > -- > Ivan Mincik > Gista s.r.o. > From david.kwast at gmail.com Tue Oct 20 21:02:00 2009 From: david.kwast at gmail.com (David Kwast) Date: Tue, 20 Oct 2009 17:02:00 -0200 Subject: [Image-SIG] transparency in palette mode ( "P" ) images In-Reply-To: <1ed604b80910201151i3e5776bel5578ebbfe8e1cd0b@mail.gmail.com> References: <1ed604b80910191405t3dc73f7bx4453c00dadd5a556@mail.gmail.com> <200910201853.49236.ivan.mincik@gista.sk> <1ed604b80910201151i3e5776bel5578ebbfe8e1cd0b@mail.gmail.com> Message-ID: On Tue, Oct 20, 2009 at 4:51 PM, Ivan Mincik wrote: > > On Tue, Oct 20, 2009 at 8:33 PM, Laura & Edward Cannon > wrote: > > Hm.. you seem to be right. One thing you might do is im = > > Image.open("test.png").convert("RGBA") which seems to solve the > > transparency problem, at the expense of a slightly larger image file. > > No, even if using convert("RGBA") I get incorrect result :( Maybe the problem is in the decoder. Can't you use a PNG in RGBA mode instead of P mode? If it is a bug, you have to do a workaround before or after you open the PNG with PIL. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rlent at monterey.k12.ca.us Wed Oct 21 01:56:10 2009 From: rlent at monterey.k12.ca.us (Randy Lent) Date: Tue, 20 Oct 2009 16:56:10 -0700 Subject: [Image-SIG] Installation program does NOT provide file pilimages.py Message-ID: <541DF25433B5E547B4017C4D8E19666366B2A270D0@EXCHANGE.monterey.k12.ca.us> I am currently taking a class in Python. For the class, we are using version 2.6. I have attempted to install the Python Imaging Library on two different computers using this link http://effbot.org/downloads/PIL-1.1.6.win32-py2.6.exe [cid:image001.png at 01CA51A5.9DEC4040] In both cases, the pilimages.py file is missing. Not only is the file NOT in the C:\Python26\Lib\site-packages folder, a search of my entire hard drive does NOT find the file. A new folder "PIL" is created, and there are a lot of new files, but the pilimages.py file is not among them. Is there an alternate source for installing the Python Imaging Library? Sincerely, Randy Lent Randy Lent Programmer II Information Technology Department, Monterey County Office of Education 901 Blanco Circle Salinas, CA 93912 Phone: (831) 784-4165 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 3784 bytes Desc: image001.png URL: From waldemar.osuch at gmail.com Wed Oct 21 18:54:21 2009 From: waldemar.osuch at gmail.com (Waldemar Osuch) Date: Wed, 21 Oct 2009 10:54:21 -0600 Subject: [Image-SIG] Installation program does NOT provide file pilimages.py In-Reply-To: <541DF25433B5E547B4017C4D8E19666366B2A270D0@EXCHANGE.monterey.k12.ca.us> References: <541DF25433B5E547B4017C4D8E19666366B2A270D0@EXCHANGE.monterey.k12.ca.us> Message-ID: <6fae95540910210954w6b83b939kf6817793b593f66d@mail.gmail.com> On Tue, Oct 20, 2009 at 5:56 PM, Randy Lent wrote: > I am currently taking a class in Python. For the class, we are using > version 2.6. I have attempted to install the Python Imaging Library on two > different computers using this link > > http://effbot.org/downloads/PIL-1.1.6.win32-py2.6.exe > > > > > > In both cases, the pilimages.py file is missing. > > From what I can tell the "pilimages.py" is not part of PIL distribution. It is not even in the source repository. I venture a guess that the "pilimages.py" is an extra file provided by the instructor of your class Waldemar -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 3784 bytes Desc: not available URL: From fredrik at pythonware.com Wed Oct 21 19:25:46 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 21 Oct 2009 19:25:46 +0200 Subject: [Image-SIG] Installation program does NOT provide file pilimages.py In-Reply-To: <6fae95540910210954w6b83b939kf6817793b593f66d@mail.gmail.com> References: <541DF25433B5E547B4017C4D8E19666366B2A270D0@EXCHANGE.monterey.k12.ca.us> <6fae95540910210954w6b83b939kf6817793b593f66d@mail.gmail.com> Message-ID: <368a5cd50910211025k3ce45606l95b6bc41f3c8614f@mail.gmail.com> On Wed, Oct 21, 2009 at 6:54 PM, Waldemar Osuch wrote: > On Tue, Oct 20, 2009 at 5:56 PM, Randy Lent wrote: >> >> I am currently taking a class in Python.? For the class, we are using version 2.6.? I have attempted to install the Python Imaging Library on two different computers using this link >> >> http://effbot.org/downloads/PIL-1.1.6.win32-py2.6.exe >> >> In both cases, the pilimages.py file is missing. >> > From what I can tell the "pilimages.py" is not part of PIL distribution. > It is not even in the source repository. > I venture a guess that the "pilimages.py" is an extra file provided by the instructor of your class just for the archive, a quick googling finds this file: http://www.cs.wlu.edu/~stough/teaching/CS112F09/bookdemos/Ch_07_Student_Files/pilimages.py which indicates that the file is part of the training material for the class Randy's taking. From web at busino.ch Mon Oct 26 12:58:51 2009 From: web at busino.ch (Raphael Walker) Date: Mon, 26 Oct 2009 12:58:51 +0100 Subject: [Image-SIG] 64bit windows OS Message-ID: <4AE58EFB.7070404@busino.ch> > As for building PIL x64, if you want full feature support, you have to > build > some dependencies as well (zlib, libpng, jpeglib, and freetype). It's > a bit > convoluted; if you or anyone else want instructions, I'll post them > here. Hello Elias, Please give instructions for building PIL 1.1.6 for win64. 1. I added extensions for png (zlib) and jpeg (jpeg-6b/jpeg-7). my setup.py: TCL_ROOT = None JPEG_ROOT = 'jpeg-7' ZLIB_ROOT = 'zlib' TIFF_ROOT = None FREETYPE_ROOT = None LCMS_ROOT = None 2. I build PIL with : > python setup.py build build complete with: --- JPEG support available --- ZLIB (PNG/ZIP) support available 3. try selftest > python selftest.py c:\Users\rwalker\devel\building\Imaging-1.1.6>python selftest.py ***************************************************************** Failure in example: _info(Image.open("Images/lena.jpg")) from line #24 of selftest.testimage Exception raised: Traceback (most recent call last): File ".\doctest.py", line 499, in _run_examples_inner exec compile(source, "", "single") in globs File "", line 1, in File ".\selftest.py", line 22, in _info im.load() File "PIL\ImageFile.py", line 180, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "PIL\Image.py", line 375, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available 1 items had failures: 1 of 57 in selftest.testimage ***Test Failed*** 1 failures. *** 1 tests of 57 failed. 4. i search for possible errors/mistakes the _imaging.pyd has dependencies to zlib.dll. i checked your _imaging.pyd from your install package and there is no dependency to zlib.dll. what did i missed for compiling PIL on win64? Thanks, Raphael -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From elkpichico at gmail.com Mon Oct 26 19:49:08 2009 From: elkpichico at gmail.com (Andres Moreira) Date: Mon, 26 Oct 2009 16:49:08 -0200 Subject: [Image-SIG] Palette and alpha Message-ID: <20091026184908.GA5945@atlantis> Hi all, I'm using the below code to extract colors, but now, I need to extract colours with the alpha channel. I've read the PIL Doc and googling a lot, and I didn't find any information of how to load a RGBA palette, so the extractcolours method can couple with image alpha sections. def load_palette(colour_map): mapim = Image.open(colour_map) palette = [color[:3] for _, color in mapim.getcolors()] # Flatten colors to be accepted by PIL palette = tuple(reduce(lambda a, b: a+b, palette)) # create palette self.impalette = Image.new("P", (1, 1)) self.impalette.putpalette(palette) def extractcolours(filename): pilimage = Image.open(filename) im_quantized = pilimage.convert("RGB").quantize(palette=self.impalette) im_in_rgba = im_quantized.convert("RGBA", dither=self.dither) return im_in_rgba.getcolors() What I've get with this code for images with transparency is the list of colours, and the one colour : (0,0,0,255) (and all the ohters colors with alpha = 255) The convert tool from Imagemagick, return me the list of colours with all the non-(0,0,0) colours with alpha channel = 255 and (0,0,0,0). So with this list, I can couple with the aplha sections removed from my results. It's possible to do this with PIL? Thanks a lot. Andres From fabio.marcone at duet.it Thu Oct 29 12:30:49 2009 From: fabio.marcone at duet.it (Fabio Marcone) Date: Thu, 29 Oct 2009 12:30:49 +0100 Subject: [Image-SIG] tiff with 16bit/channel Message-ID: <4AE97CE9.8070104@duet.it> Hi! this is my first post here. I'm using PIL to create a thumbnail (jpeg) for an image tiff with 16 bits per channel but I got an "illegal conversion" error. Is there a way to solve it? if not, is there a way to modify pil to transform from 16 to bit image before load it in memory? someone can suggests me where I have to apply changes in source code? thanks in advance, Fabio Marcone