From ecolmar@uswest.net Wed Nov 1 19:54:14 2000 From: ecolmar@uswest.net (ed colmar) Date: Wed, 1 Nov 2000 12:54:14 -0700 Subject: [Image-SIG] Properly integrating PIL, reportlab, and zope Message-ID: <004a01c0443d$832c8280$0400000a@caliber> Hi all! I am working on a project using zope and reportlab. The goal is to have uploaded images end up in a formatted PDF file. I have both of these halves completed, I need to figure out how to connect them. I have been using SquishFile.py as the wrapper around uploaded images, as is done in squishdot. The few image types I have tried have displayed fine on screen, but PIL is not able to recognise the image. How would you go about wrapping the file in a PIL.Image() ? I've been trying things similar to: cardimage=PIL.Image.open(self.uploadedimage) c.drawInlineImage(cardimage, 1,1) This gives an error in reportlab.canvas.convert() I tried using PIL.image.fromstring(), but I can't quite get the it to work out: filebytes=[str(self.uploadedimage.file_bytes()), 'bytes'] cardimage=PIL.Image.fromstring(self.uploadedimage.content_type(), filebytes, self.uploadedimage.file_data()) c.drawInlineImage(cardimage, 1,1) This gives a typeerror: PIL/Image.py, line 848, in new has anyone succesfully done this? can I just Leave the SquishFile wrapper off if it is ONLY going to be images that get uploaded? Thanks for any ideas! -ed- From drusch@globalcrossing.com Wed Nov 1 22:05:49 2000 From: drusch@globalcrossing.com (Daniel Rusch) Date: Wed, 01 Nov 2000 16:05:49 -0600 Subject: [Image-SIG] Properly integrating PIL, reportlab, and zope References: <004a01c0443d$832c8280$0400000a@caliber> Message-ID: <3A0093BD.EB20BD65@globalcrossing.com> I have no idea if this will help you. We use PIL, reportlabs and zope to create P.O.'s, to place a logo on the page we use the following line of code: c.drawInlineImage("gclogo_color.gif", .5*inch, 10.*inch,4*inch) where c is created thusly: c = canvas.Canvas(fileName,(PAGE_WIDTH*inch,PAGE_LENGTH*inch), pageCompression=0) HTH, Dan ed colmar wrote: > > Hi all! > > I am working on a project using zope and reportlab. > > The goal is to have uploaded images end up in a formatted PDF file. > > I have both of these halves completed, I need to figure out how to connect > them. > > I have been using SquishFile.py as the wrapper around uploaded images, as is > done in squishdot. The few image types I have tried have displayed fine on > screen, but PIL is not able to recognise the image. > > How would you go about wrapping the file in a PIL.Image() ? I've been > trying things similar to: > > cardimage=PIL.Image.open(self.uploadedimage) > c.drawInlineImage(cardimage, 1,1) > > This gives an error in reportlab.canvas.convert() > > I tried using PIL.image.fromstring(), but I can't quite get the it to work > out: > > filebytes=[str(self.uploadedimage.file_bytes()), 'bytes'] > cardimage=PIL.Image.fromstring(self.uploadedimage.content_type(), > filebytes, > self.uploadedimage.file_data()) > c.drawInlineImage(cardimage, 1,1) > > This gives a typeerror: PIL/Image.py, line 848, in new > > has anyone succesfully done this? can I just Leave the SquishFile wrapper > off if it is ONLY going to be images that get uploaded? > > Thanks for any ideas! > > -ed- > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://www.python.org/mailman/listinfo/image-sig From rburnham@cri-inc.com Wed Nov 8 22:37:37 2000 From: rburnham@cri-inc.com (Roger Burnham) Date: Wed, 8 Nov 2000 14:37:37 -800 Subject: [Image-SIG] PIL 1.1.1 Problem with Windows NT, Python 1.5.2 Message-ID: <200011082240.eA8MeNr25944@laxmls02.socal.rr.com> Using VC++ 6.0 (no service packs) and Python 1.5.2. Got it to build (after undef'ing INT32 and UINT32 before including windows.h). Now, >>> import Image >>> img = Image.open(r'C:\TMP\160x160.jpg') >>> img.size (160, 120) >>> img.getpixel((10,10)) (64, 74, 73) >>> img.save('c:/tmp/fred.jpg') Traceback (innermost last): File "", line 0, in ? File "C:\Python\Imaging\Image.py", line 674, in save SAVE[string.upper(format)](self, fp, filename) File "C:\Python\Imaging\JpegImagePlugin.py", line 307, in _save ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)]) File "C:\Python\Imaging\ImageFile.py", line 368, in _save s = e.encode_to_file(fh, bufsize): (0, 'Error') Running under the debugger, tracing into _encode_to_file (encode.c), at the line if (write(fh, buf, status) < 0) { I step into _write and trip over if ( ((unsigned)fh >= (unsigned)_nhandle) || !(_osfile(fh) & FOPEN) ) { /* out of range -- return error */ errno = EBADF; _doserrno = 0; /* not o.s. error */ return -1; } here, fh = 4, _nhandle = 32. MSDN says: EBADF Bad file number. There are two possible causes: 1) The specified file handle is not a valid file-handle value or does not refer to an open file. 2) An attempt was made to write to a file or device opened for read-only access. Anyone offer any clues??? Thanks, Roger Burnham rburnham@cri-inc.com Cambridge Research & Instrumentation www.cri-inc.com From strang@NMR.MGH.Harvard.EDU Wed Nov 15 18:05:50 2000 From: strang@NMR.MGH.Harvard.EDU (Gary Strangman) Date: Wed, 15 Nov 2000 13:05:50 -0500 (EST) Subject: [Image-SIG] PIL 1.1.1 for Python 2.0? Message-ID: Hello all, Has anyone out there built PIL 1.1.1 for Python 2000-for-Windows98/NT? And if so, could the binary be made available? (I could actually post the binary, at least temporarily, on my own web page if needed.) At present, PIL is the only reason I haven't fully migrated to Python 2.0 (i.e., PIL is that useful ;-) Gary -------------------------------------------------------------- Gary Strangman, PhD | Neural Systems Group Office: 617-724-0662 | Massachusetts General Hospital Home: xxx-xxx-xxxx | 13th Street, Bldg 149, Room 9103 strang@nmr.mgh.harvard.edu | Charlestown, MA 02129 http://www.nmr.mgh.harvard.edu/Neural_Systems_Group/gary/ From fredrik@effbot.org Sun Nov 19 11:49:27 2000 From: fredrik@effbot.org (Fredrik Lundh) Date: Sun, 19 Nov 2000 12:49:27 +0100 Subject: [Image-SIG] PIL 1.1.1 for Python 2.0? References: Message-ID: <003201c0521e$c7af12d0$3c6340d5@hagrid> gary wrote: > Has anyone out there built PIL 1.1.1 for Python 2000-for-Windows98/NT? And > if so, could the binary be made available? (I could actually post the > binary, at least temporarily, on my own web page if needed.) I've posted semi-official/preview/works-for-me binaries for both 1.5.2 and 2.0 to: http://effbot.org/pil If everything goes according to plan, the labs will release an "official" kit later this week (watch www.pythonware.com for announcements). From Matthew.Belk@noaa.gov Tue Nov 21 06:34:59 2000 From: Matthew.Belk@noaa.gov (Matthew Belk) Date: Tue, 21 Nov 2000 06:34:59 +0000 Subject: [Image-SIG] PIL floodfill? Message-ID: <3A1A1793.6CE39762@noaa.gov> This is a multi-part message in MIME format. --------------23F6FE548E2F1B20B375ED46 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello All, I would first like to say that I am a complete fan of PIL. I work for the National Weather Service in Charleston WV. Using PIL, I was finally able to add some features to our web site like plotting polygons of tornado warnings and the like. This has made it much easier for the users of our web site to get potentially life-saving information much faster. The WV Office of Emergency Services uses our site heavily as a result. Thank you Mr. Lundh! That said, I was wondering if there is a flood fill feature in PIL? I am using PIL 1.0 with Python 1.5.2. I have searched the PIL documentation and these archives, but I must have missed something somewhere. What I am doing is taking an image of a state, complete with counties. I would like to be able to fill in any of the counties with a color. I have already written a routine to do it point by point, but I am not really happy with it since it fails on some of the more complex county shapes. It is also heavily dependent upon where you start filling in the county. I keep thinking there has to be a better way. One idea I had was to find the border of a county and then redraw it as a filled polygon. Am I on the right track? Any better ideas would be appreciated. I would like to distribute this software to other NWS offices soon. Thanks in advance, Matthew Belk Meteorologist NWS Charleston WV --------------23F6FE548E2F1B20B375ED46 Content-Type: text/x-vcard; charset=us-ascii; name="matthew.belk.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Matthew Belk Content-Disposition: attachment; filename="matthew.belk.vcf" begin:vcard n:Belk;Matthew tel;work:(304) 746-0180 x-mozilla-html:FALSE org:NOAA;NWS version:2.1 email;internet:Matthew.Belk@noaa.gov title:Meteorogist - General Forecaster adr;quoted-printable:;;400 Parkway Road=0D=0A;Charleston;WV;25309; fn:Matthew Belk end:vcard --------------23F6FE548E2F1B20B375ED46-- From schneider.ch@gmx.de Tue Nov 21 11:51:39 2000 From: schneider.ch@gmx.de (schneider.ch@gmx.de) Date: Tue, 21 Nov 2000 12:51:39 +0100 (MET) Subject: [Image-SIG] PIL 1.1.1 for Python 2.0? Message-ID: <3584.974807499@www31.gmx.net> Great! I can't hardly wait :-) -- Sent through GMX FreeMail - http://www.gmx.net From clee@v1.wustl.edu Tue Nov 21 17:08:49 2000 From: clee@v1.wustl.edu (Christopher Lee) Date: Tue, 21 Nov 2000 11:08:49 -0600 (CST) Subject: [Image-SIG] PIL 1.1.1 win32 binaries page In-Reply-To: <003201c0521e$c7af12d0$3c6340d5@hagrid> References: <003201c0521e$c7af12d0$3c6340d5@hagrid> Message-ID: <14874.44065.214995.579166@gnwy100.wuh.wustl.edu> I've put together a web page that collects win32 binary versions of PIL 1.1.1. The site is hosted by sourceforge, and others are welcome to link to it. http://piddle.sourceforge.net/PIL/pildownload.html -chris From cdsuh@vision.hanyang.ac.kr Wed Nov 22 14:48:24 2000 From: cdsuh@vision.hanyang.ac.kr (Changduck Suh) Date: Wed, 22 Nov 2000 23:48:24 +0900 Subject: [Image-SIG] How can I use PIL 1.1.1 on Windows? Message-ID: <3A1BDCB8.54FD946C@vision.hanyang.ac.kr> hi, I want to use PIL(Python Image Library) 1.1.1 on Windows NT and Python 2.0. Some attempts such as import Image/ImageFilter, Image.open() were a success but some attempts such as im.filter(ImageFilter.BLUR) were a failure. Error message is "ImportError: The _imaging C module is not installed" Please tell me your Information on the problem. My install process was below. 1. copy the DLL file, '_imaging.dll' for Python 2.0(PIL 1.1) from http://effbot.org/pil. Because I can not get a DLL file for windows Python 2.0 at www.pythonware.com/products/pil. 2. copy the '_imagin.dll' file, [Pil], [Sane], [Scripts] directories of PIL 1.1.1 for Unix, and etc. to \Python20\PIL. 3. modify autoexec.bat for the path(\Python20\PIL, ~\PIL\PIL, ~\PIL\Scripts ...) From jmr@everest.radiology.uiowa.edu Wed Nov 22 15:06:26 2000 From: jmr@everest.radiology.uiowa.edu (Joe Reinhardt) Date: 22 Nov 2000 09:06:26 -0600 Subject: [Image-SIG] PIL floodfill? In-Reply-To: <3A1A1793.6CE39762@noaa.gov> References: <3A1A1793.6CE39762@noaa.gov> Message-ID: I have a seeded region growing routine written in python. It works for both 4 and 8 connectivities on 2D PIL images, but it is extremely slow. If the regions you are filling are small it might be OK, but for large regions I would suggest using a compiled module built in C. My code requires Numeric, since I found that pixel access was much faster using Numeric arrays rather than using PIL images with getpixel and putpixel. If you want to try it, let me know and I can email it to you. -- Joseph M. Reinhardt, Ph.D. Department of Biomedical Engineering joe-reinhardt@uiowa.edu 1402 SC Telephone: 319-335-5634 University of Iowa FAX: 319-335-5631 Iowa City, IA 52242 From fredrik@pythonware.com Thu Nov 23 12:27:34 2000 From: fredrik@pythonware.com (Fredrik Lundh) Date: Thu, 23 Nov 2000 13:27:34 +0100 Subject: [Image-SIG] How can I use PIL 1.1.1 on Windows? References: <3A1BDCB8.54FD946C@vision.hanyang.ac.kr> Message-ID: <00ee01c05548$c2cc0250$0900a8c0@SPIFF> Changduck Suh wrote: > Some attempts such as import Image/ImageFilter, Image.open() were a > success but some attempts such as im.filter(ImageFilter.BLUR) were a > failure. > Error message is "ImportError: The _imaging C module is not installed" what happens if you fire up Python and just type >>> import _imaging From doko@cs.tu-berlin.de Wed Nov 29 20:38:19 2000 From: doko@cs.tu-berlin.de (Matthias Klose) Date: Wed, 29 Nov 2000 21:38:19 +0100 (MET) Subject: [Image-SIG] JPEG problems on Alpha Message-ID: <14885.26939.304029.644964@gargle.gargle.HOWL> [The following bug report was submitted to the Debian bug tracking system; please cc 69215@bugs.debian.org on replies.] From: John Goerzen Subject: python-imaging: JPEG problems on Alpha To: submit@bugs.debian.org X-Mailer: bug 3.3.4 Delivered-To: submit@bugs.debian.org Package: python-imaging Version: 1.1-2 Severity: important I suspect this is a 64-bit problem. The program consistently reports "cannot identify image file" when dealing with JPEG images. This behavior does not manifest itself on i386. I have noticed a lot of usage of longs in the C code. This is very bad, esp. when reading data from file -- a long is not always 4 bytes! From fredrik@pythonware.com Thu Nov 30 11:27:34 2000 From: fredrik@pythonware.com (Fredrik Lundh) Date: Thu, 30 Nov 2000 12:27:34 +0100 Subject: [Image-SIG] JPEG problems on Alpha References: <14885.26939.304029.644964@gargle.gargle.HOWL> Message-ID: <003e01c05ac0$89a61ec0$0900a8c0@SPIFF> From: John Goerzen > Version: 1.1-2 What's this? There's no official PIL release named 1.1-2. The current version is 1.1.1. > I suspect this is a 64-bit problem. The program consistently reports > "cannot identify image file" when dealing with JPEG images. This behavior > does not manifest itself on i386. PIL has been running on Alpha boxes since before it's first public release. The JPEG support works perfectly fine under tru64, and on many other 64-bit systems. Do you get the error message on "open", or when you're trying to do things with the file? (if open is successful, trying doing an explicit load) Have you tested more than one file? (there's a sample file included in the source distribution) Maybe you have a broken compiler? > I have noticed a lot of usage of longs in the C code. This is very bad, > esp. when reading data from file -- a long is not always 4 bytes! Oh, really? From doko@cs.tu-berlin.de Thu Nov 30 12:38:39 2000 From: doko@cs.tu-berlin.de (Matthias Klose) Date: Thu, 30 Nov 2000 13:38:39 +0100 (MET) Subject: [Image-SIG] JPEG problems on Alpha In-Reply-To: <003e01c05ac0$89a61ec0$0900a8c0@SPIFF> References: <14885.26939.304029.644964@gargle.gargle.HOWL> <003e01c05ac0$89a61ec0$0900a8c0@SPIFF> Message-ID: <14886.19023.725523.187977@gargle.gargle.HOWL> Fredrik Lundh writes: > From: John Goerzen > > > Version: 1.1-2 > > What's this? There's no official PIL release named 1.1-2. The > current version is 1.1.1. This is the official upstream version 1.1, packaged as a Debian package. Appended is the Debian revision (added is a debian subdirectory for the packaging). The only change in the upstream version is the correction of hardcoded pathes in the Seup file and in the Makefile. Other changes like building the separate _tkimaging module were sent to you and integrated. > Maybe you have a broken compiler? compiled with gcc-2.95.2.