From 13812327 at sun.ac.za Thu May 4 14:47:58 2006 From: 13812327 at sun.ac.za (Wynand Singels) Date: Thu, 04 May 2006 12:47:58 -0000 Subject: [Image-SIG] Displaying Images and getting input from Mouse Message-ID: <000001c657e4$725d8790$8ba9e892@Bhukka.co.za> Hi there everyone I'm trying to figure out the best (and fastest way) to display a JPEG image and then input several (x,y) coordinate pairs from mouse clicks on the image. I figured out how to do this in pylab using matplotlib as follows: img = 256 - S.misc.pilutil.imread('pic1.jpg') P.imshow(img) P.connect('button_press_event',click) P.show() The function click() gets the coordinates form the event.xdata and event.ydata, but this is very slow and cumbersome. The other option I was looking at was using wxPython - a staticbitmap with EVT_LEFT_DOWN or something like that. But I'm struggling to get this to work. I also looked at the Python Image Library (PIL) but there does not seem to be one conclusive way of doing this. Please take into account that my end product will have to have a full GUI. Is there some other package I can use? Or am I missing some part of wxPython that can do this? Is there anyone that has done anything similar? Wynand From alex at tweedly.net Thu May 4 18:46:53 2006 From: alex at tweedly.net (Alex Tweedly) Date: Thu, 04 May 2006 17:46:53 +0100 Subject: [Image-SIG] Displaying Images and getting input from Mouse In-Reply-To: <000001c657e4$725d8790$8ba9e892@Bhukka.co.za> References: <000001c657e4$725d8790$8ba9e892@Bhukka.co.za> Message-ID: <445A2FFD.5060603@tweedly.net> Wynand Singels wrote: >Hi there everyone > >I'm trying to figure out the best (and fastest way) to display a JPEG image >and then input several (x,y) coordinate pairs from mouse clicks on the >image. > > >The other option I was looking at was using wxPython - a staticbitmap with >EVT_LEFT_DOWN or something like that. > You should be able to do it in wxPython - what problems did you encounter. Alternatively, there's an easier alternative in PythonCard - basically a wrapper around wxPython to make it easier to do most straightforward things - www.pythoncard.org One of the sample programs that comes with it is a simple picture viewer (in samples/pictureViewer), which shows files scaled in various ways. Adding the following few lines to it will make it do what (I think) you want. > def on_bufOff_mouseDown(self, event): > photosize = self.bmp.getSize() > windowsize = self.components.bufOff.size > print event.x * photosize[0] / windowsize[0], event.y * > photosize[1] / windowsize[1] >Please take into account that my end product will have to have a full GUI. > >Is there some other package I can use? Or am I missing some part of wxPython >that can do this? Is there anyone that has done anything similar? > > "a full GUI" covers a broad range of needs - but most straightforward things can be done in Pythoncard, and if you do need something it can't yet do, you have direct access to the rest of wxPython (so you can use Pythoncard simply as an "easy entry" to the world of wxPython). -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.3/331 - Release Date: 03/05/2006 From niversen at csc.com Wed May 3 14:39:17 2006 From: niversen at csc.com (Oluf Iversen) Date: Wed, 3 May 2006 13:39:17 +0100 Subject: [Image-SIG] Fw: Python/HP-UX problem... Message-ID: Hi, I am trying to install Python Imaging Library on a HP-UX PA-RISC box running HP-UX 11.11 and I have great difficulties with the installation. Please find attacments and explanations in the following mails. I hope you are able to helt me out with this Regards Oluf Iversen ---------------------------------------------------------------------------------------- This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. ---------------------------------------------------------------------------------------- ----- Forwarded by Oluf Iversen/SCA/CSC on 03-05-2006 14:34 ----- Oluf Iversen /SCA/CSC 03-05-2006 14:34 To: Domhnall Walsh cc: Flemming Hargum/SCA/CSC at CSC Subject: Fw: Python/HP-UX problem... Hi Domhnall, Update on the problem with Python Imaging Library I have done some additional attempts to solve the problem. Flemming and I installed a different Python from HP under internet express. It is installed in /opt/iexpress/python/bin. Following is the result of the "python setup.py install" running install running build running build_py running build_ext building '_imaging' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O1 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -DWORDS_BIGENDIAN -I/usr/local/include/freetype2 -IlibImaging -I/opt/iexpress/python/include -I/usr/local/include -I/usr/include -I/opt/iexpress/python/include/python2.4 -c _imaging.c -o build/temp.hp-ux-B.11.11-9000/800-2.4/_imaging.o In file included from /opt/iexpress/python/include/python2.4/Python.h:55, from _imaging.c:74: /opt/iexpress/python/include/python2.4/pyport.h:116:24: error: sys/select.h: No such file or directory error: command 'gcc' failed with exit status 1 As you see it seems now to locate Python.h, but we have a new problem with sys/select.h We also tried to upgrade to PIL vcersion 1.1.6a1-20051211 with the same result. Regards Oluf ---------------------------------------------------------------------------------------- This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. ---------------------------------------------------------------------------------------- ----- Forwarded by Oluf Iversen/SCA/CSC on 03-05-2006 14:22 ----- Oluf Iversen /SCA/CSC 02-05-2006 16:02 To: Domhnall Walsh cc: Subject: Re: Fw: Python/HP-UX problem... Hi Domhnall, I have located Python.h in /usr/local/include/python/ I have searched google and HP ITRC without luck. There are several references to installation of python-devel packages but I think there is somehow a reference problem between Python and the installation of Python Imaging Library rather than need for installation of additional packages. I am installing based on PIL version 1.1.5, which I downloaded from the web site you gave me a link to. The output I sent you is the result of the command "python setup.py install" as specified in the README file. This command should take care of everything (configure, make and make install) as I understand it I have also tried to download version 1.1.4 and install it. It gave similiar problems with the Python.h. However with version 1.1.4 you must configure and make according to the README file. The configure and make step completed succesfully but the build step failed with the Python.h error I attach output from version 1.1.4 configure and make Also find attachment of output from "python setup.py build" Regards Oluf ---------------------------------------------------------------------------------------- This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. ---------------------------------------------------------------------------------------- Domhnall Walsh 02-05-2006 14:56 To: Oluf Iversen/SCA/CSC at CSC cc: Subject: Re: Fw: Python/HP-UX problem... Hi Oluf: Sorry about the slow reply, had some e-mail difficulties here. Looking at the log, I'd expect that there'd be a "Python.h" somewhere in the included folders, presumably in /usr/local/include/python2.4 - is this the case? Also, could you send me the output of the configure script? (as in a dump of what it prints to STDOUT?) I want to see if it picks up everything correctly. Thanks, Domhnall. Oluf Iversen wrote: > > Hi Domhnall, > > I have tried once again to install PIL, but unfortunately I get the > same error as before when Python was installed via the binary package > > > > I will continue investigating. If you have any ideas you are welcome. > > Regards > > Oluf > ---------------------------------------------------------------------------------------- > This is a PRIVATE message. If you are not the intended recipient, > please delete without copying and kindly advise us by e-mail of the > mistake in delivery. NOTE: Regardless of content, this e-mail shall > not operate to bind CSC to any order or other contract unless pursuant > to explicit written agreement or government initiative expressly > permitting the use of e-mail for such purpose. > ---------------------------------------------------------------------------------------- > > > > > *Domhnall Walsh @astech.ie>* > > 28-04-2006 14:08 > > > To: Oluf Iversen/SCA/CSC at CSC > cc: Lavinia Raducan , Paul > Nolan , Thomas Jobs , Flemming > Hargum/SCA/CSC at CSC > Subject: Re: Fw: Python/HP-UX problem... > > > > > Hi Oluf: > > That's great news - I assume the background-related hang was because > "make" was expecting some sort of user input from you? > > Let me know how you get on with building PIL... > > Best Regards, > Domhnall > > Oluf Iversen wrote: > > > > > Hi Domhnall, > > > > I never heard anything from hpux at connect.org.uk. > > > > However I did continue to do some investigation and since the db > > module seemed to be the problem I uninstalled the current version, > > since it is fairly new and dowgraded it to version 3.1.14 > > > > After that I tried to configure and make again and I did run into some > > other problems with a "hang" of the make process, which I did in > > background. I have now done it in foreground and it works. I did a > > rerun of everything on the original setup.py and it still works. > > > > I have now a successfull installation of Python 2.4.2 from source. > > > > I will continue to do the setup of the Python Imaging Library. > > > > Regards > > > > Oluf > > > ---------------------------------------------------------------------------------------- > > This is a PRIVATE message. If you are not the intended recipient, > > please delete without copying and kindly advise us by e-mail of the > > mistake in delivery. NOTE: Regardless of content, this e-mail shall > > not operate to bind CSC to any order or other contract unless pursuant > > to explicit written agreement or government initiative expressly > > permitting the use of e-mail for such purpose. > > > ---------------------------------------------------------------------------------------- > > > > > > > > > > *Domhnall Walsh > @astech.ie>* > > > > 26-04-2006 14:36 > > > > > > To: Oluf Iversen/SCA/CSC at CSC > > cc: Lavinia Raducan , Paul > > Nolan , Thomas Jobs > > Subject: Re: Fw: Python/HP-UX problem... > > > > > > > > > > Oluf: > > > > I think that's all we can do for now - I'm eager to hear what kind of > > response you get (if any). > > > > Thanks, > > Domhnall. > > > > Oluf Iversen wrote: > > > > > > > > Hi Domhnall, > > > > > > There was a file Lib/distutils/sysconfig.py.cln. I made a copy of the > > > file to sysconfig.py.termplate and executed the configure step again > > > without errors. However the gmake phase failed again. > > > > > > I have sent an email to hpux at connect.org.uk (contact email on > > > http://hpux.cs.utah.edu/) and explained the problem and asked if they > > > can help. > > > > > > Regards > > > > > > Oluf > > > > > > ---------------------------------------------------------------------------------------- > > > This is a PRIVATE message. If you are not the intended recipient, > > > please delete without copying and kindly advise us by e-mail of the > > > mistake in delivery. NOTE: Regardless of content, this e-mail shall > > > not operate to bind CSC to any order or other contract unless pursuant > > > to explicit written agreement or government initiative expressly > > > permitting the use of e-mail for such purpose. > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > > > > > > > > > *Domhnall Walsh > > @astech.ie>* > > > > > > 26-04-2006 12:08 > > > > > > > > > To: Oluf Iversen/SCA/CSC at CSC > > > cc: Thomas Jobs , Paul Nolan > > > , Lavinia Raducan > > > Subject: Re: Fw: Python/HP-UX problem... > > > > > > > > > > > > > > > Hi Oluf: > > > > > > This missing file is important in the configuration of Python at build > > > time. I checked to see if the web-based tar interface on a couple > of the > > > HP package repositories (one in Utah, the other in the UK) could > > > retrieve it - no joy, it appears to be missing from the archive > they are > > > distributing for some reason. > > > > > > If the configure script is going wrong in this way (because of the > > > missing script), it may well explain why we are having the problems > > > we're having. Is there someone you can contact (for example) in HP > that > > > can investigate this? > > > > > > Best Regards, > > > Domhnall Walsh > > > ASTech > > > > > > Oluf Iversen wrote: > > > > > > > > > > > Hi Domhnall, > > > > > > > > One thing I did not mention to you is the following error show > in the > > > > forst line of the screen output from ./configure. > > > > > > > > ./configure[397]: Lib/distutils/sysconfig.py.template: Cannot > find or > > > > open the file. > > > > > > > > The file is not there, but the configure step completed successfully > > > > in all the tests so far, so I did not find it that important. > However > > > > I see now there is a reference to that file in the HPUX.Install > file. > > > > > > > > I will try to investigate that further. > > > > > > > > Regards > > > > > > > > Oluf > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > This is a PRIVATE message. If you are not the intended recipient, > > > > please delete without copying and kindly advise us by e-mail of the > > > > mistake in delivery. NOTE: Regardless of content, this e-mail shall > > > > not operate to bind CSC to any order or other contract unless > pursuant > > > > to explicit written agreement or government initiative expressly > > > > permitting the use of e-mail for such purpose. > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > > ----- Forwarded by Oluf Iversen/SCA/CSC on 26-04-2006 10:57 ----- > > > > > > > > *Oluf Iversen > > > > /SCA/CSC* > > > > > > > > 26-04-2006 09:27 > > > > > > > > > > > > To: Domhnall Walsh > > > > cc: > > > > Subject: Re: Python/HP-UX problem...Link > > > > > > > > > > < Notes:///C12565DB0025504E/32547D7F59F9E7E38525613200556E77/3B4C600DD82C529E8525715B004FD518 > > > > > > > > > > > > > > > > > > > > > > > > > > > Hi Domhnall, > > > > > > > > I have done what you suggested also using gmake rather than make. > > > > > > > > Resullt is the same, maybe there is a little difference in the > output, > > > > which I think is due to use of gmake rather than make > > > > > > > > Regards > > > > > > > > Oluf > > > > > > > > gcc -pthread -fno-strict-aliasing -DNDEBUG -O -D_POSIX_THREADS > > > > -I/usr/local/include/ncurses -I. -I./Include -DPy_BUILD_CORE > > > > -I/usr/local/include -c ./Modules/_bsddb.c -o Modules/_bsddb.o > > > > ./Modules/_bsddb.c: In function 'DBEnv_lock_stat': > > > > ./Modules/_bsddb.c:4104: error: 'DB_LOCK_STAT' has no member named > > > > 'st_nnowaits' > > > > ./Modules/_bsddb.c:4105: error: 'DB_LOCK_STAT' has no member named > > > > 'st_nconflicts' > > > > ./Modules/_bsddb.c: In function 'init_bsddb': > > > > ./Modules/_bsddb.c:4941: error: 'DB_LOCK_DIRTY' undeclared > (first use > > > > in this function) > > > > ./Modules/_bsddb.c:4941: error: (Each undeclared identifier is > > > > reported only once > > > > ./Modules/_bsddb.c:4941: error: for each function it appears in.) > > > > gmake: *** [Modules/_bsddb.o] Error 1 > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > This is a PRIVATE message. If you are not the intended recipient, > > > > please delete without copying and kindly advise us by e-mail of the > > > > mistake in delivery. NOTE: Regardless of content, this e-mail shall > > > > not operate to bind CSC to any order or other contract unless > pursuant > > > > to explicit written agreement or government initiative expressly > > > > permitting the use of e-mail for such purpose. > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > > *Domhnall Walsh > > > @astech.ie>* > > > > > > > > 25-04-2006 16:33 > > > > > > > > > > > > To: Oluf Iversen/SCA/CSC at CSC > > > > cc: > > > > Subject: Re: Python/HP-UX problem... > > > > > > > > > > > > > > > > > > > > Oluf: > > > > > > > > One last thing to try for today, if you don't mind; it looks > like the > > > > "--without-bsddb" configure switch might work, so please try that so > > > > that we can see what's going on here. > > > > > > > > ======================================= > > > > > > > > $ configure --without-bsddb > > > > $ gmake > > > > > > > > ======================================= > > > > > > > > Hopefully this will work. > > > > Best Regards, > > > > Domhnall Walsh > > > > ASTech > > > > > > > > Oluf Iversen wrote: > > > > > > > > > > > > > > Hi Domhnall > > > > > > > > > > Files as requested are attached > > > > > > > > > > > > > > > > > > > > Regards > > > > > > > > > > Oluf > > > > > > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > This is a PRIVATE message. If you are not the intended recipient, > > > > > please delete without copying and kindly advise us by e-mail > of the > > > > > mistake in delivery. NOTE: Regardless of content, this e-mail > shall > > > > > not operate to bind CSC to any order or other contract unless > > pursuant > > > > > to explicit written agreement or government initiative expressly > > > > > permitting the use of e-mail for such purpose. > > > > > > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > > > > > > > *Domhnall Walsh > > > > @astech.ie>* > > > > > > > > > > 25-04-2006 14:40 > > > > > > > > > > > > > > > To: Oluf Iversen/SCA/CSC at CSC > > > > > cc: > > > > > Subject: Re: Python/HP-UX problem... > > > > > > > > > > > > > > > > > > > > > > > > > Hi Oluf: > > > > > > > > > > Okay, I'll call you in a little bit (30 minutes or so, probably > > less), > > > > > but I just want to check some things first to try to be better > > > prepared. > > > > > > > > > > Until then, can you try again, but when you run the configure > > script, > > > > > specify "--without-dbm" as an option? > > > > > > > > > > In other words (from the directory containing the source files): > > > > > > > > > > ============================== > > > > > > > > > > $ ./configure --without-dbm > > > > > $ make > > > > > (etc.) > > > > > > > > > > ============================== > > > > > > > > > > Thanks, > > > > > Domhnall Walsh > > > > > ASTech > > > > > > > > > > Oluf Iversen wrote: > > > > > > > > > > > > > > > > > Hi Domnhall, > > > > > > > > > > > > Sorry but same result again. Maybe you could give me a call > > > > > > > > > > > > Regards > > > > > > > > > > > > Oluf > > > > > > > > > > > > +45 2923 6543 > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > This is a PRIVATE message. If you are not the intended > recipient, > > > > > > please delete without copying and kindly advise us by e-mail > > of the > > > > > > mistake in delivery. NOTE: Regardless of content, this e-mail > > shall > > > > > > not operate to bind CSC to any order or other contract unless > > > pursuant > > > > > > to explicit written agreement or government initiative expressly > > > > > > permitting the use of e-mail for such purpose. > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > *Domhnall Walsh > > > > > @astech.ie>* > > > > > > > > > > > > 25-04-2006 11:50 > > > > > > > > > > > > > > > > > > To: Oluf Iversen/SCA/CSC at CSC > > > > > > cc: Lavinia Raducan > > , Paul > > > > > > Nolan , Thomas Jobs > > > > > > Subject: Re: Python/HP-UX problem... > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Oluf: > > > > > > > > > > > > Can I ask you to try to add a couple more entries to the > disabled > > > > > > modules list I pointed out to you earlier? > > > > > > > > > > > > I want you to add the "bsddb3" and "pybsddb" modules, so that > > > the line > > > > > > in "setup.py" (as mentioned in my last e-mail) now reads: > > > > > > > > > > > > ========================================================= > > > > > > > > > > > > disabled_module_list = ['dbm', 'gdbm', 'bsddb', 'bsddb3', > > 'pybsddb'] > > > > > > > > > > > > ========================================================= > > > > > > > > > > > > ... and let me know how that goes? > > > > > > > > > > > > Sorry about the guesswork, I'm afraid I don't have access to a > > HP-UX > > > > > > machine at the moment... > > > > > > > > > > > > Best Regards, > > > > > > Domhnall Walsh > > > > > > ASTech > > > > > > > > > > > > Oluf Iversen wrote: > > > > > > > > > > > > > > > > > > > > Hi Domhnall > > > > > > > > > > > > > > I have tried out your suggestion. However the result is the > > same. > > > > > > > > > > > > > > Do you have any other ideas. > > > > > > > > > > > > > > Regards > > > > > > > > > > > > > > Oluf > > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > This is a PRIVATE message. If you are not the intended > > recipient, > > > > > > > please delete without copying and kindly advise us by e-mail > > > of the > > > > > > > mistake in delivery. NOTE: Regardless of content, this e-mail > > > shall > > > > > > > not operate to bind CSC to any order or other contract unless > > > > pursuant > > > > > > > to explicit written agreement or government initiative > expressly > > > > > > > permitting the use of e-mail for such purpose. > > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > *Domhnall Walsh > > > > > > @astech.ie>* > > > > > > > > > > > > > > 24-04-2006 16:30 > > > > > > > > > > > > > > > > > > > > > To: Oluf Iversen/SCA/CSC at CSC > > > > > > > cc: Paul Nolan , Lavinia > Raducan > > > > > > > , Thomas Jobs > > > > > > > Subject: Re: Python/HP-UX problem... > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hi Oluf: > > > > > > > > > > > > > > The error appears to be related to a Python database interface > > > > layer; > > > > > > > as ASTech's Python-based software doesn't use this layer, the > > > > easiest > > > > > > > solution may be to disable it. > > > > > > > > > > > > > > To do this, edit a file called "setup.py" in the root > > directory of > > > > > > > your unpacked source files (the same directory you were > running > > > > > > > "configure" and "make" from). I'm looking at the source > > > tarball for > > > > > > > Python 2.4.3 here, and in that distribution, the important > > line is > > > > > > > line 18, which looks like this: > > > > > > > > > > > > > > ========================================================= > > > > > > > > > > > > > > disabled_module_list = [] > > > > > > > > > > > > > > ========================================================= > > > > > > > > > > > > > > (The exact line number may be different in other versions, but > > > this > > > > > > > line will only appear once, close to the top of the file) > > > > > > > I suggest that you change this to: > > > > > > > > > > > > > > ========================================================= > > > > > > > > > > > > > > disabled_module_list = ['dbm', 'gdbm', 'bsddb'] > > > > > > > > > > > > > > ========================================================= > > > > > > > > > > > > > > ...and then "configure" and "make" Python again (this should > > > disable > > > > > > > the problem modules and allow the build to proceed) > > > > > > > > > > > > > > Let me know how this goes for you - if you're still having > > > problems, > > > > > > > we'll try to resolve them as quickly as possible. > > > > > > > > > > > > > > Best Regards, > > > > > > > Domhnall Walsh > > > > > > > ASTech > > > > > > > > > > > > > > Oluf Iversen wrote: > > > > > > > > > > > > > > Hi Domnhall, > > > > > > > > > > > > > > I have removed the python software (binary package) from the > > > server, > > > > > > > downloaded the source and done the configure part without > > > problems. > > > > > > > However there seems to be problems during the "make" phase > > > > > > > > > > > > > > If you have a hint you are welcome. > > > > > > > > > > > > > > I attch the screen output from the make command > > > > > > > > > > > > > > > > > > > > > > > > > > > > Regards > > > > > > > > > > > > > > Oluf > > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > This is a PRIVATE message. If you are not the intended > > recipient, > > > > > > > please delete without copying and kindly advise us by e-mail > > > of the > > > > > > > mistake in delivery. NOTE: Regardless of content, this e-mail > > > shall > > > > > > > not operate to bind CSC to any order or other contract unless > > > > pursuant > > > > > > > to explicit written agreement or government initiative > expressly > > > > > > > permitting the use of e-mail for such purpose. > > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > > > > > > > > > > *Domhnall Walsh > > > > > > @astech.ie>* > > > > > > > > > > > > > > 06-04-2006 13:59 > > > > > > > > > > > > > > > > > > > > > To: Oluf Iversen/SCA/CSC at CSC > > > > > > > cc: Paul Nolan __ > > > > > > > , Lavinia Raducan > > > > > > > __ > > > > > > > > Subject: Re: Python/HP-UX problem... > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hi Oluf: > > > > > > > > > > > > > > Having looked through the log file you sent me, I noticed in > > > > > particular > > > > > > > an issue on line 7: > > > > > > > > > > > > > > _imaging.c:74:20: error: Python.h: No such file or directory > > > > > > > > > > > > > > This seems to suggest that the version of Python that you > > > > > installed does > > > > > > > not include the development libraries - as PIL is compiled > > against > > > > > these > > > > > > > libraries, you'll need to get them. > > > > > > > > > > > > > > I believe that the best strategy here is to compile Python > from > > > > source > > > > > > > rather than (as I'm guesing you did) install a binary package > > > > (depot) > > > > > > > for Python - omitting development files from binary > packages is > > > > > quite a > > > > > > > common practice, unfortunately. > > > > > > > > > > > > > > The URL you sent me > > > > > > > > > (_http://gatekeep.cs.utah.edu/hppd/hpux/Languages/python-2.4.2/_) > > > > > has a > > > > > > > source package you can download (the fourth download option > > at the > > > > > > > bottom of the screen, package type is "Tarred/Gzipped Source > > > Code"). > > > > > > > Python itself is written in C/C++, so you'll have to untar and > > > > "make" > > > > > > > the program in the usual way (having removed the binary > package > > > > > first!), > > > > > > > and then you should be able to build PIL against that without > > > > > incident. > > > > > > > > > > > > > > Let me know how this goes for you, and if you have any further > > > > issues, > > > > > > > problems or questions, don't hesitate to contact me. > > > > > > > > > > > > > > Best Regards, > > > > > > > Domhnall Walsh. > > > > > > > > > > > > > > Oluf Iversen wrote: > > > > > > > > > > > > > > > > > > > > > > > Hi Donald, > > > > > > > > > > > > > > > > I managed to install Python 2.4.2 after download from > website > > > > > > > > _http://hpux.cs.utah.edu/hppd/hpux/Languages/python-2.4.2_ > > > > > > > > A number of dependency products had to be installed. They > > > were all > > > > > > > > downloaded from the same web site and successfully > installed. > > > > > > > > > > > > > > > > After that I downloaded Python Imaging Library (PIL) 1.1.5. > > > > from the > > > > > > > > web site you specified > > > _http://www.pythonware.com/products/pil_. I > > > > > > > found > > > > > > > > that SHLIB_PATH had to be set to the location of the "db" > > > > > software in > > > > > > > > this case /usr/local/BerkeleyDB.4.4/lib. After correct > > setup of > > > > > > > > SHLIB_PATH it turned out that a lot of other dependency > > > > products had > > > > > > > > to be installed, which has been carried out successfully. > > > > > > > > > > > > > > > > I attach the output form "python setup.py install" > > > > > > > > > > > > > > > > I have searched google and HP ITRC forum, were I did find > > > similiar > > > > > > > > errors but not exactly the same problem as you will find > > in the > > > > > > > > attachment > > > > > > > > > > > > > > > > I hope this is detailed enough. If not you, are welcome > to ask > > > > > me for > > > > > > > > further information. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Regards > > > > > > > > > > > > > > > > Oluf > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > > This is a PRIVATE message. If you are not the intended > > > recipient, > > > > > > > > please delete without copying and kindly advise us by e-mail > > > > of the > > > > > > > > mistake in delivery. NOTE: Regardless of content, this > e-mail > > > > shall > > > > > > > > not operate to bind CSC to any order or other contract > unless > > > > > pursuant > > > > > > > > to explicit written agreement or government initiative > > expressly > > > > > > > > permitting the use of e-mail for such purpose. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------------------------------------- > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > *Domhnall Walsh > > > > > > > @astech.ie>* > > > > > > > > > > > > > > > > 04-04-2006 15:14 > > > > > > > > > > > > > > > > > > > > > > > > To: Oluf Iversen/SCA/CSC at CSC > > > > > > > > cc: > > > > > > > > Subject: Python/HP-UX problem... > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hi Oluf: > > > > > > > > > > > > > > > > I've just been in contact with Lavinia, and she informs me > > that > > > > > you're > > > > > > > > having a problem with relation to the scanning system > > > > > > (Python-related, I > > > > > > > > believe). If you could send me on details of you > problem, I'll > > > > > look in > > > > > > > > to it. > > > > > > > > > > > > > > > > Best Regards, > > > > > > > > Domhnall Walsh. > > > > > > > > > > > > >------------------------------------------------------------------------ > >No virus found in this incoming message. >Checked by AVG Free Edition. >Version: 7.1.385 / Virus Database: 268.5.1/328 - Release Date: 5/1/2006 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20060503/245dec5d/attachment-0001.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: configure.out Type: application/octet-stream Size: 1253 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20060503/245dec5d/attachment-0003.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: make.out Type: application/octet-stream Size: 4474 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20060503/245dec5d/attachment-0004.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: build.out Type: application/octet-stream Size: 17012 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20060503/245dec5d/attachment-0005.obj From Chris.Barker at noaa.gov Thu May 4 22:10:18 2006 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 04 May 2006 13:10:18 -0700 Subject: [Image-SIG] Displaying Images and getting input from Mouse In-Reply-To: <000001c657e4$725d8790$8ba9e892@Bhukka.co.za> References: <000001c657e4$725d8790$8ba9e892@Bhukka.co.za> Message-ID: <445A5FAA.70209@noaa.gov> Wynand Singels wrote: > The other option I was looking at was using wxPython - a staticbitmap with > EVT_LEFT_DOWN or something like that. But I'm struggling to get this to > work. This should be quite easy in wxPython. Make sure to post to the wxPython-users list, we're a helpful bunch over there. Note that there are some issues with wxStaticBitmap and mouse events. there was a recent thread about this. Check the archives of wxPython-users. > Please take into account that my end product will have to have a full GUI. In that case, you want to pick your GUI toolkit first. You could do this with any decent GUI lib. wxPython is an excellent choice for most uses, particularly if you want good multiple platform support. > Is there some other package I can use? Or am I missing some part of wxPython > that can do this? Is there anyone that has done anything similar? Lots of folks. check the newsgroups and the wxPython demo and Wiki. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From fredrik at pythonware.com Fri May 5 00:38:06 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 5 May 2006 00:38:06 +0200 Subject: [Image-SIG] Join two images References: <007a01c66894$315e9b10$0301a8c0@Programacao> Message-ID: Ronan Lucio wrote: > IŽd like to join two images. > Actually, I need to put a logomark (145 x 70) in front of an image (640 x > 480). The logo should be placed in the left top of the image. > > Could anybody help me how to do it with PIL? > > Another question: Is it possible to do it as a watermark? google for "pil watermark", and you find: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879 From fredrik at pythonware.com Fri May 5 00:42:13 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 5 May 2006 00:42:13 +0200 Subject: [Image-SIG] Help Opening an Image File References: <24c9810c0604270616l5d07256cr6fb09e81e3116568@mail.gmail.com> Message-ID: Angela Traficante wrote: > Quick question: I tried using the Library to open an Image, but the > interpretor can't find the image file. I also can't find in the > documentation where "import Image" is supposed to get the file from. Does > anyone know where I should put the file so that the Library/Interpretor can > find it? I'm not sure what you're asking here, really: do you have problems importing the Image module, or do you have problems opening an image with the Image.open function ? if the latter, Python expects you to either provide a full path to the file you want to open, or make sure that the file is in the current directory (which is the default directory for all file operations). you can do import os print os.getcwd() to see what the current directory is set to. (the "look for files relative to current directory" thing isn't specific for PIL nor Python, of course; file access work like this on most platforms). From p.f.moore at gmail.com Fri May 5 12:38:40 2006 From: p.f.moore at gmail.com (Paul Moore) Date: Fri, 5 May 2006 11:38:40 +0100 Subject: [Image-SIG] Making the "outside" of an image transparent Message-ID: <79990c6b0605050338r3649fe01oa8c2733332bec208@mail.gmail.com> I have a rectangular image, which is a logo on a white background. I would like to modify the image to make the white background transparent (in effect, giving an irregularly shaped image). I've searched the archives, and found some details on how to make parts of an image transparent, but they aren't quite what I need. The problem I have is that parts of the interior of the image are also white, and those parts I don't want to make transparent. I searched for a flood fill algorithm that would do what I wanted, and couldn't find anything that I could use. I did find one algorithm, which I tried to modify to do what I wanted, but I've clearly misunderstood something vital, as the resulting image looked identical to the original :-( Can anyone help me? I attach my code in case it's of use, but to be honest, I'm not sure it's even close... Thanks, Paul. import Image def crop_background(image, colour = None): w, h = image.size print w*h mask = Image.new("L", image.size) if colour is None: colour = image.getpixel((0, 0)) pt = 0, 0 background = set() seen = set() candidates = set((pt,)) while candidates: pt = candidates.pop() seen.add(pt) if image.getpixel(pt) == colour: background.add(pt) i, j = pt for new_i, new_j in (i+1, j), (i, j+1), (i-1, j), (i, j-1): if 0 <= new_i < w and 0 <= new_j < h and (new_i, new_j) not in seen: candidates.add((new_i, new_j)) pix = mask.load() for i in range(w): for j in range(h): if (i, j) in background: pix[i, j] = 0 else: pix[i, j] = 1 image.putalpha(mask) print len(background) return image From solstice.dhiver at laposte.net Fri May 5 13:00:40 2006 From: solstice.dhiver at laposte.net (solsTiCe d'Hiver) Date: Fri, 5 May 2006 13:00:40 +0200 Subject: [Image-SIG] [bug ?] documentation of pil 1.1.4 Message-ID: <200605051300.40779.solstice.dhiver@laposte.net> hi. is it me or the ImageDraw.text function wants the upper _left_ corner of the text to be drawn, isn't it ? In the documentation, it is written : draw.text(position, string, options) Draws the string at the given position. The position gives the upper _right_ corner of the text. From fredrik at pythonware.com Fri May 5 14:37:30 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 5 May 2006 14:37:30 +0200 Subject: [Image-SIG] [bug ?] documentation of pil 1.1.4 References: <200605051300.40779.solstice.dhiver@laposte.net> Message-ID: "solsTiCe d'Hiver" wrote: > is it me or the ImageDraw.text function wants the upper _left_ corner of the > text to be drawn, isn't it ? yep. > In the documentation, it is written : > draw.text(position, string, options) > Draws the string at the given position. The position gives the upper _right_ > corner of the text. it's a typo; I just fixed in the development version of the docs. thanks /F From p.f.moore at gmail.com Fri May 5 19:51:34 2006 From: p.f.moore at gmail.com (Paul Moore) Date: Fri, 5 May 2006 18:51:34 +0100 Subject: [Image-SIG] Making the "outside" of an image transparent In-Reply-To: <79990c6b0605050338r3649fe01oa8c2733332bec208@mail.gmail.com> References: <79990c6b0605050338r3649fe01oa8c2733332bec208@mail.gmail.com> Message-ID: <79990c6b0605051051s4f7b51c7reca51944c36037f6@mail.gmail.com> On 5/5/06, Paul Moore wrote: > I searched for a flood fill algorithm that would do what I wanted, and > couldn't find anything that I could use. I did find one algorithm, > which I tried to modify to do what I wanted, but I've clearly > misunderstood something vital, as the resulting image looked identical > to the original :-( I managed to get the transparency side of things working - the big problem was that I didn't realize GIF transparency worked differently from other image formats, so I was doing the wrong thing there. So I can get transparency set, but I still don't know a good flood fill algorithm. Thanks, Paul. From Chris.Barker at noaa.gov Sat May 6 00:21:51 2006 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 05 May 2006 15:21:51 -0700 Subject: [Image-SIG] Displaying Images and getting input from Mouse In-Reply-To: <000001c657e4$725d8790$8ba9e892@Bhukka.co.za> References: <000001c657e4$725d8790$8ba9e892@Bhukka.co.za> Message-ID: <445BCFFF.6060800@noaa.gov> Wynand Singels wrote: > Or am I missing some part of wxPython that can do this? Here you go. I used the wx.lib.GenBitmap, as events are not very robust with the standard wx.StaticBitmap. #!/usr/bin/env python import wx import wx.lib.statbmp as statbmp class MainFrame(wx.Frame): def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) bmp = wx.Bitmap("Images/medtest.jpg") self.Image = statbmp.GenStaticBitmap(self, wx.ID_ANY, bmp) self.Image.Bind(wx.EVT_LEFT_DOWN, self.OnClick) S = wx.BoxSizer(wx.VERTICAL) S.Add(self.Image, 0) self.SetSizerAndFit(S) def OnClick(self, event): print "Image: was clicked at: %i, %i "%(event.GetX(), event.GetY()) class App(wx.App): def OnInit(self): frame = MainFrame(None, title= "wxWindowBitmap Test") self.SetTopWindow(frame) frame.Show(True) return True app = App(0) app.MainLoop() -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From jeff.garner at sanmina-sci.com Wed May 10 15:00:31 2006 From: jeff.garner at sanmina-sci.com (jeff Garner) Date: Wed, 10 May 2006 08:00:31 -0500 Subject: [Image-SIG] Images are HUGE using msn transport with PIL on Jabber2 Message-ID: <1147266031.16420.8.camel@P555LN108566> Is there a config somewhere in PIL that dictates how to scale images to specific size? I am playing with Jabberd2, PyMSNt, using the PIL to allow images other than .png's to be used on the transport and well, the images that are showing up are very large. Has anyone heard of this before? -- Jeff Garner Network Administrator Sanmina-SCI Corporation Allen, Texas 469.675.2441 972.768.5913 jeff.garner at sanmina-sci.com _____________________________________________________________________________ Scanned by Sanmina-SCI eShield _____________________________________________________________________________ From fredrik at pythonware.com Wed May 10 18:15:09 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 10 May 2006 18:15:09 +0200 Subject: [Image-SIG] Images are HUGE using msn transport with PIL on Jabber2 References: <1147266031.16420.8.camel@P555LN108566> Message-ID: "jeff Garner" wrote: > Is there a config somewhere in PIL that dictates how to scale images to > specific size? I am playing with Jabberd2, PyMSNt, using the PIL to > allow images other than .png's to be used on the transport and well, the > images that are showing up are very large. very large as in what? bytes? pixels? are you using PIL to encode images, or to decode them? what are you doing with the images? etc. From fredrik at pythonware.com Wed May 10 18:17:20 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 10 May 2006 18:17:20 +0200 Subject: [Image-SIG] Making the "outside" of an image transparent References: <79990c6b0605050338r3649fe01oa8c2733332bec208@mail.gmail.com> <79990c6b0605051051s4f7b51c7reca51944c36037f6@mail.gmail.com> Message-ID: Paul Moore wrote: > So I can get transparency set, but I still don't know a good flood > fill algorithm. eric raymond posted a nice implementation last year, which will go into 1.1.6: http://article.gmane.org/gmane.comp.python.image/1753 (note that his code doesn't work on PIL Image objects; mapping this to corresponding PIL methods is left as an exercise etc etc) From p.f.moore at gmail.com Wed May 10 23:46:32 2006 From: p.f.moore at gmail.com (Paul Moore) Date: Wed, 10 May 2006 22:46:32 +0100 Subject: [Image-SIG] Making the "outside" of an image transparent In-Reply-To: References: <79990c6b0605050338r3649fe01oa8c2733332bec208@mail.gmail.com> <79990c6b0605051051s4f7b51c7reca51944c36037f6@mail.gmail.com> Message-ID: <79990c6b0605101446hcaad27ap508112250d1ba320@mail.gmail.com> On 5/10/06, Fredrik Lundh wrote: > Paul Moore wrote: > > > So I can get transparency set, but I still don't know a good flood > > fill algorithm. > > eric raymond posted a nice implementation last year, which will go > into 1.1.6: > > http://article.gmane.org/gmane.comp.python.image/1753 > > (note that his code doesn't work on PIL Image objects; mapping this > to corresponding PIL methods is left as an exercise etc etc) That's the one I found, and based my code on. The problem I had was that it floods everything until it hits a specific colour - whereas I am looking to flood evertything of one colour, until I hit a different colour. It's almost the same, but something in the edge conditions went wrong, I think. Actually, things were made worse by the fact that I was creating images for a web page, and I hadn't realised that Internet Explorer only seems to respect transparency in GIF files. (I was avoiding GIF, as PIL doesn't compress them, for copyright reasons, as I understand it). I'll go back and look again and see if I can get that algorithm working. Thanks, Paul. From odonian at gmail.com Thu May 11 00:39:14 2006 From: odonian at gmail.com (odonian at gmail.com) Date: Wed, 10 May 2006 18:39:14 -0400 Subject: [Image-SIG] Problem compiling 1.1.5 under cygwin Message-ID: <8b9a72d30605101539n4ab302aepa6209d86e5761001@mail.gmail.com> With the latest cygwin version, when I try to compile the PIL 1.1.5 source with "python setup.py build" it seems to hang on the first .c file python setup.py build running build running build_py running build_ext building '_imaging' extension creating build/temp.cygwin-1.5.19-i686-2.4 creating build/temp.cygwin-1.5.19-i686-2.4/libImaging gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DHAVE_LIBZ -IlibImaging -I/usr/include -I/usr/include/python2.4 -c _imaging.c -o build/temp.cygwin-1.5.19-i686-2.4/_imaging.o i.e. the last line above is the last one displayed and nothing happens. Task Manager shows several python processes using up all the CPU; hitting CTRL-C will get me out of the hang. With the 1.1.6 trunk checkout, I see pretty much the same error message as above. Any suggestions to get this working? Thanks. From danny at knowledgetooldesign.com Thu May 11 02:45:05 2006 From: danny at knowledgetooldesign.com (danny at knowledgetooldesign.com) Date: Wed, 10 May 2006 19:45:05 -0500 (CDT) Subject: [Image-SIG] JPEG requirement clarification Message-ID: <50182.65.13.176.72.1147308305.squirrel@mail.zettai.net> Just completed installing PIL to my Fedora Core 5 system. I ran into a delay because I didn't understand from the PIL README instructions that I would need to install the libjpeg-devel package. Perhaps the README could be a little clearer in order to save others some frustration. Thanks. Danny Morgan From danny at knowledgetooldesign.com Thu May 11 03:06:39 2006 From: danny at knowledgetooldesign.com (danny at knowledgetooldesign.com) Date: Wed, 10 May 2006 20:06:39 -0500 (CDT) Subject: [Image-SIG] PIL (re)installation difficulty Message-ID: <50266.65.13.176.72.1147309599.squirrel@mail.zettai.net> Having proceeded with the "python setup.py install" step for installing PIL *without* JPEG support (because I didn't have the jpeg development libraries installed), I am now apparently needing to redo the installation and am not sure how to go about it After installing the devlopment libraries, I performed the installation again without making changes to the system; PIL's selftest.py passed 55/55. However, when using ATPhoto (Plone Product relying on PIL), it does fine with PNG's but not with JPG's. Can someone point me in the right direction to solving this? Danny Morgan From fredrik at pythonware.com Thu May 11 10:56:57 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 11 May 2006 10:56:57 +0200 Subject: [Image-SIG] Python/HP-UX problem... References: Message-ID: Oluf Iversen wrote: > I am trying to install Python Imaging Library on a HP-UX PA-RISC box > running HP-UX 11.11 and I have great difficulties with the installation. > Please find attacments and explanations in the following mails. > > I hope you are able to helt me out with this the original > _imaging.c:65:20: error: Python.h: No such file or directory errors you got means that Python was installed without development files (at least without the headers), or that the development files were installed somewhere else. the > /opt/iexpress/python/include/python2.4/pyport.h:116:24: error: > sys/select.h: No such file or directory indicates that the Python developer files you found was generated for an incompatible version of HP-UX, or that you're missing some HP-UX-specific developer kit. (sys/select.h is a standard Unix header file, btw; if you don't have it, you don't have a real Unix ;-). or more likely, your compiler setup is botched, in some unknown way). have you built other Python extensions on this machine ? or any non-trivial C programs at all, for that matter ? if you've successfully built other C stuff, it could be worth building Python itself from source code (you can get source tarballs from python.org), and use that to build PIL. cheers /F From schroff at robots.ox.ac.uk Sun May 14 19:07:13 2006 From: schroff at robots.ox.ac.uk (Florian Schroff) Date: Sun, 14 May 2006 18:07:13 +0100 Subject: [Image-SIG] BUGREPORT: image.tostring() Message-ID: <200605141807.14458.schroff@robots.ox.ac.uk> Hi, I'd like to file a bugreport regarding the tostring function: -first it should implement the possibility to use keywords as "save" does -the line: l, s, d = e.encode(65536) should be configurable or changed or ... I guess sth. similar with respect to "save" occured on the mailing lists already. regards, Florian From Michal.Bozon at vscht.cz Mon May 15 18:54:25 2006 From: Michal.Bozon at vscht.cz (michal bozon) Date: Mon, 15 May 2006 18:54:25 +0200 Subject: [Image-SIG] ImageFont getmask() bug? Message-ID: <4468B241.4040100@vscht.cz> Hi, following code, which uses PIL 1.1.5, generates a bitmap of text "of" rendered in Georgia font, but the result is strange, it seems like the rightmost pixel column is shifted to the left, it belongs to the "f" letter. import ImageFont fp = '/usr/share/fonts/corefonts/' font = ImageFont.truetype(fp+'georgia.ttf', 10) m = font.getmask('of', mode='1') m.save_ppm('of.ppm') The result PPM file and magnified PNG file should be attached. --michal -------------- next part -------------- A non-text attachment was scrubbed... Name: of.png Type: image/png Size: 139 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20060515/584fc6eb/attachment.png -------------- next part -------------- A non-text attachment was scrubbed... Name: of.ppm Type: image/x-portable-pixmap Size: 111 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20060515/584fc6eb/attachment.ppm From fredrik at pythonware.com Wed May 17 16:16:04 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 17 May 2006 16:16:04 +0200 Subject: [Image-SIG] BUGREPORT: image.tostring() References: <200605141807.14458.schroff@robots.ox.ac.uk> Message-ID: Florian Schroff wrote: > -first it should implement the possibility to use keywords as "save" does umm. tostring and save are two entirely different things; tostring passes the pixels to a low-level encoder, save writes an entire image to a file (use the StringIO module if you want to save an image to a string). the keywords you can use with save() has no direct mapping to the low- level encoder parameters you can use with tostring(). > l, s, d = e.encode(65536) > should be configurable or changed or ... I guess sth. similar with respect > to > "save" occured on the mailing lists already. the 64k limitation for very wide uncompressed images ("raw") has been removed in 1.1.6. From fredrik at pythonware.com Wed May 17 16:18:35 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 17 May 2006 16:18:35 +0200 Subject: [Image-SIG] ImageFont getmask() bug? References: <4468B241.4040100@vscht.cz> Message-ID: "michal bozon" wrote: > following code, which uses PIL 1.1.5, > generates a bitmap of text "of" rendered in Georgia font, > but the result is strange, it seems like the rightmost > pixel column is shifted to the left, > it belongs to the "f" letter. > > import ImageFont > fp = '/usr/share/fonts/corefonts/' > font = ImageFont.truetype(fp+'georgia.ttf', 10) > m = font.getmask('of', mode='1') > m.save_ppm('of.ppm') > > The result PPM file and magnified PNG file should be attached. the truetype renderer gets the "bearing" wrong for some characters in some fonts. this is being worked on for 1.1.6; for 1.1.5 and earlier, you can work around most problems by adding a leading and trailing space (and adjusting the text position accordingly). From k.shaposhnikov at gmail.com Wed May 17 16:28:41 2006 From: k.shaposhnikov at gmail.com (Konstantin Shaposhnikov) Date: Wed, 17 May 2006 17:28:41 +0300 Subject: [Image-SIG] Segmentation fault in ImagingDestroyBlock In-Reply-To: References: Message-ID: Hello all, I am developing script that should display character table using given true type font. Unfortunately my script fails with "Segmenation fault" message for some fonts. I have attached simplified script and font file that can be used to reproduce problem. It seems that bug occured only for certain characters (f.e. capital 'J'). I am using freetype-2.1.9 and imaging-1.15, but I am not sure that bug is related to font handling, because error occured in free(), so I suppose some problems with memory [de]allocation. Additionally I've created core dump and extracted back trace: #0 0xb7cffd8f in mallopt () from /lib/libc.so.6 #1 0xb7cfed29 in free () from /lib/libc.so.6 #2 0xb7827e9d in ImagingDestroyBlock (im=0xc548d468) at libImaging/Storage.c:307 #3 0xb7827d45 in ImagingDelete (im=0xbd3d01b8) at libImaging/Storage.c:241 #4 0xb78061d5 in _dealloc (imagep=0xb7c980a0) at _imaging.c:183 #5 0xb7eeadd3 in PyFrame_Fini () from /usr/lib/libpython2.4.so.1.0 #6 0xb7f3feee in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0 #7 0xb7f41e22 in PyEval_GetFuncDesc () from /usr/lib/libpython2.4.so.1.0 #8 0xb7f41994 in PyEval_GetFuncDesc () from /usr/lib/libpython2.4.so.1.0 #9 0xb7f3ee77 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0 #10 0xb7f41f09 in PyEval_GetFuncDesc () from /usr/lib/libpython2.4.so.1.0 #11 0xb7f41994 in PyEval_GetFuncDesc () from /usr/lib/libpython2.4.so.1.0 #12 0xb7f3ee77 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0 #13 0xb7f3fec5 in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0 #14 0xb7f3c975 in PyEval_EvalCode () from /usr/lib/libpython2.4.so.1.0 #15 0xb7f76189 in PyRun_FileExFlags () from /usr/lib/libpython2.4.so.1.0 #16 0xb7f755f3 in PyRun_SimpleFileExFlags () from /usr/lib/libpython2.4.so.1.0 #17 0xb7f74fb8 in PyRun_AnyFileExFlags () from /usr/lib/libpython2.4.so.1.0 #18 0xb7f7e2c1 in Py_Main () from /usr/lib/libpython2.4.so.1.0 #19 0x080486b9 in main () Any help and suggestions are highly appreciated. Regards, Konstantin -- http://step-inside.org -------------- next part -------------- A non-text attachment was scrubbed... Name: tools2.py Type: text/x-python Size: 555 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20060517/60b6abd1/attachment-0001.py -------------- next part -------------- A non-text attachment was scrubbed... Name: buggy-font.zip Type: application/zip Size: 18387 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20060517/60b6abd1/attachment-0001.zip From nick at nickbower.com Thu May 18 07:37:17 2006 From: nick at nickbower.com (Nick Bower) Date: Thu, 18 May 2006 13:37:17 +0800 Subject: [Image-SIG] Linking issues with 1.1.5 on x86_64 Message-ID: <200605181337.17297.nick@nickbower.com> I've some experience building PIL, but for some reason JPEG and other decoders are not working for a particular architecture (FC4 on sun x86 opterons). The build script reports JPEG support ok after I configure setup.py for /usr/lib64 and the build even seems to link correctly, but at runtime such actions as Image.open('test.jpg').save('x.jpg') report the well known "Module PIL.Image, line 328, in _getdecoder IOError: decoder jpeg not available" -------------------------------------------------------------------- PIL 1.1.5 BUILD SUMMARY -------------------------------------------------------------------- version 1.1.5 platform linux2 2.4.3 (#1, Apr 11 2006, 08:14:37) [GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] -------------------------------------------------------------------- *** TKINTER support not available --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok -------------------------------------------------------------------- gcc -pthread -shared build/temp.linux-x86_64-2.4/_imaging.o build/temp.linux-x86_64-2.4/decode.o build/temp.linux-x86_64-2.4/encode.o build/temp.linux-x86_64-2.4/map.o build/temp.linux-x86_64-2.4/display.o build/temp.linux-x86_64-2.4/outline.o build/temp.linux-x86_64-2.4/path.o build/temp.linux-x86_64-2.4/libImaging/Access.o [chop] build/temp.linux-x86_64-2.4/libImaging/JpegDecode.o build/temp.linux-x86_64-2.4/libImaging/JpegEncode.o [chop] -L/opt/ktstudio/python/python243/lib -L/usr/lib64 -L/usr/local/lib -L/usr/lib -ljpeg -lz -o build/lib.linux-x86_64-2.4/_imaging.so # ldd Imaging-1.1.5/build/lib.linux-x86_64-2.4/_imaging.so libjpeg.so.62 => /usr/lib64/libjpeg.so.62 (0x00002aaaaabf5000) libz.so.1 => /usr/lib64/libz.so.1 (0x00002aaaaad17000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aaaaae4c000) libc.so.6 => /lib64/libc.so.6 (0x00002aaaaaf62000) /lib64/ld-linux-x86-64.so.2 (0x0000555555554000) # ls -l /usr/lib64/libjpeg.so.62* lrwxrwxrwx 1 root root 17 Jan 11 00:28 /usr/lib/libjpeg.so.62 -> libjpeg.so.62.0.0 -rwxr-xr-x 1 root root 124696 Mar 3 2005 /usr/lib/libjpeg.so.62.0.0 The only thing that is different is that there are also 32 bit versions in /usr/lib. Perhaps this would generate a conflict for the loader? # ls -l /usr/lib/libjpeg* lrwxrwxrwx 1 root root 17 Jan 11 00:28 /usr/lib/libjpeg.so.62 -> libjpeg.so.62.0.0 -rwxr-xr-x 1 root root 124696 Mar 3 2005 /usr/lib/libjpeg.so.62.0.0 From nick at nickbower.com Thu May 18 08:31:18 2006 From: nick at nickbower.com (Nick Bower) Date: Thu, 18 May 2006 14:31:18 +0800 Subject: [Image-SIG] Linking issues with 1.1.5 on x86_64 In-Reply-To: <200605181337.17297.nick@nickbower.com> References: <200605181337.17297.nick@nickbower.com> Message-ID: <200605181431.18582.nick@nickbower.com> This is resolved by setting LD_LIBRARY_PATH to bump /usr/lib64 higher up the library search order. On Thu, 18 May 2006 01:37 pm, Nick Bower wrote: > I've some experience building PIL, but for some reason JPEG and other > decoders are not working for a particular architecture (FC4 on sun x86 > opterons). The build script reports JPEG support ok after I configure > setup.py > for /usr/lib64 and the build even seems to link correctly, but at runtime > such actions as Image.open('test.jpg').save('x.jpg') report the well known > "Module PIL.Image, line 328, in _getdecoder IOError: decoder jpeg not > available" > > -------------------------------------------------------------------- > PIL 1.1.5 BUILD SUMMARY > -------------------------------------------------------------------- > version 1.1.5 > platform linux2 2.4.3 (#1, Apr 11 2006, 08:14:37) > [GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] > -------------------------------------------------------------------- > *** TKINTER support not available > --- JPEG support ok > --- ZLIB (PNG/ZIP) support ok > --- FREETYPE2 support ok > -------------------------------------------------------------------- > > > gcc -pthread -shared build/temp.linux-x86_64-2.4/_imaging.o > build/temp.linux-x86_64-2.4/decode.o build/temp.linux-x86_64-2.4/encode.o > build/temp.linux-x86_64-2.4/map.o build/temp.linux-x86_64-2.4/display.o > build/temp.linux-x86_64-2.4/outline.o build/temp.linux-x86_64-2.4/path.o > build/temp.linux-x86_64-2.4/libImaging/Access.o > [chop] > build/temp.linux-x86_64-2.4/libImaging/JpegDecode.o > build/temp.linux-x86_64-2.4/libImaging/JpegEncode.o > [chop] > -L/opt/ktstudio/python/python243/lib -L/usr/lib64 -L/usr/local/lib > -L/usr/lib -ljpeg -lz -o build/lib.linux-x86_64-2.4/_imaging.so > > # ldd Imaging-1.1.5/build/lib.linux-x86_64-2.4/_imaging.so > libjpeg.so.62 => /usr/lib64/libjpeg.so.62 (0x00002aaaaabf5000) > libz.so.1 => /usr/lib64/libz.so.1 (0x00002aaaaad17000) > libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aaaaae4c000) > libc.so.6 => /lib64/libc.so.6 (0x00002aaaaaf62000) > /lib64/ld-linux-x86-64.so.2 (0x0000555555554000) > > # ls -l /usr/lib64/libjpeg.so.62* > lrwxrwxrwx 1 root root 17 Jan 11 00:28 /usr/lib/libjpeg.so.62 -> > libjpeg.so.62.0.0 > -rwxr-xr-x 1 root root 124696 Mar 3 2005 /usr/lib/libjpeg.so.62.0.0 > > The only thing that is different is that there are also 32 bit versions > in /usr/lib. Perhaps this would generate a conflict for the loader? > > # ls -l /usr/lib/libjpeg* > lrwxrwxrwx 1 root root 17 Jan 11 00:28 /usr/lib/libjpeg.so.62 -> > libjpeg.so.62.0.0 > -rwxr-xr-x 1 root root 124696 Mar 3 2005 /usr/lib/libjpeg.so.62.0.0 From fredrik at pythonware.com Thu May 18 09:14:41 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 18 May 2006 09:14:41 +0200 Subject: [Image-SIG] Linking issues with 1.1.5 on x86_64 In-Reply-To: <200605181337.17297.nick@nickbower.com> References: <200605181337.17297.nick@nickbower.com> Message-ID: Nick Bower wrote: > I've some experience building PIL, but for some reason JPEG and other decoders > are not working for a particular architecture (FC4 on sun x86 opterons). The > build script reports JPEG support ok after I configure setup.py > for /usr/lib64 and the build even seems to link correctly, but at runtime > such actions as Image.open('test.jpg').save('x.jpg') report the well known > "Module PIL.Image, line 328, in _getdecoder IOError: decoder jpeg not > available" I doubt this is a build issue as much as it is an installation issue; if the setup file says that you have JPEG support, and you don't get any linker errors, you shouldn't get any "decoder jpeg not available" messages either. try running Python with the -v (or -vv) option, to see if it really picks up the _imaging module you built. $ python -vv -c "import _imaging" From nick at nickbower.com Thu May 18 09:37:27 2006 From: nick at nickbower.com (Nick Bower) Date: Thu, 18 May 2006 15:37:27 +0800 Subject: [Image-SIG] Linking issues with 1.1.5 on x86_64 In-Reply-To: References: <200605181337.17297.nick@nickbower.com> Message-ID: <200605181537.27344.nick@nickbower.com> Ah thanks - this put me on the right track. There was an issue with multiple PILs installed. On Thu, 18 May 2006 03:14 pm, Fredrik Lundh wrote: > Nick Bower wrote: > > I've some experience building PIL, but for some reason JPEG and other > > decoders are not working for a particular architecture (FC4 on sun x86 > > opterons). The build script reports JPEG support ok after I configure > > setup.py > > for /usr/lib64 and the build even seems to link correctly, but at runtime > > such actions as Image.open('test.jpg').save('x.jpg') report the well > > known "Module PIL.Image, line 328, in _getdecoder IOError: decoder jpeg > > not available" > > I doubt this is a build issue as much as it is an installation issue; > if the setup file says that you have JPEG support, and you don't get > any linker errors, you shouldn't get any "decoder jpeg not available" > messages either. > > try running Python with the -v (or -vv) option, to see if it really > picks up the _imaging module you built. > > $ python -vv -c "import _imaging" > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From chief at dingogames.com Fri May 19 02:05:50 2006 From: chief at dingogames.com (James Sayer) Date: Thu, 18 May 2006 20:05:50 -0400 Subject: [Image-SIG] Paste RGBA to RGBA bug Message-ID: <446D0BDE.4050300@dingogames.com> Hi, I'm trying to paste an RGBA image onto another RGBA image but the blending is not working as I would expect it to. The code is something like this, where src and dst are both RGBA: src = Image.open( 'img.png' ) dst = Image.open( 'img2.png' ) dst.paste( src, None, src ) What I expect to happen is that the alpha value of 'dst' stays the same. However, what actually happens is that the new alpha value is being computed by blending 'src' alpha and 'dst' alpha together. It could be argued that this is the desired behaviour, but I don't think that it isn't consistent with other cases of using paste. In fact I found a workaround that behaves how I would expect it to. The trick is to convert src to a RGB image first, then just use the original src as the mask. src = Image.open( 'img.png' ) dst = Image.open( 'img2.png' ) srcRGB = src.convert( 'RGB' ) dst.paste( srcRGB, None, src ) Actually I did a search and found that this same problem has come up before in this thread: http://www.mail-archive.com/image-sig at python.org/msg00773.html Cheers, James Sayer From k.shaposhnikov at gmail.com Fri May 19 19:13:53 2006 From: k.shaposhnikov at gmail.com (Konstantin Shaposhnikov) Date: Fri, 19 May 2006 20:13:53 +0300 Subject: [Image-SIG] Segmentation fault in ImagingDestroyBlock In-Reply-To: References: Message-ID: Hello all, I think that I found the reason of segmentation fault - incorrect determination of size that will be used by text for true type fonts and one more bug in font rendering code. Text is drawn like this: ImageDraw.text calls font.getmask and draw bitmap returned by this function on original bitmap FreeTypeFont.getmask created empty bitmap of size returned by FreeTypeFont.getsize (i.e. _imagingft:font_getsize) and pass this bitmap to _imagingft:font_render. The problem is that for some fonts (with big slant) font_getsize returns too small size and font_render writes somewhere outside image memory that leads to segmentation fault during freeing memory. Also for fonts with backward slant rendering should start not with 0 position, but with some positive coordinate x (see attached image). I am not a font expert and unfortunately can not provide proper patch. But I would very appreciate if based on my comments somebody fix all these weird issues with fonts. Best regards, Konstantin On 5/17/06, Konstantin Shaposhnikov wrote: > Hello all, > > I am developing script that should display character table using given > true type font. > Unfortunately my script fails with "Segmenation fault" message for some fonts. > > I have attached simplified script and font file that can be used to > reproduce problem. It seems that bug occured only for certain > characters (f.e. capital 'J'). > > I am using freetype-2.1.9 and imaging-1.15, but I am not sure that bug > is related to > font handling, because error occured in free(), so I suppose some > problems with memory [de]allocation. > > Additionally I've created core dump and extracted back trace: > > #0 0xb7cffd8f in mallopt () from /lib/libc.so.6 > #1 0xb7cfed29 in free () from /lib/libc.so.6 > #2 0xb7827e9d in ImagingDestroyBlock (im=0xc548d468) > at libImaging/Storage.c:307 > #3 0xb7827d45 in ImagingDelete (im=0xbd3d01b8) at libImaging/Storage.c:241 > #4 0xb78061d5 in _dealloc (imagep=0xb7c980a0) at _imaging.c:183 > #5 0xb7eeadd3 in PyFrame_Fini () from /usr/lib/libpython2.4.so.1.0 > #6 0xb7f3feee in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0 > #7 0xb7f41e22 in PyEval_GetFuncDesc () from /usr/lib/libpython2.4.so.1.0 > #8 0xb7f41994 in PyEval_GetFuncDesc () from /usr/lib/libpython2.4.so.1.0 > #9 0xb7f3ee77 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0 > #10 0xb7f41f09 in PyEval_GetFuncDesc () from /usr/lib/libpython2.4.so.1.0 > #11 0xb7f41994 in PyEval_GetFuncDesc () from /usr/lib/libpython2.4.so.1.0 > #12 0xb7f3ee77 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0 > #13 0xb7f3fec5 in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0 > #14 0xb7f3c975 in PyEval_EvalCode () from /usr/lib/libpython2.4.so.1.0 > #15 0xb7f76189 in PyRun_FileExFlags () from /usr/lib/libpython2.4.so.1.0 > #16 0xb7f755f3 in PyRun_SimpleFileExFlags () from /usr/lib/libpython2.4.so.1.0 > #17 0xb7f74fb8 in PyRun_AnyFileExFlags () from /usr/lib/libpython2.4.so.1.0 > #18 0xb7f7e2c1 in Py_Main () from /usr/lib/libpython2.4.so.1.0 > #19 0x080486b9 in main () > > Any help and suggestions are highly appreciated. > > Regards, > Konstantin > > -- > http://step-inside.org > > -- http://step-inside.org -------------- next part -------------- A non-text attachment was scrubbed... Name: test.png Type: image/png Size: 721 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20060519/30730c39/attachment.png From perez.niurka at gmail.com Fri May 19 20:27:28 2006 From: perez.niurka at gmail.com (Niurka Perez) Date: Fri, 19 May 2006 14:27:28 -0400 Subject: [Image-SIG] PIL error: IOError: decoder jpeg not available In-Reply-To: References: Message-ID: We have used PIL since over a year now in our windows XP desktops, with no problem at all. The only functionality we use is the one related to thumbnail creation. Now we are making a deploy of the whole system we develop to a different operating system.. with the following configuration: Red Hat Linux 3.2.3-54 Python 2.4.3 PIL 1.1.5 The same combination of python and PIL versions works great in windows, but when we moved to Linux RedHat, we keep getting the error "decoder jpeg not available". We went through all the README file that comes with PIL and we make sure libjpeg6b was installed, as well as the zlib. When PIL is installed it says: *** TKINTER support not available --- JPEG support ok --- ZLIB (PNG/ZIP) support ok *** FREETYPE2 support not available But a second after PIL installation, we run selftest.py and it keeps saying the error "decoder jpeg not available". As a result, when we test our program, for gif, bmp and tif files the create thumbnails perfectly; for jpg and png we can?t. Any help will be extremmely appreciated.... We've been dealing with this problem for quite a while now... Best Regards, Niurka From fredrik at pythonware.com Fri May 19 20:45:56 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 19 May 2006 20:45:56 +0200 Subject: [Image-SIG] PIL error: IOError: decoder jpeg not available In-Reply-To: References: Message-ID: Niurka Perez wrote: > When PIL is installed it says: > *** TKINTER support not available > --- JPEG support ok > --- ZLIB (PNG/ZIP) support ok > *** FREETYPE2 support not available > > But a second after PIL installation, we run selftest.py and it keeps > saying the error "decoder jpeg not available". As a result, when we > test our program, for gif, bmp and tif files the create thumbnails > perfectly; for jpg and png we can?t. quoting myself from a message posted only a few days ago: try running Python with the -v (or -vv) option, to see if it really picks up the _imaging module you built. $ python -vv -c "import _imaging" From perez.niurka at gmail.com Fri May 19 19:13:23 2006 From: perez.niurka at gmail.com (Niurka Perez) Date: Fri, 19 May 2006 13:13:23 -0400 Subject: [Image-SIG] PIL error: IOError: decoder jpeg not available Message-ID: We have used PIL since over a year now in our windows XP desktops, with no problem at all. The only functionality we use is the one related to thumbnail creation. Now we are making a deploy of the whole system we develop to a different operating system.. with the following configuration: Red Hat Linux 3.2.3-54 Python 2.4.3 PIL 1.1.5 The same combination of python and PIL versions works great in windows, but when we moved to Linux RedHat, we keep getting the error "decoder jpeg not available". We went through all the README file that comes with PIL and we make sure libjpeg6b was installed, as well as the zlib. When PIL is installed it says: *** TKINTER support not available *--- JPEG support ok --- ZLIB (PNG/ZIP) support ok **** FREETYPE2 support not available But a second after PIL installation, we run selftest.py and it keeps saying the error "decoder jpeg not available". As a result, when we test our program, for gif, bmp and tif files the create thumbnails perfectly; for jpg and png we can?t. Any help will be extremmely appreciated.... We've been dealing with this problem for quite a while now... Best Regards, Niurka -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20060519/a65ecc80/attachment.html From rsenra at acm.org Wed May 24 02:10:39 2006 From: rsenra at acm.org (Rodrigo Senra) Date: Tue, 23 May 2006 21:10:39 -0300 Subject: [Image-SIG] PIL error: IOError: decoder jpeg not available In-Reply-To: References: Message-ID: On 19May 2006, at 2:13 PM, Niurka Perez wrote: > The same combination of python and PIL versions works great in > windows, but when we moved to Linux RedHat, we keep getting the > error "decoder jpeg not available". We went through all the README > file that comes with PIL and we make sure libjpeg6b was installed, > as well as the zlib. > > When PIL is installed it says: > *** TKINTER support not available > --- JPEG support ok > --- ZLIB (PNG/ZIP) support ok > *** FREETYPE2 support not available > > But a second after PIL installation, we run selftest.py and it > keeps saying the error "decoder jpeg not available". As a result, > when we test our program, for gif, bmp and tif files the create > thumbnails perfectly; for jpg and png we can?t. Niurka, try to install the rpm packages that hold libpng and libjpeg (the RPM package names should be homonimous). Then, re-install PIL. cheers, Senra Rodrigo Senra ______________ rsenra @ acm.org http://rodrigo.senra.nom.br From josh at clearwired.com Tue May 30 19:05:53 2006 From: josh at clearwired.com (Josh Stephenson) Date: Tue, 30 May 2006 17:05:53 +0000 Subject: [Image-SIG] libjpeg and pil on intel mac os x Message-ID: <1149008753.23661.11.camel@c-68-35-27-129.hsd1.nm.comcast.net> I'm running an intel mac 10.4 with python 2.4.2 and trying to install pil 1.1.5. I have already configured jpeg-6b. Here's how I configured it: ./configure --enabled-shared --includedir=/usr/local/include --libdir=/usr/local/lib It installed with no errors. I modified the setup.py file inside the Imaging-1.1.5 directory to point to these directories. When I run python setup.py build_ext -i it says: JPEG support ok but then I run 'python selftest.py' and I get: ***************************************************************** 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 21, 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 328, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available 1 items had failures: 1 of 55 in selftest.testimage ***Test Failed*** 1 failures. *** 1 tests of 55 failed. It isn't finding the jpeg decoder when I know it's there. Any help would be awesome! From fredrik at pythonware.com Wed May 31 08:36:19 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 31 May 2006 08:36:19 +0200 Subject: [Image-SIG] libjpeg and pil on intel mac os x In-Reply-To: <1149008753.23661.11.camel@c-68-35-27-129.hsd1.nm.comcast.net> References: <1149008753.23661.11.camel@c-68-35-27-129.hsd1.nm.comcast.net> Message-ID: Josh Stephenson wrote: > I'm running an intel mac 10.4 with python 2.4.2 and trying to install > pil 1.1.5. I have already configured jpeg-6b. Here's how I configured > it: > ./configure --enabled-shared --includedir=/usr/local/include > --libdir=/usr/local/lib > > It installed with no errors. > raise IOError("decoder %s not available" % decoder_name) > IOError: decoder jpeg not available > 1 items had failures: > 1 of 55 in selftest.testimage > ***Test Failed*** 1 failures. > *** 1 tests of 55 failed. > > It isn't finding the jpeg decoder when I know it's there. Any help > would be awesome! quoting myself from a message posted only a few days ago: try running Python with the -v (or -vv) option, to see if it really picks up the _imaging module you built. $ python -vv -c "import _imaging" (why is it that nobody ever googles after error messages any more ? hmm...) From josh at clearwired.com Wed May 31 14:36:10 2006 From: josh at clearwired.com (Josh Stephenson) Date: Wed, 31 May 2006 12:36:10 +0000 Subject: [Image-SIG] libjpeg and pil on intel mac os x In-Reply-To: References: <1149008753.23661.11.camel@c-68-35-27-129.hsd1.nm.comcast.net> Message-ID: <447D8DBA.2050904@clearwired.com> It says: import _imaging # dynamically loaded from /usr/local/lib/python2.4/site-packages/PIL/_imaging.so what now? Fredrik Lundh wrote: > Josh Stephenson wrote: > > >> I'm running an intel mac 10.4 with python 2.4.2 and trying to install >> pil 1.1.5. I have already configured jpeg-6b. Here's how I configured >> it: >> ./configure --enabled-shared --includedir=/usr/local/include >> --libdir=/usr/local/lib >> >> It installed with no errors. >> > > >> raise IOError("decoder %s not available" % decoder_name) >> IOError: decoder jpeg not available >> 1 items had failures: >> 1 of 55 in selftest.testimage >> ***Test Failed*** 1 failures. >> *** 1 tests of 55 failed. >> >> It isn't finding the jpeg decoder when I know it's there. Any help >> would be awesome! >> > > quoting myself from a message posted only a few days ago: > > try running Python with the -v (or -vv) option, to see if it really > picks up the _imaging module you built. > > $ python -vv -c "import _imaging" > > (why is it that nobody ever googles after error messages any more ? hmm...) > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > > From fredrik at pythonware.com Wed May 31 21:28:49 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 31 May 2006 21:28:49 +0200 Subject: [Image-SIG] libjpeg and pil on intel mac os x In-Reply-To: <447D8DBA.2050904@clearwired.com> References: <1149008753.23661.11.camel@c-68-35-27-129.hsd1.nm.comcast.net> <447D8DBA.2050904@clearwired.com> Message-ID: Josh Stephenson wrote: > It says: > import _imaging # dynamically loaded from > /usr/local/lib/python2.4/site-packages/PIL/_imaging.so > > what now? did setup.py say "--- JPEG support ok", btw ? as was mentioned in earlier no threads, if you get that message and have a clean build (no linker errors), there's no way you can get the "decoder not available" message from that build. if this is the case, search your disk for other copies of _imaging. if you didn't get the "support ok" message, PIL's setup file couldn't find a usable JPEG library in the standard locations; see comments at the top of setup.py for information on how to fix this. From josh at clearwired.com Wed May 31 21:58:48 2006 From: josh at clearwired.com (Josh Stephenson) Date: Wed, 31 May 2006 13:58:48 -0600 Subject: [Image-SIG] libjpeg and pil on intel mac os x In-Reply-To: References: <1149008753.23661.11.camel@c-68-35-27-129.hsd1.nm.comcast.net> <447D8DBA.2050904@clearwired.com> Message-ID: <447DF578.1030705@clearwired.com> As was mentioned in my original posting, runnig python setup.py build_ext -i says JPEG support ok. That's after I point the setup.py file to the location I installed the jpeg libraries and includes to (using the ./configure options '--includepath= and --libpath=').....it's the python selftest.py that throws: "IOError: decoder jpeg not available". -josh Fredrik Lundh wrote: > Josh Stephenson wrote: > > >> It says: >> import _imaging # dynamically loaded from >> /usr/local/lib/python2.4/site-packages/PIL/_imaging.so >> >> what now? >> > > did setup.py say "--- JPEG support ok", btw ? > > as was mentioned in earlier no threads, if you get that message and > have a clean build (no linker errors), there's no way you can get the > "decoder not available" message from that build. if this is the case, > search your disk for other copies of _imaging. > > if you didn't get the "support ok" message, PIL's setup file couldn't > find a usable JPEG library in the standard locations; see comments at > the top of setup.py for information on how to fix this. > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > > From fredrik at pythonware.com Wed May 31 22:42:10 2006 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 31 May 2006 22:42:10 +0200 Subject: [Image-SIG] libjpeg and pil on intel mac os x In-Reply-To: <447DF578.1030705@clearwired.com> References: <1149008753.23661.11.camel@c-68-35-27-129.hsd1.nm.comcast.net> <447D8DBA.2050904@clearwired.com> <447DF578.1030705@clearwired.com> Message-ID: Josh Stephenson wrote: > As was mentioned in my original posting, runnig python setup.py > build_ext -i says JPEG support ok. That's after I point the setup.py > file to the location I installed the jpeg libraries and includes to > (using the ./configure options '--includepath= and --libpath=').....it's > the python selftest.py that throws: "IOError: decoder jpeg not available". if you run "build_ext -i", the _imaging module is installed in the current directory. if you run python in that directory, and "import _imaging" picks up a copy from /usr/local, something's not quite right with your Python path. (there's no way you can get both "jpeg support ok" and "decoder jpeg not available" for the same build.) I suggest moving the version under /usr/local off the Python path before rerunning the selftest.