From jhujsak at neotopica.com Fri Dec 3 17:13:50 2004 From: jhujsak at neotopica.com (Jonathan Hujsak) Date: Fri Dec 3 17:13:54 2004 Subject: [Image-SIG] Install Issue With ActiveState Python 2.4 Message-ID: <41B090BE.4010909@neotopica.com> Hi All, I've been trying to install the latest Imaging-1.1.5b1 package into ActiveState Python: ActivePython-2.4.0-243-linux-libcpp5-ix86 The Image package builds fine and passess it's test suite without any errors. It fails, however, to install the package in the site packages directory: /usr/local/python2.4.0/lib/python2.4/site-packages The earlier release Imaging-1.1.4 built and installed perfectly. I'm moving to 1.1.5b1 because of a segmentation fault problem I'm having with ImageTk.PhotoImage - this creates a PhotoImage that crashes TkInter's Canvas. Is there an easy way to complete the 1.1.5b1 install by hand? I'm running Red Hat Linux 9 on a generic PC architecture. Many Thanks!! --Jonathan Hujsak From fredrik at pythonware.com Sat Dec 4 15:01:54 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat Dec 4 14:59:43 2004 Subject: [Image-SIG] Re: Install Issue With ActiveState Python 2.4 References: <41B090BE.4010909@neotopica.com> Message-ID: Jonathan Hujsak wrote: > I've been trying to install the latest Imaging-1.1.5b1 package into ActiveState Python: > > ActivePython-2.4.0-243-linux-libcpp5-ix86 > > The Image package builds fine and passess it's test suite without any errors. It fails, however, > to install the package in the site packages > directory. fails in what way? have you checked with the ActivePython folks? it works just fine with a standard Python distribution, at least on my machines... From spencer at spencerogden.com Sun Dec 5 00:55:56 2004 From: spencer at spencerogden.com (Spencer Ogden) Date: Sun Dec 5 00:55:51 2004 Subject: [Image-SIG] Python 2.4 Message-ID: <41B24E8C.1000403@spencerogden.com> I was wondering if there was a time frame for a windows binary for Py 2.4. Is it possible to compile the source against 2.4 myself? Spencer Ogden From tuure at laurinolli.net Tue Dec 7 08:51:01 2004 From: tuure at laurinolli.net (Tuure Laurinolli) Date: Tue Dec 7 08:52:09 2004 Subject: [Image-SIG] Re: Python 2.4 In-Reply-To: <41B24E8C.1000403@spencerogden.com> References: <41B24E8C.1000403@spencerogden.com> Message-ID: Spencer Ogden wrote: > I was wondering if there was a time frame for a windows binary for Py > 2.4. Is it possible to compile the source against 2.4 myself? There didn't seem to be any problems compiling it against 2.4. I managed to get some version up and running, but problems with the required shared libraries(I seem to have many, incompatible versions of jpeg around...) killed my enthusiasm and I returned to 2.3. From caleb.hattingh at gmail.com Tue Dec 7 20:27:50 2004 From: caleb.hattingh at gmail.com (Caleb Hattingh) Date: Tue Dec 7 20:28:03 2004 Subject: [Image-SIG] Here is code for wrapping draw.text to fit within given pixel width Message-ID: Hi I wrote the code below for the purpose of wrapping text to fit within a given pixel width: Args: drawer: Instance of "ImageDraw.Draw()" text: string of long text to be wrapped font: instance of ImageFont (I use .truetype) containerWidth: number of pixels text lines have to fit into. Outputs described after code below: ***code*** def IntelliDraw(drawer,text,font,containerWidth): words = text.split() lines = [] # prepare a return argument lines.append(words) finished = False line = 0 while not finished: thistext = lines[line] newline = [] innerFinished = False while not innerFinished: #print 'thistext: '+str(thistext) if drawer.textsize(' '.join(thistext),font)[0] > containerWidth: # this is the heart of the algorithm: we pop words off the current # sentence until the width is ok, then in the next outer loop # we move on to the next sentence. newline.insert(0,thistext.pop(-1)) else: innerFinished = True if len(newline) > 0: lines.append(newline) line = line + 1 else: finished = True tmp = [] for i in lines: tmp.append( ' '.join(i) ) lines = tmp (width,height) = drawer.textsize(lines[0],font) return (lines,width,height) ***endcode*** Outputs of function: lines: list of strings which corresponds to the given "text" argument, but broken up into list elements. width: pixel width of the first line (should be less than containerWidth) height: pixel height of first line (used for spacing successive lines) An example of how this is used is given below: ***code*** text = 'One very extremely long string that cannot possibly fit \ into a small number of pixels of horizontal width, and the idea \ is to break this text up into multiple lines that can be placed like \ a paragraph into our image' draw = ImageDraw.Draw(OurImagePreviouslyDefined) font = fontpath = ImageFont.truetype('/usr/local/share/fonts/ttf/times.ttf',26) pixelWidth = 500 # pixels lines,tmp,h = IntelliDraw(draw,text,font,pixelWidth) j = 0 for i in lines: draw.text( (0,0+j*h), i , font=font16, fill='black') j = j + 1 ***endcode*** Hopefully this code works for you. As you may observe, the algorithm is *extremely* simple and not optimal in any way. I would have loved to have found something like this on the net, but couldn't, so maybe someone else on this list is also looking. Thanks Caleb From bjourne at gmail.com Tue Dec 7 23:55:46 2004 From: bjourne at gmail.com (=?ISO-8859-1?Q?BJ=F6rn_Lindqvist?=) Date: Tue Dec 7 23:55:49 2004 Subject: [Image-SIG] A small thing with PIL and the tk and tcl libraries. Message-ID: <740c3aec041207145542b63c08@mail.gmail.com> This program: from Tkinter import * import Image, ImageTk class App(Frame): def __init__(self, master = None): Frame.__init__(self, master) im = Image.open("tile0000.png") self.pi = ImageTk.PhotoImage(im) Button(self, text = "tjaba", image = self.pi).pack() self.pi.paste(im) self.pack() if __name__ == "__main__": app = App() app.mainloop() Gave the following exception: Traceback (most recent call last): File "test1.py", line 15, in ? app = App() File "test1.py", line 11, in __init__ self.pi.paste(im) File "/usr/lib/python2.3/site-packages/PIL/ImageTk.py", line 179, in paste import _imagingtk ImportError: libtcl8.3.so: cannot open shared object file: No such file or directory But I have libtcl8.4.so in /usr/lib. I fixed it by making a symlink to libtcl8.3.so. Minor inconvenience but annoying. :) -- mvh Bj?rn From fredrik at pythonware.com Wed Dec 8 18:26:22 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Dec 8 18:24:05 2004 Subject: [Image-SIG] Re: A small thing with PIL and the tk and tcl libraries. References: <740c3aec041207145542b63c08@mail.gmail.com> Message-ID: BJörn Lindqvist wrote: > Traceback (most recent call last): > File "test1.py", line 15, in ? > app = App() > File "test1.py", line 11, in __init__ > self.pi.paste(im) > File "/usr/lib/python2.3/site-packages/PIL/ImageTk.py", line 179, in paste > import _imagingtk > ImportError: libtcl8.3.so: cannot open shared object file: No such file or > directory > > But I have libtcl8.4.so in /usr/lib. I fixed it by making a symlink to > libtcl8.3.so. Minor inconvenience but annoying. :) the PIL build scripts get the Tcl/Tk version numbers from the Tkinter you have when building PIL. If your PIL requires 8.3, whoever built it for you was using 8.3 at the time... (alternatively, if you build older versions of PIL using the Makefile.pre.in approach, it's up to you to fix the Setup.in file so it matches your config) From p.f.moore at gmail.com Thu Dec 9 12:31:00 2004 From: p.f.moore at gmail.com (Paul Moore) Date: Thu Dec 9 12:31:03 2004 Subject: [Image-SIG] Building PIL for Windows (Python 2.4) Message-ID: <79990c6b041209033115b34170@mail.gmail.com> I have successfully built PIL 1.1.5b1 for Python 2.4, using the free Mingw implementation of gcc. Here are instructions, for anyone who is interested. (Please note, there is one place I needed to modify the PIL sources - I'm not sure if what I did was the best way, but maybe Fredrik could review and apply something suitable in the core sources...) I have mingw 3.3.3 installed - you need a recent enough version to support building binaries which link to msvcr71. You need to have followed the instructions in the Python documentation ("Installing Python Modules" section 6.2.2) on building libpython24.a. You also need the libraries freetype, tiff, jpeg, zlib and libgw32c from the GnuWin32 project (gnuwin32.sourceforge.net). Get the "developer files" distributions, and unzip them into a suitable location (I used "..\Libs" relative to my PIL build directory - the instructions below will be based on this). >From ..\Libs\lib, delete all of the .lib and .dll.a files - these link to DLL versions of the libraries, and can get picked up by accident. We want to link statically, to reduce dependencies. I also have ActiveTCL (aspn.activestate.com) installed, for the TCL/TK header files and link libraries. You need to copy tcl84.lib to libtcl84.a, and tk84.lib to libtk84.a, to match mingw naming conventions. OK, that's the environment set up. Now, we need to fix a problem in the PIL sources. Edit ImPlatform.h, and comment out the definition of INT64. (This definition clashes with others in some of the Windows header files, and I found that removing it was the quickest fix to get everything to build...) Now, in setup.py, set the roots: FREETYPE_ROOT = libinclude("../Libs") JPEG_ROOT = libinclude("../Libs") TIFF_ROOT = libinclude("../Libs") ZLIB_ROOT = libinclude("../Libs") TCL_ROOT = libinclude("C:/Apps/Tcl") # Or wherever you installed ActiveTCL Finally, you need to add a couple of dependencies to the _imagingft extension (again, in setup.py): exts.append(Extension( "_imagingft", ["_imagingft.c"], libraries=["freetype", "z", "gw32c"], define_macros=defs )) [The formatting is probably messed up here - it's the addition of "z" and "gw32c" in the libraries argument that matters] Now, you should just be able to build. python setup.py build --compiler=mingw32 bdist_wininst Paul. PS I have a binary installer built. While I don't want to end up mass mailing it to everyone, if anyone can offer space to host it, I'd be happy to make it available. No guarantees beyond "it works for me", unfortunately :-) From ainarick at yahoo.fr Fri Dec 10 19:26:28 2004 From: ainarick at yahoo.fr (Eric Pons) Date: Fri Dec 10 19:30:16 2004 Subject: [Image-SIG] Python 2.4 and Windows installer Message-ID: <41B9EA54.1040402@yahoo.fr> Hello! I am a beginner in both development and Python, which I am learning by myself, and with great pleasure. I wanted to write a script to process a batch of pictures, so I tried to install PIL 1.1.4 on my windows XP. The problem is I just upgraded to Python 2.4 for which there is no installer version (I tried with the Pyhton 2.3 one just in case, but it doesn't work of course :-)). I tried to use the source but, well, as a beginner, explanations in the README file were not enough to proceed correctly and I don't get much results. Am I supposed to run setup.py from a particular folder, or should I uncompress the numerous files in the archive in a particular location to make them available from my python shell? Should I specify a path somewhere for the PI Library? Could someone lend me a hand? Thank you for your time and attention, Eric Pons. From bend at bedel.mine.nu Sat Dec 11 00:58:58 2004 From: bend at bedel.mine.nu (Ben de Luca) Date: Sat Dec 11 00:59:05 2004 Subject: [Image-SIG] development src Message-ID: <74CDF328-4B07-11D9-B061-000A9573A8C8@bedel.mine.nu> I am trying to write a few more image drivers for PIL, so I thought it wise to start with the development version. I cant seem to find the src code or access to anonymous cvs to pull down a development version to start with. I know I am probably suffering from its right in the middle of my face but I can't see it disease. Can some one point me in the right direction? bd From fredrik at pythonware.com Sat Dec 11 15:42:04 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat Dec 11 15:39:49 2004 Subject: [Image-SIG] Re: development src References: <74CDF328-4B07-11D9-B061-000A9573A8C8@bedel.mine.nu> Message-ID: Ben de Luca wrote: >I am trying to write a few more image drivers for PIL, so I thought it wise to start with the >development version. I cant seem to find the src code or access to anonymous cvs to pull down a >development version to start with. > > I know I am probably suffering from its right in the middle of my face but I can't see it disease. > Can some one point me in the right direction? http://www.effbot.org/downloads/#Imaging From fredrik at pythonware.com Sun Dec 12 10:30:01 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun Dec 12 10:27:46 2004 Subject: [Image-SIG] Re: Python 2.4 and Windows installer References: <41B9EA54.1040402@yahoo.fr> Message-ID: Eric Pons wrote: > I tried to use the source but, well, as a beginner, explanations in the README file were not > enough to proceed correctly and I don't get much results. Am I supposed to run setup.py from a > particular folder, or should I uncompress the numerous files in the archive in a particular > location to make them available from my python shell? Should I specify a path somewhere for the PI > Library? one would have thought that items 4 and 5 explained that: 4. When you have everything you need, unpack the PIL distribution (the file Imaging-1.1.5b1.tar.gz) in your Python extensions directory (if you have one, that is. If not, feel free to unpack it in any other suitable directory). $ cd Python-2.3/Extensions # example $ gunzip Imaging-1.1.5b1.tar.gz $ tar xvf Imaging-1.1.5b1.tar 5. Build the library. We recommend that you do an in-place build, and run the self test before installing. $ cd Imaging-1.1.5b1 $ python setup.py build_ext -i $ python selftest.py When the build finishes, a summary report is shown. /.../ how far did you get, and what happened when you got stuck? (you do have a C compiler on your machine, right?) From fredrik at pythonware.com Sun Dec 12 18:54:38 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun Dec 12 19:01:18 2004 Subject: [Image-SIG] FYI: PIL and Python 2.4 Message-ID: cross-posted from comp.lang.python: > PIL > PI = Py (in french, it's the same 'sound') > => PIL = (Py)L > and Py become P24 > => PIL = (P24)L > however, 'L' Christmas finishes It (in french, Christmas = NoëL) > and '(P24)' can to do readed like "Prepare, 24, for" > => PIL = (P24)L => Prepare, 24 for NoëL (Christmas) > > Therefore, I hope that Fredick Lundh is a reincarnation of Santa Claus, and > that we will have a PIL for Python 2.4 in Christmas. "Wo ist mein paket?" "Was für ein paket?" "Mein paket?!" "Kein paket! Hohoho!" http://effbot.org/downloads/#PIL From corvin at python.ru Sun Dec 12 19:35:35 2004 From: corvin at python.ru (Alexey Melchakov) Date: Sun Dec 12 19:35:39 2004 Subject: [Image-SIG] PIL 1.1.4 Message-ID: <41BC8F77.1080701@python.ru> I meet this exception while wew using PIL: return PIL.Image.open(fp) File "/home/bragit-www/local/lib/python2.3/site-packages/PIL/Image.py", line 1567, in open return factory(fp, filename) File "/home/bragit-www/local/lib/python2.3/site-packages/PIL/ImageFile.py", line 78, in __init__ self._open() File "/home/bragit-www/local/lib/python2.3/site-packages/PIL/FpxImagePlugin.py", line 63, in _open self.ole = OleFileIO(self.fp) File "/home/bragit-www/local/lib/python2.3/site-packages/PIL/OleFileIO.py", line 253, in __init__ self.open(filename) File "/home/bragit-www/local/lib/python2.3/site-packages/PIL/OleFileIO.py", line 279, in open self.loadfat(header) File "/home/bragit-www/local/lib/python2.3/site-packages/PIL/OleFileIO.py", line 298, in loadfat if ix == 0xFFFFFFFEL or x == 0xFFFFFFFFL: NameError: global name 'x' is not defined It seems like a misstype, code should look like this: --- OleFileIO.py.orig Sun Dec 12 21:32:33 2004 +++ OleFileIO.py Sun Dec 12 21:32:36 2004 @@ -295,7 +295,7 @@ fat = [] for i in range(0, len(sect), 4): ix = i32(sect, i) - if ix == 0xFFFFFFFEL or x == 0xFFFFFFFFL: + if ix == 0xFFFFFFFEL or ix == 0xFFFFFFFFL: break s = self.getsect(ix) fat = fat + map(lambda i, s=s: i32(s, i), range(0, len(s), 4)) -- corvin@python.ru CRV-RIPN From fredrik at pythonware.com Sun Dec 12 20:06:18 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun Dec 12 20:06:25 2004 Subject: [Image-SIG] Re: PIL 1.1.4 References: <41BC8F77.1080701@python.ru> Message-ID: Alexey Melchakov wrote: > I meet this exception while wew using PIL: > "/home/bragit-www/local/lib/python2.3/site-packages/PIL/OleFileIO.py", line 279, in open > self.loadfat(header) > File "/home/bragit-www/local/lib/python2.3/site-packages/PIL/OleFileIO.py", line 298, in loadfat > if ix == 0xFFFFFFFEL or x == 0xFFFFFFFFL: > NameError: global name 'x' is not defined it's a known bug (it has been fixed in 1.1.5), and the fix looks exactly like your suggestion. http://effbot.org/zone/pil-errata-114.htm#pil132 thanks /F From mike at pcblokes.com Mon Dec 13 09:39:45 2004 From: mike at pcblokes.com (Voidspace) Date: Mon Dec 13 09:39:51 2004 Subject: [Image-SIG] Compiling PIL for 2.4 Message-ID: <41BD5551.7090800@pcblokes.com> I've just upgraded to Python 2.4. I've installed the free microsoft optimising compiler and hacked distutils to use it - following the instructions from http://www.vrplumber.com/programming/mstoolkit/ . It works great and I've built a windows installer for PyCrypto 2.0. I'm attempting to compile PIL for python 2.4. The build instructions for windows say : If you're using Python 2.0 or later, you can use the setup.py script to build the library. The following commands should do the trick: $ python setup.py build $ python setup.py install You may need to tweak the setup.py file somewhat in order to make it find certain external libraries; see comments in the file for details. Right - so you actually need to *get* the zlib and jpeg libraries, which I've done. I've not yet got the right header/include files for Tkinter, but it should work without them (just not build those files). Except it bombs out : C:\compile\Imaging-1.1.4\PIL>cd /D C:\compile\Imaging-1.1.4 C:\compile\Imaging-1.1.4>setup.py build *** Cannot find Tcl/Tk headers and library files. *** To build the Tkinter interface, set the TCLROOT *** variable in the setup.py file. running build running build_py running build_ext building '_imaging' extension C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:libImaging / LIBPATH:jpeg-6b /LIBPATH:zlib /LIBPATH:C:\Python24\libs /LIBPATH:C:\Python24\PCBuild Imaging.lib jpeg.lib zlib.lib kernel32.lib user32.lib gdi32.lib /EXPORT:init_imaging build\temp.win32-2.4\Release\_imaging.obj build\temp.win32 -2.4\Release\decode.obj build\temp.win32-2.4\Release\encode.obj build\temp.win32-2.4\Release\map.obj build\temp.wi n32-2.4\Release\display.obj build\temp.win32-2.4\Release\outline.obj build\temp.win32-2.4\Release\path.obj /OUT:bu ild\lib.win32-2.4\_imaging.pyd /IMPLIB:build\temp.win32-2.4\Release\_imaging.lib LINK : fatal error LNK1181: cannot open input file 'Imaging.lib' error: command '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe"' failed with exit status 1181 C:\compile\Imaging-1.1.4> _imaging.obj is being created - but not linked. I can't find an Imaging.lib file anywhere. Anyone got any clues for me ? Regards, Fuzzy http://www.voidspace.org.uk/atlantibots/pythonutils.html -- http://www.Voidspace.org.uk The Place where headspace meets cyberspace. Online resource site - covering science, technology, computing, cyberpunk, psychology, spirituality, fiction and more. --- http://www.Voidspace.org.uk/atlantibots/pythonutils.html Python utilities, modules and apps. Including Nanagram, Dirwatcher and more. --- http://www.fuchsiashockz.co.uk http://groups.yahoo.com/group/void-shockz --- Everyone has talent. What is rare is the courage to follow talent to the dark place where it leads. -Erica Jong Ambition is a poor excuse for not having sense enough to be lazy. -Milan Kundera From p.f.moore at gmail.com Mon Dec 13 10:42:13 2004 From: p.f.moore at gmail.com (Paul Moore) Date: Mon Dec 13 10:42:17 2004 Subject: [Image-SIG] Compiling PIL for 2.4 In-Reply-To: <41BD5551.7090800@pcblokes.com> References: <41BD5551.7090800@pcblokes.com> Message-ID: <79990c6b041213014222a1e4ae@mail.gmail.com> On Mon, 13 Dec 2004 08:39:45 +0000, Voidspace wrote: > I've just upgraded to Python 2.4. I've installed the free microsoft > optimising compiler and hacked distutils to use it - following the > instructions from http://www.vrplumber.com/programming/mstoolkit/ . It > works great and I've built a windows installer for PyCrypto 2.0. > > I'm attempting to compile PIL for python 2.4. The build instructions for > windows say : I posted some instructions to this list a couple of days ago for building PIL with mingw. You may like to try that option (as far as I can tell, it's not as messy as using the MS free compilers). Alternatively, Fredrik has now published a build of PIL 1.1.5b1 for Python 2.4, if that's of use. Regards, Paul. From mike at pcblokes.com Mon Dec 13 10:51:51 2004 From: mike at pcblokes.com (Voidspace) Date: Mon Dec 13 10:51:57 2004 Subject: [Image-SIG] Compiling PIL for 2.4 In-Reply-To: <79990c6b041213014222a1e4ae@mail.gmail.com> References: <41BD5551.7090800@pcblokes.com> <79990c6b041213014222a1e4ae@mail.gmail.com> Message-ID: <41BD6637.1060401@pcblokes.com> Thanks for the reply. I'll go with the binary that 'Fred' has built. I've got distutils configured to use the MS toolkit which actually produces tighter code, so in general I'll stick with that. (Under 2.3 I had distutils configured to use mingw). I'll have a look at your instructions anyway - out of interest. Thanks for the reply. Regards, Fuzzy http://www.voidspace.org.uk/atlantibots/pythonutils.html Paul Moore wrote: >On Mon, 13 Dec 2004 08:39:45 +0000, Voidspace wrote: > > >>I've just upgraded to Python 2.4. I've installed the free microsoft >>optimising compiler and hacked distutils to use it - following the >>instructions from http://www.vrplumber.com/programming/mstoolkit/ . It >>works great and I've built a windows installer for PyCrypto 2.0. >> >>I'm attempting to compile PIL for python 2.4. The build instructions for >>windows say : >> >> > >I posted some instructions to this list a couple of days ago for >building PIL with mingw. You may like to try that option (as far as I >can tell, it's not as messy as using the MS free compilers). >Alternatively, Fredrik has now published a build of PIL 1.1.5b1 for >Python 2.4, if that's of use. > >Regards, >Paul. > > > > > -- http://www.Voidspace.org.uk The Place where headspace meets cyberspace. Online resource site - covering science, technology, computing, cyberpunk, psychology, spirituality, fiction and more. --- http://www.Voidspace.org.uk/atlantibots/pythonutils.html Python utilities, modules and apps. Including Nanagram, Dirwatcher and more. --- http://www.fuchsiashockz.co.uk http://groups.yahoo.com/group/void-shockz --- Everyone has talent. What is rare is the courage to follow talent to the dark place where it leads. -Erica Jong Ambition is a poor excuse for not having sense enough to be lazy. -Milan Kundera From aslakr at idi.ntnu.no Mon Dec 13 16:55:16 2004 From: aslakr at idi.ntnu.no (Aslak Raanes) Date: Mon Dec 13 16:55:23 2004 Subject: [Image-SIG] adding exif-headers Message-ID: <61E631D8-4D1F-11D9-A057-00039364C786@idi.ntnu.no> Hei, I want to add exif-tags (date/time/gpsinfo etc) to files that doesn't already has an exif-header using python. There is one post from Mike Krimerman which has a patch for writing raw-exif header (http://mail.python.org/pipermail/image-sig/2004-September/ 002931.html), but it dosn't validate the data. Will the ?ExifTags?-module support writing exif-tags in the 1.1.5 final? Does anyone know of any other Python-libary that will make it possible to write/add exif-tags/header? -- Aslak Raanes From fredrik at pythonware.com Mon Dec 13 17:37:39 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon Dec 13 17:37:52 2004 Subject: [Image-SIG] Re: Compiling PIL for 2.4 References: <41BD5551.7090800@pcblokes.com> Message-ID: "Voidspace" wrote: > I'm attempting to compile PIL for python 2.4. The build instructions for > windows say : > > If you're using Python 2.0 or later, you can use the setup.py script > to build the library. The following commands should do the trick: > > $ python setup.py build > $ python setup.py install the instructions should have pointed out that before you do this, you need to build the core library in the libImaging directory using the Makefile.win file (see step 4 for the Unix version of this), but it looks like they didn't. oh, well. the 1.1.5 build script is a lot better. From mike at pcblokes.com Mon Dec 13 17:47:17 2004 From: mike at pcblokes.com (Voidspace) Date: Mon Dec 13 17:47:24 2004 Subject: [Image-SIG] Re: Compiling PIL for 2.4 In-Reply-To: References: <41BD5551.7090800@pcblokes.com> Message-ID: <41BDC795.20802@pcblokes.com> Frederik Lundh wrote: >"Voidspace" wrote: > > > >>I'm attempting to compile PIL for python 2.4. The build instructions for >>windows say : >> >> If you're using Python 2.0 or later, you can use the setup.py script >> to build the library. The following commands should do the trick: >> >> $ python setup.py build >> $ python setup.py install >> >> > >the instructions should have pointed out that before you do this, you need >to build the core library in the libImaging directory using the Makefile.win >file (see step 4 for the Unix version of this), but it looks like they didn't. > >oh, well. the 1.1.5 build script is a lot better. > > > > > Thanks Frederik, I'll stick with the 1.1.5 binary that you've built - thanks. I don't know how to use the makefile as I'm *only* using distutils to drive the compiler. Any estimate of when 1.1.5 final will be done ? Regards, Fuzzy > >_______________________________________________ >Image-SIG maillist - Image-SIG@python.org >http://mail.python.org/mailman/listinfo/image-sig > > > > > -- http://www.Voidspace.org.uk The Place where headspace meets cyberspace. Online resource site - covering science, technology, computing, cyberpunk, psychology, spirituality, fiction and more. --- http://www.Voidspace.org.uk/atlantibots/pythonutils.html Python utilities, modules and apps. Including Nanagram, Dirwatcher and more. --- http://www.fuchsiashockz.co.uk http://groups.yahoo.com/group/void-shockz --- Everyone has talent. What is rare is the courage to follow talent to the dark place where it leads. -Erica Jong Ambition is a poor excuse for not having sense enough to be lazy. -Milan Kundera From cowbertvonmoo at gmail.com Mon Dec 13 22:08:58 2004 From: cowbertvonmoo at gmail.com (Kris Kowal) Date: Mon Dec 13 22:09:19 2004 Subject: [Image-SIG] Fonts that draw before the cursor Message-ID: I made a foray with PIL a couple days ago to determine the feasibility of generating graphics with arbitrary "Elvish" text, with a web interface, on demand. I used the definitive true type font to generate a graphic of the word "ainalda", with some success. However, it didn't print the diacritics. The Elvish fonts contain characters that print text before the cursor. In Elvish, you type out a consonant character, then you can apply modifier glyphs to the previous character, like two dots on bottom, a bar on top, or a hook attached to the end. This works fine in most applications, including web browsers. For some reason, PIL interprets these modifier characters as a blank space. Does anybody out there in the blue nowhere have some ideas that might help? I would consider getting the C source and piddling with it, but I'd rather not. If I do pursue the C code, where would I start? Are there alternate libraries? Could I find another tool that would convert the font to make it work with PIL? Graciously, Kris Kowal. -- (watch the reply to) From rowen at cesmail.net Wed Dec 15 20:17:11 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Wed Dec 15 20:23:27 2004 Subject: [Image-SIG] Help wanted: sensible way to scale 16-bit grayscale image Message-ID: I'm building a simple image viewer for astronomical images (after giving up integrating ds9 into my app). It is basically working, but I suspect I am not being very sensible in the way I do intensity scaling (to map a high dynamic range image into 8 bits). The data arrives as 16-bit integer, though it is convenient to convert it to 32-bit floating point when applying scaling functions. I had hoped to use an LUT to directly map a 32-bit floating point image (or 16 bit integer) to 8 bit color or grayscale (for now grayscale is fine, though I hope to support psuedocolor at some point). I could then recompute the LUT as needed (e.g. if the user asked for a different scaling function or contrast or...). Unfortunately, I have not been able to figure out how to use an LUT. Despite the following hopeful statement in the Concepts section of the Handbook: The mode of an image defines the type and depth of a pixel in the image. The current release supports the following standard modes: ... * P (8-bit pixels, mapped to any other mode using a colour palette) it appears that palettes can only be attached to L or P images. I hope I'm missing something obvious in the use of palettes. Meanwhile, what I'm doing is: - input data is a numarray array - apply a scaling function to produce scaledArr, a 32-bit floating numarray array - create an Image copy of scaledArr: self.scaledIm = Image.frombuffer("F", dataShapeXY, self.scaledArr.tostring()) - resize scaledIm according to the desired zoom factor - create currIm: a 0-255 value version of scaledIm: currIm = self.scaledIm.point(self._dispFromScaled) - self.tkIm = ImageTk.PhotoImage(currIm) - display self.tkIm on a canvas Is there a better way to handle the scaling? This seems to have adequate performance, but it seems messy compared to using the scaling function to compute an LUT which maps unscaled pixel values to an 8-bit displayable image. Also, any suggestions for zoom? The main flaw in my image viewer is slow draw time when zoom >= 4. I fear I'll have to try to create a copy of only a portion of the image of interest, but that will really complicate panning (not to mention figuring out the coordinates of the current point). -- Russell P.S. the image viewer is part of the RO package . The current release has a working preliminary version as RO.Wdg.GrayImageDispWdg. From fredrik at pythonware.com Wed Dec 15 20:45:48 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Dec 15 20:51:25 2004 Subject: [Image-SIG] Re: Fonts that draw before the cursor References: Message-ID: Kris Kowal wrote: >I made a foray with PIL a couple days ago to determine the feasibility > of generating graphics with arbitrary "Elvish" text, with a web > interface, on demand. I used the definitive true type font to > generate a graphic of the word "ainalda", with some success. However, > it didn't print the diacritics. > > The Elvish fonts contain characters that print text before the cursor. > In Elvish, you type out a consonant character, then you can apply > modifier glyphs to the previous character, like two dots on bottom, a > bar on top, or a hook attached to the end. This works fine in most > applications, including web browsers. For some reason, PIL interprets > these modifier characters as a blank space. probably a bug in the freetype driver for PIL. is the font available? if so, a pointer to the font and a code sample and a "expected output" screenshot (from a program where the font works as expected) would be helpful. From fredrik at pythonware.com Wed Dec 15 20:42:34 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Dec 15 20:53:15 2004 Subject: [Image-SIG] Re: Help wanted: sensible way to scale 16-bit grayscaleimage References: Message-ID: Russell E. Owen wrote: > I had hoped to use an LUT to directly map a 32-bit floating point image > (or 16 bit integer) to 8 bit color or grayscale (for now grayscale is > fine, though I hope to support psuedocolor at some point). I could then > recompute the LUT as needed (e.g. if the user asked for a different > scaling function or contrast or...). > > Unfortunately, I have not been able to figure out how to use an LUT. > Despite the following hopeful statement in the Concepts section of the > Handbook: > > The mode of an image defines the type and depth of a pixel > in the image. The current release supports the following > standard modes: > ... > * P (8-bit pixels, mapped to any other mode using a colour palette) > > it appears that palettes can only be attached to L or P images. I hope > I'm missing something obvious in the use of palettes. lookup table (LUT) != palette. the "point" method replaces every pixel in the image by the corresponding value from the given lookup table: for each pixel in image: new pixel value = LUT[old pixel value] "point" with a lookup table is currently only supported for 8-bit images. a palette maps colour indexes to RGB values. if you attach an palette to an 8-bit grayscale image (mode "L"), it becomes a palette image (mode "P"), but it still only contains 8-bit values. if you have 16-bit or 32-bit data, you can use the "getextrema" method to find the lowest and highest value in the image, calculate a suitable linear transform to bring the values into a 256-value range, and use "point" with a lambda expression to convert the values to 0-255. you can then convert the resulting image to "L", and optionally attach a psuedo-color palette to it to get a "P" image. or, in code: lo, hi = im.getextrema() scale = 255.0 / (hi - lo) offset = -lo * scale im = im.point(lambda v: v * scale + offet) im = im.convert("L") in older Python versions, replace the point call with: im = im.point(lambda v, s=scale, o=offset: v * s + o) this snippet simply maps the darkest pixel value to 0, and the lightest to 255. you may want to adjust the lo/hi values before calculating the coefficients. also note that this only works well if the source data is relatively linear; there's no way to use a non-linear transform on I or F data in the current version of PIL. From pascor at hotpop.com Thu Dec 16 19:27:22 2004 From: pascor at hotpop.com (Ray Pasco) Date: Thu Dec 16 19:27:43 2004 Subject: [Image-SIG] Re: Help wanted: sensible way to scale 16-bit grayscale image Message-ID: <41C1D38A.90902@hotpop.com> I believe the response to Russell's question missed the point. I believe he wants to change the dynamic range of his images, not produce an image file of a smaller size, which is the primary goal of producing a paletted (indexed or gray "L"evel) image. He wants to manipulate the mapping of values of the image pixels to grayscale values, which is the "usual" purpose of a LUT. The LUT of an L image is not used for that purpose at all ! So, Russel, I think this is what you want to do: 1) Create a palette of 256 8-bit integer indices. This is not a LUT used as a transform tool. 2) Lets say your image consists of unsigned 16-bit values. Decide the ranges of values that will be mapped. E.g., let the range 0-255 map to the new image pallette value of 0, the original range of 256 .. 511 ==> 1, etc. In other words, the original value range of [0..255, 256..511, ...] will transform to the gray level values of [0, 1, ...] This is the simplest way to map, which is strictly linear and does not change the dynamic range, only the "resolution" of the resultant image. You must create 256 non-overlapping ranges that cover the original image's pixel range of 0 to 65,535. It sounds like you will eventually "compand" or nonlinearize your images for better visual perception. Create any mapping you want, heuristically or not, whatever "looks best" to you, in the end. 3) Create a brand new L type image. Install your new pallette into it. Examine at each pixel of the original image and map its 16-bit value to a (unique) pallette value. Write that pallete value to the pixel value of the new image. You are now done converting the old image to a new L image. Store, display or even convert to a new image type as desired. Now you can see why the pallette table is refered to a a "LUT", though it is used simply to define the new image, not transform it. Your mapping algorithm for determination of the old to new ranges could actually use a LUT in the conventional sense. Lets say you have an image that is 1000 X 1000 X 16-bits. This raw image requires 2,000,000 bytes to completely describe. Converting to a L image requires a 256 byte pallette plus 1,000,000 bytes to describe. It saves space at the cost of pixel value resolution, i.e., compression. From rowen at cesmail.net Thu Dec 16 23:27:19 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Thu Dec 16 23:27:45 2004 Subject: [Image-SIG] Re: Help wanted: sensible way to scale 16-bit grayscale image References: <41C1D38A.90902@hotpop.com> Message-ID: In article <41C1D38A.90902@hotpop.com>, Ray Pasco wrote: > I believe the response to Russell's question missed the point. I > believe he wants to change the > dynamic range of his images, not produce an image file of a smaller > size, which is the primary > goal of producing a paletted (indexed or gray "L"evel) image.... Exactly. My image viewer offers log, sqrt and a few other scaling functions which the user may switch between in order to bring out different features of interest in the original image. When a scaling function is selected, an appropriate 8-bit image is created from the original data (which is always retained unchanged) and displayed. Right now I am using brute force to create the 8-bit image -- using numarray to apply the scaling function to each pixel to create a scaled version to display. I had hoped, instead, to specify the desired scaling as an array of 256 values that told PIM how to map values from the original image down to 8 bits (thus only computing my scaling function at 256 points instead of for every pixel in the original image). It sounds as if PIM does not have LUT support in that sense, which is a pity as it seems a natural thing to do. > So, Russel, I think this is what you want to do: > > 1) Create a palette of 256 8-bit integer indices. This is not a LUT > used as a transform tool. > > 2) Lets say your image consists of unsigned 16-bit values. Decide the > ranges of values that will be mapped. > E.g., let the range 0-255 map to the new image pallette value of 0, the > original range of 256 .. 511 ==> 1, etc. > In other words, the original value range of [0..255, 256..511, ...] > will transform to the gray level values > of [0, 1, ...]... > > 3) Create a brand new L type image. Install your new pallette into it. > Examine at each pixel of the original image > and map its 16-bit value to a (unique) pallette value. Write that > pallete value to the pixel value of the new image. > You are now done converting the old image to a new L image. Store, > display or even convert to a new image > type as desired. I'm not sure I get this yet. I think you are suggesting I start by creating a table that specifies how values from the original image are mapped to 8-bit grayscale image, e.g. (using your linear example): [0, 256, 512, ...] means display values 0-255 as 0, 256-511 as 1, etc. But then I don't see how to apply it. You suggest: >Examine at each pixel of the original image and map its 16-bit value to a (unique) pallette value. Write that pallete value to the pixel value of the new image. but is there some efficient way to do this? I suspect a normal python loop would be dreadfully slow. Also, I confess I'm puzzled why you also suggest creating a palette and attaching it to the "L" image (maybe this is the heart of what I'm missing). I would think that once I had used the table to compute the pixel values for the 8-bit "L" image, I'd be done -- and that the proper palette for "L" would then be the default palette. I hope I'm not being too dense. Regards, -- Russell From fredrik at pythonware.com Fri Dec 17 09:07:44 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri Dec 17 09:07:54 2004 Subject: [Image-SIG] Re: Help wanted: sensible way to scale 16-bit grayscaleimage References: <41C1D38A.90902@hotpop.com> Message-ID: Ray Pasco wrote: >I believe the response to Russell's question missed the point. I believe he wants to change the >dynamic range of his images, not > produce an image file of a smaller size, which is the primary > goal of producing a paletted (indexed or gray "L"evel) image. really? phrases like "simple image viewer" and "map a high dynamic range image into 8 bits" seem to indicate that he wants to map 16-bit images into "L" for display purposes -- which was what I wrote about. > Examine at each pixel of the original image > and map its 16-bit value to a (unique) pallette value. Write that pallete value to the pixel > value of the new image. my mail, which you obviously didn't read very carefully, described an *efficient* way to do this using *existing* PIL mechanisms. From fredrik at pythonware.com Fri Dec 17 09:57:59 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri Dec 17 09:58:10 2004 Subject: [Image-SIG] Re: Help wanted: sensible way to scale 16-bit grayscaleimage References: <41C1D38A.90902@hotpop.com> Message-ID: Russell E. Owen wrote: > Right now I am using brute force to create the 8-bit image -- using > numarray to apply the scaling function to each pixel to create a scaled > version to display. I had hoped, instead, to specify the desired scaling > as an array of 256 values that told PIM how to map values from the > original image down to 8 bits (thus only computing my scaling function > at 256 points instead of for every pixel in the original image). > > It sounds as if PIM does not have LUT support in that sense, which is a > pity as it seems a natural thing to do. as I said, "point" with a lookup table is currently only supported for 8-bit images. for other images, you can use "point" to do linear transforms (by passing in a lambda of the right form). adding 16-bit LUT support shouldn't be too hard; I'll look into this for the next beta. (but you'll have to provide 65536 values, not 256 values) From pascor at hotpop.com Fri Dec 17 18:39:23 2004 From: pascor at hotpop.com (Ray Pasco) Date: Fri Dec 17 18:39:26 2004 Subject: [Image-SIG] Re: Re: Help wanted: sensible way to scale 16-bit grayscale image Message-ID: <41C319CB.7000008@hotpop.com> Date: Thu, 16 Dec 2004 14:27:19 -0800 From: "Russell E. Owen" Subject: [Image-SIG] Re: Help wanted: sensible way to scale 16-bit grayscale image To: image-sig@python.org Message-ID: In article <41C1D38A.90902@hotpop.com>, Ray Pasco wrote: >> I believe the response to Russell's question missed the point. I >> believe he wants to change the >> dynamic range of his images, not produce an image file of a smaller >> size, which is the primary >> goal of producing a paletted (indexed or gray "L"evel) image.... > > Exactly. My image viewer offers log, sqrt and a few other scaling functions which the user may switch between in order to bring out different features of interest in the original image. When a scaling function is selected, an appropriate 8-bit image is created from the original data (which is always retained unchanged) and displayed. Right now I am using brute force to create the 8-bit image -- using numarray to apply the scaling function to each pixel to create a scaled version to display. I had hoped, instead, to specify the desired scaling as an array of 256 values that told PIM how to map values from the original image down to 8 bits (thus only computing my scaling function at 256 points instead of for every pixel in the original image). It sounds as if PIM does not have LUT support in that sense, which is a # "PIM" ?! "PIL", right ? pity as it seems a natural thing to do. # As far as I know, you're right. It would be great to have a true LUT transform # function. I can easily imagine one for 16-bit unsigned integers, say, # that consists of a 256 entry table in which each entry consists of two # values each: a lower and an upper limit in which a transform function would # use to map that range of original values to a single 8-bit gray level value. # # To be complete, this fuction would have to be able to convert any kind # of image (16-bit signed/unsigned, 32-bit signed/unsigned, RGB, floating point, # etc., etc., to any other kind of image. However, perhaps only one or two # of the conversions could be implemented at first, with more as users request. # This would necessarily be done as a C extension for speed, an area that is # black magic to me at this time. However, the point() function is not -that- # slow as to cause a unacceptable time lag for "small" to "medium" sized images. # But, I'm guessing that your images fall in the "large" to "very large" # category, making a C-based transform function required rather than a pure Python one. >> So, Russel, I think this is what you want to do: >> >> 1) Create a palette of 256 8-bit integer indices. This is not a LUT >> used as a transform tool. >> >> 2) Lets say your image consists of unsigned 16-bit values. Decide the >> ranges of values that will be mapped. >> E.g., let the range 0-255 map to the new image pallette value of 0, the >> original range of 256 .. 511 ==> 1, etc. >> In other words, the original value range of [0..255, 256..511, ...] >> will transform to the gray level values >> of [0, 1, ...]... >> >> 3) Create a brand new L type image. Install your new pallette into it. >> Examine at each pixel of the original image >> and map its 16-bit value to a (unique) pallette value. Write that >> pallete value to the pixel value of the new image. >> You are now done converting the old image to a new L image. Store, >> display or even convert to a new image >> type as desired. > > I'm not sure I get this yet. I think you are suggesting I start by creating a table that specifies how values from the original image are mapped to 8-bit grayscale image, e.g. (using your linear example): [0, 256, 512, ...] means display values 0-255 as 0, 256-511 as 1, etc. # No, the table does not transform the original image. It helps to specify # a new image that was created by your own Python transformation algorithm that you # apply to your original image to create a new paletted image. But then I don't see how to apply it. You suggest: >>Examine at each pixel of the original image and map its 16-bit value to > > a (unique) pallette value. Write that pallete value to the pixel value of the new image. but is there some efficient way to do this? I suspect a normal python loop would be dreadfully slow. Also, I confess I'm puzzled why you also suggest creating a palette and attaching it to the "L" image (maybe this is the heart of what I'm missing). I would think that once I had used the table to compute the pixel values for the 8-bit "L" image, I'd be done -- and that the proper palette for "L" would then be the default palette. I hope I'm not being too dense. # I think an explaination about paletted images is in order. # By the way, I use the term "paletted image". This is not the "industry standard" # terminology, but does characterize the image representation in a clear and exact manner. # # Imagine an N by M image consisting of 8-bit values. These pixel values are indices # into a 256-entry array, a.k.a the palette table. Each palette table entry value # (in my example) # represents a gray level image value (intensity value = luminance). # So, for example, image location (173, 1407) could contain (have the value of) # the palette entry 148, which, in turn, indicates that that all pixels that have # the palette index of 148 should have a gray level of 17. So, the image consists # of an array of palette entries instead of an array of the actual pixel values. # Your original images are arrays of pixel values. # # This palette-based image representation is easily extended to RGB and all other image types. # In an RGB image, each palette entry consists of an RGB 3-tuple which specifies the 8-bit # R, G and B values for all pixels whose values have that palette index. So, color images # with a "dynamic range" of 16,777,216 possible colors (8-bit R x 8-bit G x 8-bit B) could be # represented in a paletted image format consisting of N x M x 8-bit indices and a 768 entry # palette. The catch is, and it's a big one, is that the paletted image must be such that # it can use only 256 total colors or less (the palette size) out of a possible of 16 million. # # This is why I call the table a "palette" and not a LUT. It is just like a painter's palette. # Imagine an artist's hand-held palette with 256 cups in it for holding paint mixtures. # He starts out with 3 tubes of primary colors R, G and B. He can put any mix of primary colors # in each cup. The digital world limits this to 16 million possibilities, instead of # an infinite analog range. But, he has only 256 mixtures of primary colors to choose from which # to create his final painting. # # In your case, your new palette would consist of 256 shades of gray, from black to white. # So, a grayscale palette is just a simplified form of a full-color palette representation. # # I just can fathom why an explaination like this can't be found by Googling, or otherwise. # Everyone is just expected to "know" how paletted images work by osmosis or some other means. # Hope this clears up any confusion. # # Ray Pasco Regards, -- Russell # Oh, I almost forgot to say that PIL version 1.1.5b1 has new functions for setting # and retrieving palettes. From fredrik at pythonware.com Sat Dec 18 17:01:16 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat Dec 18 17:01:38 2004 Subject: [Image-SIG] Re: Help wanted: sensible way to scale 16-bitgrayscaleimage References: <41C1D38A.90902@hotpop.com> Message-ID: I wrote: > adding 16-bit LUT support shouldn't be too hard; I'll look into this for the > next beta. (but you'll have to provide 65536 values, not 256 values) the next release will provide limited support for I->L mappings; the following case now works: assert im.mode == "I" assert len(lut) == 65536 out = im.point(lut, "L") assert out.mode == "L" (that is, only 16-bit mappings are currently supported; values outside the 0..65535 range are clipped before being mapped through the table) From fredrik at pythonware.com Sun Dec 19 16:10:35 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun Dec 19 16:10:54 2004 Subject: [Image-SIG] ANN: PIL 1.1.5 beta 2 (december 18, 2004) Message-ID: PIL 1.1.5 beta 2 (aka rc0) is now available from effbot.org: http://effbot.org/downloads#imaging (look for Imaging-1.1.5b2.tar.gz. no compiled windows versions yet; hopefully later this week) Visible changes in this release include: + Added DPI read/write support to the PNG codec. The decoder sets the info["dpi"] attribute for PNG files with appropriate resolution settings. The encoder uses the "dpi" option (based on code by Niki Spahiev). + Added limited support for "point" mappings from mode "I" to mode "L". Only 16-bit values are supported (other values are clipped), the lookup table must contain exactly 65536 entries, and the mode argument must be set to "L". + Added support for Mac OS X icns files (based on code by Bob Ippolito). + Added "ModeFilter" support to the ImageFilter module. + Added support for Spider images (from William Baxter). See the comments in PIL/SpiderImagePlugin.py for more information on this format. For a list of other changes in 1.1.5, see this page: http://effbot.org/zone/pil-changes-115.htm Report bugs to this list or directly to me, as usual. enjoy /F From xtingray at linuxmail.org Tue Dec 21 14:17:50 2004 From: xtingray at linuxmail.org (=?iso-8859-1?B?R3VzdGF2byBHb2564Wxleg== ?=) Date: Tue Dec 21 14:17:56 2004 Subject: [Image-SIG] ImportError: cannot import name PIL_Image Message-ID: <20041221131750.714C62B2B86@ws5-7.us4.outblaze.com> Hi, i am trying to install the ReportLab library on python to use it with a Zope system. But when i try to start the Zope server i got this message: ImportError: cannot import name PIL_Image File "/home/servicios/zope/raiz/Products/CMFReportTool/ReportTool.py", line 49, in ? from RenderPDF.Parser import TemplateParser,DocumentParser File "/home/servicios/zope/raiz/Products/CMFReportTool/RenderPDF/Parser.py", line 34, in ? from reportlab.lib.utils import PIL_Image ImportError: cannot import name PIL_Image I installed the PIL before trying to start up the Zope server... and i can not find any reference to the "PIL_Image" name... where should it be? I have been looking for help on google, but i haven't luck yet... Thank you for any help... -- ______________________________________________ Check out the latest SMS services @ http://www.linuxmail.org This allows you to send and receive SMS through your mailbox. Powered by Outblaze From fredrik at pythonware.com Tue Dec 21 14:52:17 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue Dec 21 15:00:51 2004 Subject: [Image-SIG] Re: ImportError: cannot import name PIL_Image References: <20041221131750.714C62B2B86@ws5-7.us4.outblaze.com> Message-ID: Gustavo González wrote: > ImportError: cannot import name PIL_Image > File "/home/servicios/zope/raiz/Products/CMFReportTool/ReportTool.py", line 49, in ? > from RenderPDF.Parser import TemplateParser,DocumentParser > File "/home/servicios/zope/raiz/Products/CMFReportTool/RenderPDF/Parser.py", line 34, in ? > from reportlab.lib.utils import PIL_Image > ImportError: cannot import name PIL_Image > > I installed the PIL before trying to start up the Zope server... and i can not > find any reference to the "PIL_Image" name... where should it be? it looks like it's a part of the reportlab library (see the "from" part of the failing import statement). that library is available here: http://www.reportlab.org/ From xtingray at linuxmail.org Tue Dec 21 17:25:25 2004 From: xtingray at linuxmail.org (=?iso-8859-1?B?R3VzdGF2byBHb2564Wxleg== ?=) Date: Tue Dec 21 17:26:29 2004 Subject: [Image-SIG] Re: ImportError: cannot import name PIL_Image Message-ID: <20041221162532.1685323EE65@ws5-4.us4.outblaze.com> ----- Original Message ----- From: "Fredrik Lundh" To: image-sig@python.org Subject: [Image-SIG] Re: ImportError: cannot import name PIL_Image Date: Tue, 21 Dec 2004 14:52:17 +0100 > > Gustavo Gonz?lez wrote: > > > ImportError: cannot import name PIL_Image > > File > > "/home/servicios/zope/raiz/Products/CMFReportTool/ReportTool.py", > > line 49, in ? > > from RenderPDF.Parser import TemplateParser,DocumentParser > > File > > "/home/servicios/zope/raiz/Products/CMFReportTool/RenderPDF/Parser.py", line > > 34, in ? > > from reportlab.lib.utils import PIL_Image > > ImportError: cannot import name PIL_Image > > > > I installed the PIL before trying to start up the Zope server... > > and i can not > > find any reference to the "PIL_Image" name... where should it be? > it looks like it's a part of the reportlab library (see the "from" > part of the failing > import statement). that library is available here: > > http://www.reportlab.org/ Hello! It was a problem in the CMFReportTool (Product for Zope) code. I fix it using a patch that i found here: http://sourceforge.net/mailarchive/forum.php?forum_id=12349&style=flat&viewday=20&viewmonth=200405 This is the patch (i hope it can be useful for others): --- CMFReportTool/RenderPDF/Parser.py.old 2004-02-18 04:44:16.000000000 +1300 +++ CMFReportTool/RenderPDF/Parser.py 2004-05-14 09:00:20.000000000 +1200 @@ -36,7 +36,8 @@ from reportlab.lib.utils import PIL_Image except ImportError: # reportlab 1.19 compatibility - from reportlab.lib.utils import Image as PIL_Image + #from reportlab.lib.utils import Image as PIL_Image + from PIL import Image as PIL_Image import Platypus @@ -448,6 +449,15 @@ if "textcolor" in attr_names: name = findAttrName(attr_names, "textColor") obj.attributes["textColor"] = self.xml_ceval(node, name) + + # Remove any attributes with a None value rather than override a + # default value. + # it would be better to not set them in the first place but the + # code will be cluttered + attributes = obj.attributes.keys() + for attr in attributes: + if obj.attributes[attr] is None: + del obj.attributes[attr] elif node.nodeName == "tablestyle": name = self.xml_arg(node,"name") =============================== Gustavo Gonz?lez xtingray@linuxmail.org =============================== -- ______________________________________________ Check out the latest SMS services @ http://www.linuxmail.org This allows you to send and receive SMS through your mailbox. Powered by Outblaze From zorgoz at inf.unideb.hu Thu Dec 23 09:59:02 2004 From: zorgoz at inf.unideb.hu (zorgoz@inf.unideb.hu) Date: Thu Dec 23 09:59:05 2004 Subject: [Image-SIG] Conversion from RGB(A) to P(A) Message-ID: <1103792342.41ca88d6b98b1@webmail.inf.unideb.hu> Hi! I was searching for a code in python to do the conversion in the subject, and I found your code. I am quite new in Python and PIL. I have PIL-1.1.4.win32-py2.3.exe installed, but I found no "listpalette" module. I tried with Google too, but nothing. Is this a module of yours, or is it in an other version of PIL? Please, help! And Merry Christmas! With regards, Zoltan Zorgo, Hungary ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From mcmwzct at verizon.net Sun Dec 26 18:34:50 2004 From: mcmwzct at verizon.net (Harriet L. Mullen) Date: Sun Dec 26 19:58:11 2004 Subject: [Image-SIG] Re: himself, realizing that the Message-ID: <28622642390251877.420127.svvghzog@30.85.251.215> Sun, 26 Dec 2004 11:42:50 -0600 Good Day: After viewing your record we are unable to a p prove your mor tga g e/ r e financ e at the r at e of 3.00. However we can give you 4.0 deal. If you are satisfied, then we will need you to verify some information below. http://www.infodsr.com/ Thank you Harriet L. Mullen From jalil at feghhi.com Tue Dec 28 19:12:43 2004 From: jalil at feghhi.com (Jalil Feghhi) Date: Fri Dec 31 09:21:10 2004 Subject: [Image-SIG] Deformer Object Message-ID: <012501c4ed08$d3c438f0$6602a8c0@securia.com> The documentation for PIL at http://www.pythonware.com/library/pil/handbook/imageops.htm, says: ImageOps.deform(image, deformer) => image Deform the image using the given deformer object Where can one find information on this deformer object? Regards, -Jalil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20041228/f331a6fb/attachment.htm From jalil at feghhi.com Fri Dec 31 21:46:56 2004 From: jalil at feghhi.com (Jalil Feghhi) Date: Mon Jan 31 12:04:11 2005 Subject: [Image-SIG] Streaming Images Message-ID: <019601c4ef7a$42514f10$6602a8c0@securia.com> I would like to create an image on the fly and stream it to the browser. Is there any information on how to do this exactly using PIL (or any other library)? In my python program, I am converting a random text to an image. I can serve it to the browser now but I hae to save it to a file. I like to stream it and not save it to file system. How is this possible? Regards, -Jalil -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20041231/48c1b156/attachment.html