From astan.chee at al.com.au Mon Aug 3 03:32:49 2009 From: astan.chee at al.com.au (Astan Chee) Date: Mon, 3 Aug 2009 11:32:49 +1000 Subject: [Image-SIG] bounce animation of an image Message-ID: <4A763E41.2080209@al.com.au> Hi, I have a script that takes an image and makes it looks like it "bounces". Here it is: import Image def saveImg(p,pos): im = Image.open("new_logo.jpg") name = "new_logo." + str(p).zfill(4) + ".jpg" om = Image.new(im.mode,(im.size[0],im.size[1])) box = (0,pos,im.size[0],im.size[1]) region = im.crop(box) nbox = (0,0,im.size[0],im.size[1]-pos) om.paste(region,nbox) om.save(name,"JPEG") maxheight = 5.0 ratio = 2/3. rate = 8.0 limit = 1 pos = 0 c = maxheight p = 0 while c > limit: steps = round(rate/2.) leng = c/steps for i in range(int(steps)): saveImg(p,pos) pos+=leng p+=1 for i in range(int(steps)): saveImg(p,pos) pos-=leng p+=1 c=c*ratio But it keeps failing with a "ValueError: images do not match" when I do the pasting. What am I doing wrong? Thanks for any help. Cheers Astan From fredrik at pythonware.com Mon Aug 3 18:11:00 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 3 Aug 2009 18:11:00 +0200 Subject: [Image-SIG] bounce animation of an image In-Reply-To: <4A763E41.2080209@al.com.au> References: <4A763E41.2080209@al.com.au> Message-ID: <368a5cd50908030911m8777acatfbeeb3fbc49f7715@mail.gmail.com> On Mon, Aug 3, 2009 at 3:32 AM, Astan Chee wrote: > I have a script that takes an image and makes it looks like it "bounces". > Here it is: > ?But it keeps failing with a "ValueError: images do not match" when I do the > pasting. What am I doing wrong? You're passing in floating point coordinates to crop and paste, and it appears that crop and paste doesn't necessarily agree on how big the region is when you do that. This is probably a buglet, but you should use integer coordinates anyway; just change both calls to saveImg to: saveImg(p,int(pos+0.5)) (or do the rounding inside the function), and paste should work. From lubensch.proletariat.inc at gmail.com Mon Aug 3 11:02:49 2009 From: lubensch.proletariat.inc at gmail.com (Chris Ps) Date: Mon, 3 Aug 2009 12:02:49 +0300 Subject: [Image-SIG] TIFF image pyramids and image statistics Message-ID: Hi, I'm trying to calculate the statistics of a tiled tiff file, containing image pyramids, using PIL 1.1.6. The problem is that I have no way to exclude the pyramid levels from the calculations thus the results are not correct. I managed to achieve the required result using GDAL, but it is rather slow and I would prefer to use PIL. Are there any ideas? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik at pythonware.com Mon Aug 3 19:26:08 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 3 Aug 2009 19:26:08 +0200 Subject: [Image-SIG] Build of 1.1.6 fails In-Reply-To: <50733.96.228.116.60.1248711332.squirrel@webmail.plattsburgh.edu> References: <50733.96.228.116.60.1248711332.squirrel@webmail.plattsburgh.edu> Message-ID: <368a5cd50908031026w650f5d0dg2c769927014e67fa@mail.gmail.com> On Mon, Jul 27, 2009 at 6:15 PM, Salvador Gutierrez wrote: > Hi, > > 1. I have python2.5 in my system but it was not built from source, so > Python.h does not exist and the compile fails. > > 2. I have python3.1 also in my system (this one was built from source), so > Python.h exists but then the script calls for python2.5 and the compile > fails. > > What shall I do? Can I edit the build script to use 3.1 instead of 2.5, or > is it better to just copy Python.h to the expected location and use the > provided script? You forgot to mention what platform you're using, so I cannot give you exact details, but most platforms that have prebuilt Python binaries have special development packages available (usually called "python-dev" or something similar). The standard source package doesn't build under 2.5; 3.X is a reworked version of Python, and hardly any code written for 2.X works out of the box. There's no way you can build a 2.5 binary using a header file for 3.1. From g.kloss at massey.ac.nz Tue Aug 4 07:01:17 2009 From: g.kloss at massey.ac.nz (Guy K. Kloss) Date: Tue, 4 Aug 2009 17:01:17 +1200 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: References: Message-ID: <200908041701.17901.g.kloss@massey.ac.nz> On Mon, 27 Jul 2009 19:08:16 Gary Capell wrote: > I get this problem (with python2.6, PIL 1.1.6, numpy 1.3.0 ) > > >>> from PIL import Image > >>> import numpy > >>> i = Image.open('chart_bl.tif') > >>> a = numpy.asarray(i) > >>> o.size, a.shape > ((13228, 18710), (18710, 13228)) > >>> o.size, a.shape, a.dtype > ((13228, 18710), (18710, 13228), dtype('bool')) > >>> numpy.histogram(a) > Segmentation fault I'm assuming your image is a binary (black and white only) image. In that case histogramming doesn't make much sense. If you want the numbers of ones and zeros, just do something like that: ones = a.sum() zeros = a.shape[0] * a.shape[1] - ones HTH, Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura P?taiao o M?hiohio me P?ngarau Massey University, Albany (North Shore City, Auckland) 473 State Highway 17, Gate 1, Mailroom, Quad B Building voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss From jwt at onjapan.net Tue Aug 4 07:26:13 2009 From: jwt at onjapan.net (Jim Tittsler) Date: Tue, 04 Aug 2009 17:26:13 +1200 Subject: [Image-SIG] define color for imagem from matrix. In-Reply-To: <64f1583f0907291009s1800db1bkab610db6145e85ce@mail.gmail.com> References: <64f1583f0907291009s1800db1bkab610db6145e85ce@mail.gmail.com> Message-ID: <4A77C675.5080506@onjapan.net> On 2009-07-30 05:09, Milton Cezar Ribeiro wrote: > a = numpy.array(landscape_matrix) > i = Image.fromarray(a) > i.show() > > But now I need to define a color table like > #index of color, R, G, B > 0 255 255 255 > 1 127 127 0 > 2 127 0 127 > 3 255 0 0 > 4 0 255 0 > > How can I assign this color table to my image? If you create a "P" type image, you can use the putpalette() method to attach your desired color table. http://pythonware.com/library/pil/handbook/image.htm From jwt at onjapan.net Tue Aug 4 07:19:15 2009 From: jwt at onjapan.net (Jim Tittsler) Date: Tue, 04 Aug 2009 17:19:15 +1200 Subject: [Image-SIG] Regarding image compression In-Reply-To: References: Message-ID: <4A77C4D3.9010402@onjapan.net> On 2009-07-28 02:52, Tejovathi P wrote: > I have a JPEG image of size 25KB and I want to compress it to 15KB, But > I want to keep the original height and width same and reduce the size of > the image. Is there any easy way to achieve this? Please let me know. You can try adjusting the 'quality' keyword argument of the save() method to save space. im = Image.open('original.jpg') im.save('other.jpg', quality=50) I don't know of a way to hit your 15KB target in a single shot, but would try various quality settings until your size target is achieved. http://www.pythonware.com/library/pil/handbook/format-jpeg.htm From g.kloss at massey.ac.nz Tue Aug 4 07:30:48 2009 From: g.kloss at massey.ac.nz (Guy K. Kloss) Date: Tue, 4 Aug 2009 17:30:48 +1200 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: References: <200908041701.17901.g.kloss@massey.ac.nz> Message-ID: <200908041730.48850.g.kloss@massey.ac.nz> On Tue, 04 Aug 2009 17:07:18 you wrote: > I'm OK with the operation not making much sense, I'm not OK with python > dying with a segmentation fault. > > For what it's worth, I also get a segfault with a.sum(): Hmmm, interesting. I've just given it a try with pure numpy boolean arrays. And that worked on my setup (Ubuntu Jaunty, Python 2.6, NumPy 1.2.1). Maybe it's something really in the way that PIL aligns its image data that then is dumped into a NumPy array by plugging a header structure on top. Guy PS: I don't need a personal to with the list in CC. I read the list, and that gets sorted by my mail filter. -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura P?taiao o M?hiohio me P?ngarau Massey University, Albany (North Shore City, Auckland) 473 State Highway 17, Gate 1, Mailroom, Quad B Building voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss From fredrik at pythonware.com Tue Aug 4 11:28:35 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 4 Aug 2009 11:28:35 +0200 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: References: Message-ID: <368a5cd50908040228y83e79b2teaffe5398da8ad7f@mail.gmail.com> On Mon, Jul 27, 2009 at 9:08 AM, Gary Capell wrote: > I get this problem (with python2.6, PIL 1.1.6, numpy 1.3.0 ) > >>>> from PIL import Image >>>> import numpy >>>> i = Image.open('chart_bl.tif') >>>> a = numpy.asarray(i) >>>> o.size, a.shape > ((13228, 18710), (18710, 13228)) >>>> o.size, a.shape, a.dtype > ((13228, 18710), (18710, 13228), dtype('bool')) >>>> numpy.histogram(a) > Segmentation fault Note that PIL has its own histogram method (for a monochrome image, the counts will end up in slot 0 and 255). From g.kloss at massey.ac.nz Tue Aug 4 22:09:47 2009 From: g.kloss at massey.ac.nz (Guy K. Kloss) Date: Wed, 5 Aug 2009 08:09:47 +1200 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: <368a5cd50908040228y83e79b2teaffe5398da8ad7f@mail.gmail.com> References: <368a5cd50908040228y83e79b2teaffe5398da8ad7f@mail.gmail.com> Message-ID: <200908050809.47741.g.kloss@massey.ac.nz> Fredrik, On Tue, 04 Aug 2009 21:28:35 Fredrik Lundh wrote: > Note that PIL has its own histogram method (for a monochrome image, > the counts will end up in slot 0 and 255). that may be true. But many people (including myself) have got needs for more in-depth analyses using the functions that e. g. NumPy offers. So I guess that's something that should work as well. Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura P?taiao o M?hiohio me P?ngarau Massey University, Albany (North Shore City, Auckland) 473 State Highway 17, Gate 1, Mailroom, Quad B Building voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss From seb.haase at gmail.com Wed Aug 5 09:37:57 2009 From: seb.haase at gmail.com (Sebastian Haase) Date: Wed, 5 Aug 2009 09:37:57 +0200 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: <200908050809.47741.g.kloss@massey.ac.nz> References: <368a5cd50908040228y83e79b2teaffe5398da8ad7f@mail.gmail.com> <200908050809.47741.g.kloss@massey.ac.nz> Message-ID: Hi, I would like to take a look at the offending image, if you could make available somewhere for download - somthing like www.drop.io - Sebastian Haase On Tue, Aug 4, 2009 at 10:09 PM, Guy K. Kloss wrote: > Fredrik, > > On Tue, 04 Aug 2009 21:28:35 Fredrik Lundh wrote: >> Note that PIL has its own histogram method (for a monochrome image, >> the counts will end up in slot 0 and 255). > > that may be true. But many people (including myself) have got needs for more > in-depth analyses using the functions that e. g. NumPy offers. So I guess > that's something that should work as well. > > Guy > > -- > Guy K. Kloss > Institute of Information and Mathematical Sciences > Te Kura P?taiao o M?hiohio me P?ngarau > Massey University, Albany (North Shore City, Auckland) > 473 State Highway 17, Gate 1, Mailroom, Quad B Building > voice: +64 9 414-0800 ext. 9585 ? fax: +64 9 441-8181 > G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From fredrik at pythonware.com Wed Aug 5 12:57:42 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 5 Aug 2009 12:57:42 +0200 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: <200908050809.47741.g.kloss@massey.ac.nz> References: <368a5cd50908040228y83e79b2teaffe5398da8ad7f@mail.gmail.com> <200908050809.47741.g.kloss@massey.ac.nz> Message-ID: <368a5cd50908050357t6105cccfhd88024a828178a37@mail.gmail.com> Note that there's been some changes to the numpy interface in 1.1.7, which was recently tagged for release, even though I haven't gotten around to cut the tarballs just yet: http://hg.effbot.org/pil-2009-raclette/src/pil-117/ On Tue, Aug 4, 2009 at 10:09 PM, Guy K. Kloss wrote: > Fredrik, > > On Tue, 04 Aug 2009 21:28:35 Fredrik Lundh wrote: >> Note that PIL has its own histogram method (for a monochrome image, >> the counts will end up in slot 0 and 255). > > that may be true. But many people (including myself) have got needs for more > in-depth analyses using the functions that e. g. NumPy offers. So I guess > that's something that should work as well. > > Guy > > -- > Guy K. Kloss > Institute of Information and Mathematical Sciences > Te Kura P?taiao o M?hiohio me P?ngarau > Massey University, Albany (North Shore City, Auckland) > 473 State Highway 17, Gate 1, Mailroom, Quad B Building > voice: +64 9 414-0800 ext. 9585 ? fax: +64 9 441-8181 > G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From g.kloss at massey.ac.nz Wed Aug 5 21:52:24 2009 From: g.kloss at massey.ac.nz (Guy K. Kloss) Date: Thu, 6 Aug 2009 07:52:24 +1200 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: <368a5cd50908050357t6105cccfhd88024a828178a37@mail.gmail.com> References: <200908050809.47741.g.kloss@massey.ac.nz> <368a5cd50908050357t6105cccfhd88024a828178a37@mail.gmail.com> Message-ID: <200908060752.24361.g.kloss@massey.ac.nz> On Wed, 05 Aug 2009 22:57:42 you wrote: > Note that there's been some changes to the numpy interface in 1.1.7, > which was recently tagged for release, even though I haven't gotten > around to cut the tarballs just yet: > > http://hg.effbot.org/pil-2009-raclette/src/pil-117/ One of the biggest problems for the Linux community is, that (at least with Ubuntu) the realeases still feature 1.1.6. Also the upcoming Karmic (9.10) still features the 1.1.6 version, and I doubt it will be upgraded to 1.1.7 in time for release. I'd guess it's frozen already. So, we're going to face for almost another year these troubles of the 1.1.6 release out with the broad users of PIL. And I can understand the resistance to just go and install alternative versions versions past the package management on a broad number of systems (e. g. for universities). That's nothing against your efforts Fredrik, that's just an explanation why you/we will have to face more ongoing usage of outdated package versions. Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura P?taiao o M?hiohio me P?ngarau Massey University, Albany (North Shore City, Auckland) 473 State Highway 17, Gate 1, Mailroom, Quad B Building voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss From gary.capell at gmail.com Tue Aug 4 07:07:18 2009 From: gary.capell at gmail.com (Gary Capell) Date: Tue, 4 Aug 2009 15:07:18 +1000 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: <200908041701.17901.g.kloss@massey.ac.nz> References: <200908041701.17901.g.kloss@massey.ac.nz> Message-ID: 2009/8/4 Guy K. Kloss > On Mon, 27 Jul 2009 19:08:16 Gary Capell wrote: > > I get this problem (with python2.6, PIL 1.1.6, numpy 1.3.0 ) > > > > >>> from PIL import Image > > >>> import numpy > > >>> i = Image.open('chart_bl.tif') > > >>> a = numpy.asarray(i) > > >>> o.size, a.shape > > ((13228, 18710), (18710, 13228)) > > >>> o.size, a.shape, a.dtype > > ((13228, 18710), (18710, 13228), dtype('bool')) > > >>> numpy.histogram(a) > > Segmentation fault > > I'm assuming your image is a binary (black and white only) image. In that > case > histogramming doesn't make much sense. If you want the numbers of ones and > zeros, just do something like that: > > ones = a.sum() > zeros = a.shape[0] * a.shape[1] - ones > > I'm OK with the operation not making much sense, I'm not OK with python dying with a segmentation fault. For what it's worth, I also get a segfault with a.sum(): >>> i = Image.open('/tmp/chart_bl.tif') >>> a = numpy.asarray(i) >>> a.sum() Segmentation fault -------------- next part -------------- An HTML attachment was scrubbed... URL: From gary.capell at gmail.com Tue Aug 4 08:43:05 2009 From: gary.capell at gmail.com (Gary Capell) Date: Tue, 4 Aug 2009 16:43:05 +1000 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: <200908041730.48850.g.kloss@massey.ac.nz> References: <200908041701.17901.g.kloss@massey.ac.nz> <200908041730.48850.g.kloss@massey.ac.nz> Message-ID: 2009/8/4 Guy K. Kloss > Maybe it's something really in the way that PIL aligns its image data that > then is dumped into a NumPy array by plugging a header structure on top. That was my theory, but I worked around it rather than diving in with gdb to find out for sure. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gary.capell at gmail.com Wed Aug 5 22:25:17 2009 From: gary.capell at gmail.com (Gary Capell) Date: Thu, 6 Aug 2009 06:25:17 +1000 Subject: [Image-SIG] Fwd: problem with numpy.asarray and PIL In-Reply-To: References: <368a5cd50908040228y83e79b2teaffe5398da8ad7f@mail.gmail.com> <200908050809.47741.g.kloss@massey.ac.nz> Message-ID: I've put that bi-level tiff file which causes problems up on drop.io if anyone else wants to look at what's going wrong. It's a pretty big file, but bz2 compresses it down very well. ---------- Forwarded message ---------- From: Gary Capell Date: 2009/8/5 Subject: Re: [Image-SIG] problem with numpy.asarray and PIL To: Sebastian Haase 2009/8/5 Sebastian Haase > Hi, > I would like to take a look at the offending image, if you could make > available somewhere for download - somthing like > www.drop.io > > - http://drop.io/ir1clst and thanks, drop.io looks useful :-) -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik at pythonware.com Thu Aug 6 15:39:14 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 6 Aug 2009 15:39:14 +0200 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: <200908060752.24361.g.kloss@massey.ac.nz> References: <200908050809.47741.g.kloss@massey.ac.nz> <368a5cd50908050357t6105cccfhd88024a828178a37@mail.gmail.com> <200908060752.24361.g.kloss@massey.ac.nz> Message-ID: <368a5cd50908060639s5b50fe22j4d7629ca26169824@mail.gmail.com> On Wed, Aug 5, 2009 at 9:52 PM, Guy K. Kloss wrote: > On Wed, 05 Aug 2009 22:57:42 you wrote: >> Note that there's been some changes to the numpy interface in 1.1.7, >> which was recently tagged for release, even though I haven't gotten >> around to cut the tarballs just yet: >> >> ? ?http://hg.effbot.org/pil-2009-raclette/src/pil-117/ > > One of the biggest problems for the Linux community is, that (at least with > Ubuntu) the realeases still feature 1.1.6. Also the upcoming Karmic (9.10) > still features the 1.1.6 version, and I doubt it will be upgraded to 1.1.7 in > time for release. I'd guess it's frozen already. So, we're going to face for > almost another year these troubles of the 1.1.6 release out with the broad > users of PIL. And I can understand the resistance to just go and install > alternative versions versions past the package management on a broad number of > systems (e. g. for universities). > > That's nothing against your efforts Fredrik, that's just an explanation why > you/we will have to face more ongoing usage of outdated package versions. Sure, but it would still be interesting to know if the 1.1.7 changes actually solves this specific problem, so we know if/how it can be worked around or monkey patched. From seb.haase at gmail.com Thu Aug 6 17:09:34 2009 From: seb.haase at gmail.com (Sebastian Haase) Date: Thu, 6 Aug 2009 17:09:34 +0200 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: <368a5cd50908060639s5b50fe22j4d7629ca26169824@mail.gmail.com> References: <200908050809.47741.g.kloss@massey.ac.nz> <368a5cd50908050357t6105cccfhd88024a828178a37@mail.gmail.com> <200908060752.24361.g.kloss@massey.ac.nz> <368a5cd50908060639s5b50fe22j4d7629ca26169824@mail.gmail.com> Message-ID: >>> import Image >>> Image.VERSION '1.1.6' >>> N.__version__ '1.3.0' >>> im=Image.open('Desktop/chart_bl.tif') >>> im2= im.convert('L') >>> a = N.asarray(im2) >>> a.shape (18710, 13228) >>> a.dtype uint8 >>> a.sum() 33087362820 >>> a = N.asarray(im) >>> a.shape (18710, 13228) >>> a.dtype bool >>> a.sum() $: uname -a Linux DebianMachine 2.6.30-1-amd64 #1 SMP Sun Jul 19 13:41:28 UTC 2009 x86_64 GNU/Linux -S. On Thu, Aug 6, 2009 at 3:39 PM, Fredrik Lundh wrote: > On Wed, Aug 5, 2009 at 9:52 PM, Guy K. Kloss wrote: >> On Wed, 05 Aug 2009 22:57:42 you wrote: >>> Note that there's been some changes to the numpy interface in 1.1.7, >>> which was recently tagged for release, even though I haven't gotten >>> around to cut the tarballs just yet: >>> >>> ? ?http://hg.effbot.org/pil-2009-raclette/src/pil-117/ >> >> One of the biggest problems for the Linux community is, that (at least with >> Ubuntu) the realeases still feature 1.1.6. Also the upcoming Karmic (9.10) >> still features the 1.1.6 version, and I doubt it will be upgraded to 1.1.7 in >> time for release. I'd guess it's frozen already. So, we're going to face for >> almost another year these troubles of the 1.1.6 release out with the broad >> users of PIL. And I can understand the resistance to just go and install >> alternative versions versions past the package management on a broad number of >> systems (e. g. for universities). >> >> That's nothing against your efforts Fredrik, that's just an explanation why >> you/we will have to face more ongoing usage of outdated package versions. > > Sure, but it would still be interesting to know if the 1.1.7 changes > actually solves this specific problem, so we know if/how it can be > worked around or monkey patched. > From cbrewster at gmail.com Thu Aug 6 18:18:01 2009 From: cbrewster at gmail.com (Christopher Brewster) Date: Thu, 6 Aug 2009 18:18:01 +0200 Subject: [Image-SIG] PIL not working on Python 2.6 Message-ID: <7E94311A-FFF1-47CF-B3C5-4CBE6AA2126E@gmail.com> I am trying to use PIL on a MacBook Pro running Leopard. I have Python 2.6 installed from Python.org. An intermittent Python user I am trying to work my way through Segaran's Programming Collective Intelligence book. I had some problems installing PIL so eventually I followed the instructions from here: http://codeblogmore.com/blog/2009/01/23/installing-pil-116-python-26-leopard/ and it passed its own tests. However, now running some code from PCI, I get the following: --- Wrong JPEG library version: library is 70, caller expects 62 Traceback (most recent call last): File "cluster.py", line 174, in drawdendrogram(clust,blognames,jpeg='blogclust.jpg') File "cluster.py", line 36, in drawdendrogram img.save(jpeg, 'JPEG') File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/Image.py", line 1405, in save save_handler(self, fp, filename) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/JpegImagePlugin.py", line 409, in _save ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)]) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/ImageFile.py", line 493, in _save raise IOError("encoder error %d when writing image file" % s) IOError: encoder error -2 when writing image file --- This looks like a problem with PIL. Is there a general problem with PIL and Python 2.6? I am concurrently having a problem with ReportLab's installation which seems to be connected with PIL (but I will put that in a separate post). Thank you for any help you can provide. Christopher From janssen at parc.com Thu Aug 6 18:24:49 2009 From: janssen at parc.com (Bill Janssen) Date: Thu, 6 Aug 2009 09:24:49 PDT Subject: [Image-SIG] PIL not working on Python 2.6 In-Reply-To: <7E94311A-FFF1-47CF-B3C5-4CBE6AA2126E@gmail.com> References: <7E94311A-FFF1-47CF-B3C5-4CBE6AA2126E@gmail.com> Message-ID: <83399.1249575889@parc.com> Christopher Brewster wrote: > Wrong JPEG library version: library is 70, caller expects 62 Seems pretty clear, you're linking against the wrong libjpeg. Bill From g.kloss at massey.ac.nz Sat Aug 8 00:46:40 2009 From: g.kloss at massey.ac.nz (Guy K. Kloss) Date: Sat, 8 Aug 2009 10:46:40 +1200 Subject: [Image-SIG] problem with numpy.asarray and PIL In-Reply-To: <368a5cd50908060639s5b50fe22j4d7629ca26169824@mail.gmail.com> References: <200908060752.24361.g.kloss@massey.ac.nz> <368a5cd50908060639s5b50fe22j4d7629ca26169824@mail.gmail.com> Message-ID: <200908081046.40555.g.kloss@massey.ac.nz> On Fri, 07 Aug 2009 01:39:14 Fredrik Lundh wrote: > Sure, but it would still be interesting to know if the 1.1.7 changes > actually solves this specific problem, so we know if/how it can be > worked around or monkey patched. You're 100% right with that. Guy (Hoping that 1.1.7 will find its way into the distributions soon.) -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura P?taiao o M?hiohio me P?ngarau Massey University, Albany (North Shore City, Auckland) 473 State Highway 17, Gate 1, Mailroom, Quad B Building voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss From efotinis at yahoo.com Mon Aug 10 13:47:03 2009 From: efotinis at yahoo.com (Elias Fotinis) Date: Mon, 10 Aug 2009 14:47:03 +0300 Subject: [Image-SIG] Convert "P" image with transparent index to "RGBA" Message-ID: <3FAC6E0364FC4EBBA7A78E64371DD68F@efcore> I'm trying to extract the frames of a GIF as individual images. To do so, I keep pasting each frame over the "running total" of the previous frames, because areas that do not change are transparent. Since each GIF frame is a "P" image with a single index as transparency, how do we convert that into an "RGBA"? I could loop over the pixels and set the alpha manually, but perhaps I'm missing something obvious like: assert im.mode == 'P' im.convert('RGBA', alphaindex=n) From newton1988 at gmail.com Sun Aug 9 08:19:07 2009 From: newton1988 at gmail.com (Ryan Newton) Date: Sat, 8 Aug 2009 23:19:07 -0700 Subject: [Image-SIG] IOError: decoder jpeg not available Message-ID: <53cc3d8c0908082319k60530223w54813cb5743475bd@mail.gmail.com> Hi,I'm new to python and to learn more I've been working through python challenge. I needed PIL a few levels ago, and encountered this error, but was able to work around it. Now I don't see any way, and everything I try keeps giving me the IOError: decoder jpeg not available error. I've read a few sites where people have posted a similar problem, but there seemed to be some dispute about how to fix it. I have tried some of the suggested fixes, but I don't know enough about unix and python to follow them. I'm running OS X Version 10.5.7. How can I fix this? Thanks, Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From dr0id at bluewin.ch Sun Aug 9 08:57:52 2009 From: dr0id at bluewin.ch (DR0ID) Date: Sun, 09 Aug 2009 08:57:52 +0200 Subject: [Image-SIG] PIL-eggs not working Message-ID: <4A7E7370.2060809@bluewin.ch> Hi Using easy_install the installed egg does not work. The problem is the directory structure. Currently it is like this: PIL-1.1.7b1-py2.6-win32.egg EGG-INFO ... (here are all of the PIL files) But to work correctly it should be: PIL-1.1.7b1-py2.6-win32.egg EGG-INFO PIL and all PIL files should be in PIL. Hope that helps. Thanks. ~DR0ID From miltinho.astronauta at gmail.com Mon Aug 10 16:49:09 2009 From: miltinho.astronauta at gmail.com (Milton Cezar Ribeiro) Date: Mon, 10 Aug 2009 10:49:09 -0400 Subject: [Image-SIG] show a matrix as image Message-ID: <64f1583f0908100749o31a466f3y38ea0c18d2745d14@mail.gmail.com> Dear all, I have an object that is a matrix (i.e. a list of lists) and I neet do plot it on screen as an image. My image have values 1 and 2, and I would like set different colors for each level. I tryed figure it out without success. In fact my images are 512x512, but I include a 10x10 sample below. mymatrix=[[1,2,2,2,1,2,2,2,1,1], [2,2,1,1,1,1,2,2,1,2], [1,1,2,2,1,1,1,1,1,1], [1,2,2,1,2,1,1,2,2,2], [2,1,2,1,1,1,1,2,1,1], [1,2,2,1,2,2,1,2,1,1], [2,1,2,1,1,1,2,1,1,1], [2,2,1,2,1,2,2,2,2,2], [2,2,2,1,2,2,2,1,1,1], [1,1,1,2,2,2,1,2,2,1]] Any help are welcome. Cheers milton -------------- next part -------------- An HTML attachment was scrubbed... URL: From mkakbar at gmail.com Tue Aug 11 03:51:54 2009 From: mkakbar at gmail.com (Muhammad Akbar) Date: Mon, 10 Aug 2009 20:51:54 -0500 Subject: [Image-SIG] png and text/legend Message-ID: <53a838fc0908101851v4fccfbe2qc6560337bbe710fb@mail.gmail.com> Hello, I have been using pypng to create 2D surface plots. Now I need to add legend including text on the images. I read in the internet forums PIL can do that. I wish you could please suggest an easier way to do it. I prefer to keep pypng for the images, but may consider switching if I absolutely have to. Advance thanks, Muhammad Akbar From efotinis at yahoo.com Tue Aug 11 18:06:34 2009 From: efotinis at yahoo.com (Elias Fotinis) Date: Tue, 11 Aug 2009 19:06:34 +0300 Subject: [Image-SIG] show a matrix as image In-Reply-To: <64f1583f0908100749o31a466f3y38ea0c18d2745d14@mail.gmail.com> References: <64f1583f0908100749o31a466f3y38ea0c18d2745d14@mail.gmail.com> Message-ID: From: Milton Cezar Ribeiro > I have an object that is a matrix (i.e. a list of lists) > and I neet do plot it on screen as an image. > My image have values 1 and 2, and I would > like set different colors for each level. > I tryed figure it out without success. In fact > my images are 512x512, but I include a 10x10 sample below. > > mymatrix=[[1,2,2,2,1,2,2,2,1,1], > [2,2,1,1,1,1,2,2,1,2], > .... It's best to use a palettized image, since your data points are integers. First, create one of the right size: from PIL import Image im = Image.new('P', (512,512)) # 'P' for palettized Then, set the image data. You must use a flat list, so you need to flatten your matrix: data = sum(matrix, []) # flatten data im.putdata(data) You also have to set the palette colors for the used indices (1 and 2). The palette is a list of 768 ints (256*3), but it's somewhat easier to start with a list of 3-tuples: pal = [(0,0,0) for i in range(256)] # all black pal[1] = (255,0,0) # juicy red pal[2] = (0,255,0) # crazy green pal = sum(pal, ()) # flatten it im.setpalette(pal) That's it. You should be able to test the result with this: im.show() From efotinis at yahoo.com Tue Aug 11 18:06:10 2009 From: efotinis at yahoo.com (Elias Fotinis) Date: Tue, 11 Aug 2009 19:06:10 +0300 Subject: [Image-SIG] IOError: decoder jpeg not available In-Reply-To: <53cc3d8c0908082319k60530223w54813cb5743475bd@mail.gmail.com> References: <53cc3d8c0908082319k60530223w54813cb5743475bd@mail.gmail.com> Message-ID: <0C7CBC2C53454542A9663E2F2AB3C89E@efcore> From: Ryan Newton > I'm new to python and to learn more I've been working through python > challenge. Aaaarghhh!!! Python Challenge? I tried that a couple of years ago and it almost drove me insane! INSANE!!!11! (almost) > I needed PIL a few levels ago, and encountered this error, but was able to > work around it. Now I don't see any way, and everything I try keeps giving > me the IOError: decoder jpeg not available error. This means that PIL was built without JPEG support. You can try building libjpeg and adding it to PIL. I'm not a Mac person so I can't help with the details for that. On Windows, I just built libjpeg with its makefile, set the location of the library and the headers in PIL's setup.py and rebuilt PIL. Another option would be to avoid using JPEG images. If you need to read a JPEG for Python Challenge, just convert it to another format with some other program. From andres at insophia.com Fri Aug 21 21:51:19 2009 From: andres at insophia.com (Andres Moreira) Date: Fri, 21 Aug 2009 16:51:19 -0300 Subject: [Image-SIG] Segmentation fault on PIL Message-ID: <20090821195119.GH8379@atlantis> Hi guys, I load a palette image (I've attach it), with 1000 colors, and I want to quantize and dithering it. The error is in palette.putpalette(pal) Another, question, is this the best way of Quantize an image mapping it to that palette and dithering ? Thanks a lot! Andres Moreira. ==== CODE ==== import Image def extract_colour(image, colour_map): palette_im = Image.open(colour_map) palette_count = len(palette_im.getdata()) pal = reduce(lambda a,b:a+b, [(x[1][0],x[1][1],x[1][2]) for x in palette_im.getcolors(maxcolors=palette_count)]) # create palette palette = Image.new("P", (1,1)) palette.putpalette(pal) im = Image.open(image).convert("RGB").quantize(palette=palette) im2 = im.convert("RGBA", dither=Image.FLOYDSTEINBERG) return im2.getcolors() ========== Trace back ========== *** glibc detected *** /usr/bin/python: malloc(): memory corruption: 0x0000000002a5b950 *** ======= Backtrace: ========= /lib/libc.so.6[0x7fc416162fef] /lib/libc.so.6(__libc_malloc+0x98)[0x7fc416164828] /usr/bin/python(PyArena_New+0x26)[0x4c1be6] /usr/bin/python(PyRun_StringFlags+0x3e)[0x4c52fe] /usr/bin/python[0x49bfe5] /usr/bin/python(PyEval_EvalFrameEx+0x4e23)[0x4a2b03] /usr/bin/python(PyEval_EvalFrameEx+0x60ce)[0x4a3dae] /usr/bin/python(PyEval_EvalCodeEx+0x869)[0x4a4649] /usr/bin/python[0x5329ad] /usr/bin/python(PyObject_Call+0x5d)[0x41d3bd] /usr/bin/python[0x424f48] /usr/bin/python(PyObject_Call+0x5d)[0x41d3bd] /usr/bin/python(PyEval_CallObjectWithKeywords+0x56)[0x49cd46] /usr/bin/python[0x42b51a] /usr/bin/python(_PyObject_Str+0x6f)[0x45179f] /usr/bin/python(PyObject_Str+0x13)[0x451853] /usr/bin/python[0x45d9da] /usr/bin/python[0x46bc03] /usr/bin/python(PyObject_Call+0x5d)[0x41d3bd] /usr/bin/python(PyEval_EvalFrameEx+0x232f)[0x4a000f] /usr/bin/python(PyEval_EvalFrameEx+0x60ce)[0x4a3dae] /usr/bin/python(PyEval_EvalCodeEx+0x869)[0x4a4649] /usr/bin/python[0x5329ad] /usr/bin/python(PyObject_Call+0x5d)[0x41d3bd] /usr/bin/python[0x424f48] /usr/bin/python(PyObject_Call+0x5d)[0x41d3bd] /usr/bin/python(PyEval_CallObjectWithKeywords+0x56)[0x49cd46] /usr/bin/python[0x474efe] /usr/bin/python(_PyObject_Str+0x6f)[0x45179f] /usr/bin/python(PyObject_Str+0x13)[0x451853] /usr/bin/python[0x45d9da] /usr/bin/python[0x46bc03] /usr/bin/python(PyObject_Call+0x5d)[0x41d3bd] /usr/bin/python(PyEval_EvalFrameEx+0x232f)[0x4a000f] /usr/bin/python(PyEval_EvalCodeEx+0x869)[0x4a4649] /usr/bin/python[0x532ab4] /usr/bin/python(PyObject_Call+0x5d)[0x41d3bd] /usr/bin/python(PyEval_EvalFrameEx+0x3780)[0x4a1460] /usr/bin/python(PyEval_EvalCodeEx+0x869)[0x4a4649] /usr/bin/python[0x5329ad] /usr/bin/python(PyObject_Call+0x5d)[0x41d3bd] /usr/bin/python[0x424f48] /usr/bin/python(PyObject_Call+0x5d)[0x41d3bd] /usr/bin/python[0x425be2] /usr/bin/python(PyObject_Call+0x5d)[0x41d3bd] /usr/bin/python(PyEval_EvalFrameEx+0x232f)[0x4a000f] /usr/bin/python(PyEval_EvalCodeEx+0x869)[0x4a4649] /usr/bin/python(PyEval_EvalFrameEx+0x4fd0)[0x4a2cb0] /usr/bin/python(PyEval_EvalCodeEx+0x869)[0x4a4649] /usr/bin/python(PyEval_EvalFrameEx+0x4fd0)[0x4a2cb0] /usr/bin/python(PyEval_EvalCodeEx+0x869)[0x4a4649] /usr/bin/python(PyEval_EvalFrameEx+0x4fd0)[0x4a2cb0] /usr/bin/python(PyEval_EvalCodeEx+0x869)[0x4a4649] /usr/bin/python(PyEval_EvalCode+0x32)[0x4a4762] /usr/bin/python(PyRun_FileExFlags+0x13c)[0x4c4c3c] /usr/bin/python(PyRun_SimpleFileExFlags+0x1fb)[0x4c4f6b] /usr/bin/python(Py_Main+0xb9e)[0x4189ce] /lib/libc.so.6(__libc_start_main+0xe6)[0x7fc4161065a6] /usr/bin/python[0x417ae9] ======= Memory map: ======== 00400000-00616000 r-xp 00000000 08:02 1353694 /usr/bin/python2.6 00815000-00816000 r--p 00215000 08:02 1353694 /usr/bin/python2.6 00816000-00876000 rw-p 00216000 08:02 1353694 /usr/bin/python2.6 00876000-00885000 rw-p 00876000 00:00 0 02466000-02cd3000 rw-p 02466000 00:00 0 [heap] 3c63400000-3c63422000 r-xp 00000000 08:02 1355378 /usr/lib/libjpeg.so.62.0.0 3c63422000-3c63622000 ---p 00022000 08:02 1355378 /usr/lib/libjpeg.so.62.0.0 3c63622000-3c63623000 rw-p 00022000 08:02 1355378 /usr/lib/libjpeg.so.62.0.0 7fc40c000000-7fc40c021000 rw-p 7fc40c000000 00:00 0 7fc40c021000-7fc410000000 ---p 7fc40c021000 00:00 0 7fc413ccf000-7fc413ce5000 r-xp 00000000 08:02 63477 /lib/libgcc_s.so.1 7fc413ce5000-7fc413ee5000 ---p 00016000 08:02 63477 /lib/libgcc_s.so.1 7fc413ee5000-7fc413ee6000 r--p 00016000 08:02 63477 /lib/libgcc_s.so.1 7fc413ee6000-7fc413ee7000 rw-p 00017000 08:02 63477 /lib/libgcc_s.so.1 7fc413ee7000-7fc413f21000 r-xp 00000000 08:02 127451 /usr/lib/python2.6/dist-packages/PIL/_imaging.so 7fc413f21000-7fc414120000 ---p 0003a000 08:02 127451 /usr/lib/python2.6/dist-packages/PIL/_imaging.sAborted -------------- next part -------------- A non-text attachment was scrubbed... Name: map1000.png Type: image/png Size: 1900 bytes Desc: not available URL: From efotinis at yahoo.com Tue Aug 11 19:42:13 2009 From: efotinis at yahoo.com (Elias Fotinis) Date: Tue, 11 Aug 2009 20:42:13 +0300 Subject: [Image-SIG] show a matrix as image In-Reply-To: <64f1583f0908110922w145a721ekbed1c200db4be599@mail.gmail.com> References: <64f1583f0908100749o31a466f3y38ea0c18d2745d14@mail.gmail.com> <64f1583f0908110922w145a721ekbed1c200db4be599@mail.gmail.com> Message-ID: <29384A36B9BC4E329D91BAEDD410BACC@efcore> From: Milton Cezar Ribeiro > I tryed your suggestion but got an error message. > [snip] > AttributeError: setpalette Oops! Sorry, that should be "putpalette", not "setpalette". Also, have a look at the PIL documentation for more nice stuff: http://www.pythonware.com/library/pil/handbook/index.htm From HVerbesey at carolina.rr.com Wed Aug 12 02:13:05 2009 From: HVerbesey at carolina.rr.com (Herb Verbesey) Date: Tue, 11 Aug 2009 20:13:05 -0400 Subject: [Image-SIG] can't open an image in ASP application Message-ID: <000001ca1ae1$aab123e0$00136ba0$@rr.com> The following codes works fine when run directly in python: import Image if __name__ == '__main__': im = Image.open("e:\\wwwroot\\class59.jpg") print im.format, im.size, im.mode However, when I try inserting the following code in an ASP page I get an error that says, "im=Image.open("e:\\wwwroot\\class59.jpg") AttributeError: 'module' object has no attribute 'open'" When I do dir(Image) from the console I get ['ADAPTIVE', 'AFFINE', 'ANTIALIAS', 'BICUBIC', 'BILINEAR', 'CONTAINER', 'CUBIC', 'DEBUG', 'EXTENSION', 'EXTENT', 'FLIP_LEFT_RIGHT', 'FLIP_TOP_BOTTOM', 'FLOYDSTEINBERG', 'ID', 'Image', 'ImageMode', 'ImagePalette', 'IntType', 'LINEAR', 'MESH', 'MIME', 'MODES', 'NEAREST', 'NONE', 'NORMAL', 'OPEN', 'ORDERED', 'PERSPECTIVE', 'QUAD', 'RASTERIZE', 'ROTATE_180', 'ROTATE_270', 'ROTATE_90', 'SAVE', 'SEQUENCE', 'StringType', 'TupleType', 'UnicodeStringType', 'VERSION', 'WEB', '_E', '_ENDIAN', '_ImageCrop', '_MAPMODES', '_MODEINFO', '_MODE_CONV', '__builtins__', '__doc__', '__file__', '__name__', '_conv_type_shape', '_getdecoder', '_getencoder', '_getscaleoffset', '_imaging_not_installed', '_initialized', '_showxv', '_wedge', 'blend', 'composite', 'core', 'eval', 'fromarray', 'frombuffer', 'fromstring', 'getmodebandnames', 'getmodebands', 'getmodebase', 'getmodetype', 'init', 'isDirectory', 'isImageType', 'isNumberType', 'isSequenceType', 'isStringType', 'isTupleType', 'merge', 'new', 'open', 'os', 'preinit', 'register_extension', 'register_mime', 'register_open', 'register_save', 'string', 'sys', 'warnings'] But when I put Response.write(str(dir(Image))) inside my server script I get: ['Image', '__builtins__', '__doc__', '__file__', '__name__'] in reply Any clue as to what I need to do to open the image in my server script? Herb Verbesey -------------- next part -------------- An HTML attachment was scrubbed... URL: From cannon.el at gmail.com Thu Aug 13 03:59:47 2009 From: cannon.el at gmail.com (Laura & Edward Cannon) Date: Wed, 12 Aug 2009 18:59:47 -0700 Subject: [Image-SIG] perspective type to Image.transform Message-ID: I noticed that a version or two ago PERSPECTIVE was added along with AFFINE, QUAD, etc. to Image.transform. Did this make it into the 1.1.7 documentation? Edward Unicorn School From questions.anon at gmail.com Sat Aug 15 00:16:55 2009 From: questions.anon at gmail.com (questions anon) Date: Fri, 14 Aug 2009 15:16:55 -0700 Subject: [Image-SIG] satellite imagery Message-ID: Can anyone suggest any good python books or tutorials for using satellite imagery? -------------- next part -------------- An HTML attachment was scrubbed... URL: From novalis at novalis.org Wed Aug 19 22:12:17 2009 From: novalis at novalis.org (David Turner) Date: Wed, 19 Aug 2009 16:12:17 -0400 Subject: [Image-SIG] Languishing patch Message-ID: <1250712737.18579.394.camel@gentle> I submitted a patch a few months ago to support my webcam, but got no feedback. Can someone please review, or let me know where I should send this patch to get it incorporated? http://mail.python.org/pipermail/image-sig/2009-February/005404.html From joel.verhagen at gmail.com Fri Aug 21 16:04:14 2009 From: joel.verhagen at gmail.com (Joel Verhagen) Date: Fri, 21 Aug 2009 10:04:14 -0400 Subject: [Image-SIG] zlib.error -5 in PIL 1.1.7b1 Message-ID: I'm using PIL version 1.1.7b1 and when setting the mode of this image to RGB (http://img197.imageshack.us/img197/8961/111294.png) img = Image.open('111294.png') img.convert('RGB') And it throws the following error: Traceback (most recent call last): File "F:\4scrape\ScrapeDex\swatch prominence\test.py", line 44, in img = Image.open(image) File "C:\Python26\lib\site-packages\PIL\Image.py", line 1965, in open return factory(fp, filename) File "C:\Python26\lib\site-packages\PIL\ImageFile.py", line 91, in __init__ self._open() File "C:\Python26\lib\site-packages\PIL\PngImagePlugin.py", line 321, in _open s = self.png.call(cid, pos, len) File "C:\Python26\lib\site-packages\PIL\PngImagePlugin.py", line 112, in call return getattr(self, "chunk_" + cid)(pos, len) File "C:\Python26\lib\site-packages\PIL\PngImagePlugin.py", line 193, in chunk_iCCP self.im_info["icc_profile"] = zlib.decompress(s[i+2:]) zlib.error: Error -5 while decompressing data When doing this same process with PIL 1.1.6 final, no error is thrown. The image link above is the exact copy of the failing image, so you can use it for diagnostics. -- Joel Verhagen http://www.wintallo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From kumarlalit at nsitsolarcar.com Thu Aug 20 22:00:29 2009 From: kumarlalit at nsitsolarcar.com (lalit kumar) Date: Fri, 21 Aug 2009 01:30:29 +0530 Subject: [Image-SIG] need help Message-ID: <000001ca21d0$e1424010$a3c6c030$@com> Respected sir I m actually facing a problem with show() command in PIL . The moment i run this command, windows live photo gallery along with cmd opens which does nothing Please help Regards Lalit student -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik at pythonware.com Sat Aug 22 20:53:47 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat, 22 Aug 2009 20:53:47 +0200 Subject: [Image-SIG] zlib.error -5 in PIL 1.1.7b1 In-Reply-To: References: Message-ID: <368a5cd50908221153x25e5ba08w3e2553f784095005@mail.gmail.com> 1.1.7 attempts to read and decompress the file's ICC tag, while 1.1.6 completely ignored that. I seem to remember fixing something related to this after the 1.1.7b1 release, but I'll double-check before cutting the final branch (any day soon). On Fri, Aug 21, 2009 at 4:04 PM, Joel Verhagen wrote: > I'm using PIL version 1.1.7b1 and when setting the mode of this image to RGB > (http://img197.imageshack.us/img197/8961/111294.png) > > img = Image.open('111294.png') > img.convert('RGB') > > And it throws the following error: > > Traceback (most recent call last): > ? File "F:\4scrape\ScrapeDex\swatch prominence\test.py", line 44, in > > ??? img = Image.open(image) > ? File "C:\Python26\lib\site-packages\PIL\Image.py", line 1965, in open > ??? return factory(fp, filename) > ? File "C:\Python26\lib\site-packages\PIL\ImageFile.py", line 91, in > __init__ > ??? self._open() > ? File "C:\Python26\lib\site-packages\PIL\PngImagePlugin.py", line 321, in > _open > ??? s = self.png.call(cid, pos, len) > ? File "C:\Python26\lib\site-packages\PIL\PngImagePlugin.py", line 112, in > call > ??? return getattr(self, "chunk_" + cid)(pos, len) > ? File "C:\Python26\lib\site-packages\PIL\PngImagePlugin.py", line 193, in > chunk_iCCP > ??? self.im_info["icc_profile"] = zlib.decompress(s[i+2:]) > zlib.error: Error -5 while decompressing data > > When doing this same process with PIL 1.1.6 final, no error is thrown. The > image link above is the exact copy of the failing image, so you can use it > for diagnostics. > -- > Joel Verhagen > http://www.wintallo.com > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From ams at schronen.de Sat Aug 29 20:25:08 2009 From: ams at schronen.de (Alwin M. Schronen) Date: Sat, 29 Aug 2009 20:25:08 +0200 Subject: [Image-SIG] PIL JPEG-problem on a openSUSE 11.0 (X86-64) Message-ID: <4A997284.3080800@schronen.de> Hi from Germany, I need your help. I installed PIL without any mistakes on a openSUSE 11.0 (X86-64). I tested it with PIL 1.1.4 - 1.1.5 and 1.1.6. and Python 2.4.4. - 2.4.5. I want to use it with ZOPE/Plone ... PNG and GIF is ok - but JPEG-fotos are destroyed with stripes and Black/White. I run the selftest.py - no problems. Under the Python 2.5.2 of Suse there is no problem. What shall I do??? Thanks from Germany Alwin M. From fredrik at pythonware.com Sun Aug 30 23:30:48 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 30 Aug 2009 23:30:48 +0200 Subject: [Image-SIG] PIL JPEG-problem on a openSUSE 11.0 (X86-64) In-Reply-To: <4A997284.3080800@schronen.de> References: <4A997284.3080800@schronen.de> Message-ID: <368a5cd50908301430k63506024qabc4abd00fefcf7b@mail.gmail.com> On Sat, Aug 29, 2009 at 8:25 PM, Alwin M. Schronen wrote: > Hi from Germany, > > I need your help. > > I installed PIL without any mistakes on a openSUSE 11.0 (X86-64). > I tested it with PIL 1.1.4 - 1.1.5 and 1.1.6. > and Python 2.4.4. - 2.4.5. > > I want to use it with ZOPE/Plone ... > > PNG and GIF is ok - but JPEG-fotos are destroyed with stripes and > Black/White. > I run the selftest.py - no problems. > > Under the Python 2.5.2 of Suse there is no problem. > > What shall I do??? Not sure what you're saying here - does it work if you build PIL under Python 2.5.2, but not if you're building it under 2.4? Or are you comparing a version you built yourself with one you got from SuSE?