From kcazabon" Message-ID: <001d01c02b3f$5f88aaa0$16107118@rct1.bc.wave.home.com> I think the problem might be with your draw.setink() command. If you're working with RGB images, you should probably use an RGB tuple. draw.setink((128, 128, 128)) I'm not sure, but that might help you out. Kevin Cazabon. ----- Original Message ----- From: "Juha Ylitalo" To: Sent: Saturday, September 30, 2000 2:36 PM Subject: [Image-SIG] JPG and ImageDraw From juha.o.ylitalo@nokia.com Sun Oct 1 19:48:38 2000 From: juha.o.ylitalo@nokia.com (Juha Ylitalo) Date: Sun, 1 Oct 2000 21:48:38 +0300 Subject: [Image-SIG] JPG and ImageDraw In-Reply-To: <001d01c02b3f$5f88aaa0$16107118@rct1.bc.wave.home.com>; from kcazabon@home.com on Sat, Sep 30, 2000 at 05:34:35PM -0700 References: <20001001003603.A6085@shoes.st-paul> <001d01c02b3f$5f88aaa0$16107118@rct1.bc.wave.home.com> Message-ID: <20001001214837.B8493@shoes.st-paul> --oLBj+sq0vYjzfsbl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 30, 2000 at 05:34:35PM -0700, EXT kcazabon wrote: > I think the problem might be with your draw.setink() command. If you're > working with RGB images, you should probably use an RGB tuple. >=20 > draw.setink((128, 128, 128)) >=20 > I'm not sure, but that might help you out. It seems that I made wrong assumptions from the error messages that I received. Real problem was not with DrawImage.ink, but in a way that I gave coordinates for line. For reason or another my system doesn't seem to support use of tuples in coordinates (i.e. d.line( (0,0), (50,50))) like my documentation claims.=20 Thankfully, it accepts list (i.e. d.line([0,0,50,50])), which is also listed as one way to give those coordinates, and I manage to get things working. -- Juha Ylitalo juha.o.ylitalo@nokia.com KOM 5/3 312 http://wwwinhel.ntc.nokia.com/~jylitalo +358 40 562 6152 http://www.iki.fi/~jylitalo "Some tools are used, because its policy, others because they are good." --oLBj+sq0vYjzfsbl Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.3 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE514cFs9o7tOc1jEMRAg7VAJwPqoTLRUKqDWuuxzOIUIvvy/JdsgCfRhp1 exkG6n2N7RtckmLHtoEOcf4= =TF4P -----END PGP SIGNATURE----- --oLBj+sq0vYjzfsbl-- From Deokyong.Park@tribon.com Wed Oct 4 08:17:03 2000 From: Deokyong.Park@tribon.com (Deok Yong Park) Date: Wed, 4 Oct 2000 09:17:03 +0200 Subject: [Image-SIG] ImageTk Message-ID: <97B4561C429C484D8F7053C1DA9B49110C4C70@Exchange01.kcs.se> Hello, I'm trying to use PIL to handle some image with Tk. But I have some trouble. Could you give me some tips? For your information, I'm using Windows NT. Best regards, Deok-Yong from Tkinter import * Import Image Import ImageTk self.CBframe = Frame(self.frame) self.CBframe.pack() myimage=Image.open("c:\\nor.jpg") myimage1=myimage.convert("1") #myimage1.show() # work well myimageT= ImageTk.BitmapImage(myimage1) ### error ===============Error message================================ Exception exceptions.AttributeError: '_BitmapImage__photo' in ignored Traceback (innermost last): File "C:\PROGRA~1\Python\Tools\idle\ScriptBinding.py", line 131, in run_module_event execfile(filename, mod.__dict__) File "C:\menu.py", line 52, in ? d=Mainmenu(root) File "C:\menu.py", line 16, in __init__ self.MakeCheckButton() File "C:\menu.py", line 37, in MakeCheckButton myimageT= ImageTk.BitmapImage(myimage1) File "C:\Program Files\Python\Lib\ImageTk.py", line 158, in __init__ self.__photo = apply(Tkinter.BitmapImage, (), kw) File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1917, in __init__ apply(Image.__init__, (self, 'bitmap', name, cnf, master), kw) File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1839, in __init__ self.tk.call(('image', 'create', imgtype, name,) + options) TclError: can't invoke "image" command: application has been destroyed ============================================================== #c = Checkbutton(self.frame, bitmap="@c:\\noriko8.xbm", fg="black", command="BandCB") c=Checkbutton(self.frame, bitmap=myimage1) c.pack() From jeffrey.simpson@supplysolution.com Fri Oct 6 17:42:15 2000 From: jeffrey.simpson@supplysolution.com (Jeff Simpson) Date: Fri, 06 Oct 2000 09:42:15 -0700 Subject: [Image-SIG] transparency issues Message-ID: <39DE00E7.BC050C6@supplysolution.com> I'm using PIL 1.1 to create some simple images, with lines and rectangles. I am having a problem making the background for the image transparent. I was wondering if anyone knows if these features work (i.e. do transparency masks work in 1.1?). If so, can someone post a small example snippet for making a region transparent? Thanks From Joerg.Baumann@stud.informatik.uni-erlangen.de Fri Oct 6 22:09:43 2000 From: Joerg.Baumann@stud.informatik.uni-erlangen.de (Joerg Baumann) Date: Fri, 6 Oct 2000 23:09:43 +0200 (MET DST) Subject: [Image-SIG] transparency issues In-Reply-To: <39DE00E7.BC050C6@supplysolution.com> Message-ID: On Fri, 6 Oct 2000, Jeff Simpson wrote: > I'm using PIL 1.1 to create some simple images, with lines and > rectangles. I am having a problem making the background for the image > transparent. I was wondering if anyone knows if these features work > (i.e. do transparency masks work in 1.1?). If so, can someone post a > small example snippet for making a region transparent? > > Thanks This works for me (PIL 1.1 Linux) import Image #new image img=Image.new("RGB",(100,100),(0,100,200)) #add alpah channel img=img.convert("RGBA") #draw violet background img.paste((100,0,200,255),(0,0,100,100)) #make center transparent img.paste((0,0,0,0),(20,20,80,80)) # save as png (png works, tif and gif not, tga?) img.save("alpha.png") bye joerg Joerg Baumann joerg.baumann@stud.informatik.uni-erlangen.de +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Beware of bugs in the above code; I have only proved it correct, not tried it. Don Knuth From Duane.Kaufman@amermsx.med.ge.com Mon Oct 9 22:17:23 2000 From: Duane.Kaufman@amermsx.med.ge.com (Kaufman, Duane (MED, LUNAR)) Date: Mon, 9 Oct 2000 16:17:23 -0500 Subject: [Image-SIG] PIL Win32 binaries for Python 1.6 (final) Message-ID: <411301487662D411ADDB0090274F3A7512659E@USWAUMSX01MEDGE> Hello! My name is Duane Kaufman, and I would very much like to get PIL working under my installation of Python 1.6 (final) under Win32. Could anyone point me towards sources for such a thing? Thanks Duane From aa8vb@yahoo.com Wed Oct 11 23:56:58 2000 From: aa8vb@yahoo.com (Randall Hopper) Date: Wed, 11 Oct 2000 18:56:58 -0400 Subject: [Image-SIG] show() and save() glitches (PIL 1.1, Py 2.0b2) Message-ID: <20001011185657.A1694680@vislab.epa.gov> Trying out PIL 1.1 on Python 2.0b2 here. I'm really impressed it can read and thumbnail this image, and fast, without requiring massive VM. Hit a few stumbles though in doing something simple with the thumbnail though. show() trips on an internal error, and so does save(). Note that this is a "huge" 8-bit palettized image (mode P). It thumbnails fine. The problem is then doing a show() or doing a save() to TIFF on the resulting thumbnail. Randall ------------------------------------------------------------------------------ show() glitch: ------------------------------------------------------------------------------ > python2 Python 2.0b2 (#2, Oct 11 2000, 17:40:00) [C] on irix646-n32 Type "copyright", "credits" or "license" for more information. >>> import Image >>> im = Image.open( "penn_mrlc.tif" ) >>> im.size (24758, 13716) >>> im.mode 'P' >>> im.thumbnail( (128,128) ) >>> im.size (128, 70) >>> im.mode 'P' >>> im.show() Traceback (most recent call last): File "", line 1, in ? File "/home/rhh/software/python2/lib/python2.0/site-packages/PIL/Image.py", line 695, in show _showxv(self, title, command) File "/home/rhh/software/python2/lib/python2.0/site-packages/PIL/Image.py", line 973, in _showxv file = self.convert(base)._dump(format=format) File "/home/rhh/software/python2/lib/python2.0/site-packages/PIL/Image.py", line 312, in _dump file = file + "." + format TypeError: cannot add type "None" to string ------------------------------------------------------------------------------ save() glitch: ------------------------------------------------------------------------------ > python2 Python 2.0b2 (#2, Oct 11 2000, 17:40:00) [C] on irix646-n32 Type "copyright", "credits" or "license" for more information. >>> import Image >>> im = Image.open( "penn_mrlc.tif" ) ... etc. - same as above ... >>> im.save( "t.tif" ) Traceback (most recent call last): File "", line 1, in ? File "/home/rhh/software/python2/lib/python2.0/site-packages/PIL/Image.py", line 667, in save SAVE[string.upper(format)](self, fp, filename) File "/home/rhh/software/python2/lib/python2.0/site-packages/PIL/TiffImagePlugin.py", line 592, in _save offset = ifd.save(fp) File "/home/rhh/software/python2/lib/python2.0/site-packages/PIL/TiffImagePlugin.py", line 329, in save append(tag, typ, len(value), data + (4-len(data))*"\0", "") TypeError: append requires exactly 1 argument; 5 given >>> im.save( "t.gif" ) >>> ------------------------------------------------------------------------------ A few small glitches in building it, but I'll report later. Randall -- Randall Hopper aa8vb@yahoo.com From aa8vb@yahoo.com Thu Oct 12 13:21:27 2000 From: aa8vb@yahoo.com (Randall Hopper) Date: Thu, 12 Oct 2000 08:21:27 -0400 Subject: FW: [Image-SIG] show() and save() glitches (PIL 1.1, Py 2.0b2) In-Reply-To: ; from Moodie.Craig.CA@bhp.com on Thu, Oct 12, 2000 at 02:27:21PM +1100 References: Message-ID: <20001012082127.A1838922@vislab.epa.gov> Moodie, Craig CA: |Randall, | Try this:- |for infile in sys.argv[1:]: | outfile=os.path.splitext(infile)[0]+".pcx" | im=Image.open(infile) | #if im.mode != "RGB": this also works | # im = im.convert("RGB") | if im.mode == "P" : | im=im.convert("P") | im.save(outfile,"PCX") Thanks. PCX works too as well as GIF. I think the save() bug must just be in the paletted TIFF saver. Randall -- Randall Hopper aa8vb@yahoo.com From fredrik@pythonware.com Fri Oct 13 10:16:06 2000 From: fredrik@pythonware.com (Fredrik Lundh) Date: Fri, 13 Oct 2000 11:16:06 +0200 Subject: [Image-SIG] show() and save() glitches (PIL 1.1, Py 2.0b2) References: <20001011185657.A1694680@vislab.epa.gov> Message-ID: <02ab01c034f6$38939890$0900a8c0@SPIFF> randall wrote: > Hit a few stumbles though in doing something simple with the thumbnail > though. show() trips on an internal error, and so does save(). Note that > this is a "huge" 8-bit palettized image (mode P). It thumbnails fine. The > problem is then doing a show() or doing a save() to TIFF on the resulting > thumbnail. show() is broken in 1.1 (on Unix, at least). The _dump method in Image.py contains a check for "format == PPM"; it should check for None or PPM. save() is broken for TIFF files only under 1.6 and 2.0. To fix this, add extra parenthesis around the arguments to the three append calls around line 325 in TiffImagePlugin.py. We plan to release a new version before the end of this month; for more information, check the "eff-bot online" at: http://hem.passagen.se/eff/2000_10_01_bot-archive.htm#1065681 Cheers /F From pachai@creatis.insa-lyon.fr Fri Oct 13 13:28:37 2000 From: pachai@creatis.insa-lyon.fr (Chahin Pachai) Date: Fri, 13 Oct 2000 14:28:37 +0200 Subject: [Image-SIG] Handling 16 bit images with PIL References: <20001012160151.B04481D234@dinsdale.python.org> Message-ID: <39E6FFF4.EB2E50B4@creatis.insa-lyon.fr> I am using PIL and would like to read and process 16 bits raw ushort images. Which data format would be the best choice? Has anybody already develop such a file decoder? thanks. From aa8vb@yahoo.com Fri Oct 13 16:55:45 2000 From: aa8vb@yahoo.com (Randall Hopper) Date: Fri, 13 Oct 2000 11:55:45 -0400 Subject: [Image-SIG] show() and save() glitches (PIL 1.1, Py 2.0b2) In-Reply-To: <02ab01c034f6$38939890$0900a8c0@SPIFF>; from fredrik@pythonware.com on Fri, Oct 13, 2000 at 11:16:06AM +0200 References: <20001011185657.A1694680@vislab.epa.gov> <02ab01c034f6$38939890$0900a8c0@SPIFF> Message-ID: <20001013115545.A1980988@vislab.epa.gov> Fredrik Lundh: |show() is broken in 1.1 (on Unix, at least). The _dump method |in Image.py contains a check for "format == PPM"; it should check |for None or PPM. | |save() is broken for TIFF files only under 1.6 and 2.0. To fix this, |add extra parenthesis around the arguments to the three append |calls around line 325 in TiffImagePlugin.py. | |We plan to release a new version before the end of this month; |for more information, check the "eff-bot online" at: |http://hem.passagen.se/eff/2000_10_01_bot-archive.htm#1065681 Ok, known problems then. Thanks for the reply and for the fixes. Randall -- Randall Hopper aa8vb@yahoo.com From klimek@grc.nasa.gov Fri Oct 13 18:20:18 2000 From: klimek@grc.nasa.gov (Robert B. Klimek) Date: Fri, 13 Oct 2000 13:20:18 -0400 Subject: [Image-SIG] Handling 16 bit images with PIL In-Reply-To: <39E6FFF4.EB2E50B4@creatis.insa-lyon.fr> References: <20001012160151.B04481D234@dinsdale.python.org> Message-ID: <4.1.20001013131013.00a81610@parrot.grc.nasa.gov> At 02:28 PM 10/13/00 +0200, you wrote: > > > >I am using PIL and would like to read and process 16 bits raw ushort images. >Which data format would be the best choice? Has anybody already develop such >a file decoder? >thanks. > This is a question I'm also interested in, but have no good answer for. I don't see a way of doing it with PIL (unless I overlooked something) but maybe Numeric Python might do something. I was thinking on converting the image (whether its 10-bit, 12-bit, of 16-bit) to a floating pt. array, doing your processing, and converting back to the right format. Haven't tried it yet so can't say whether its even possible. Bob ------------------------------------------------- Robert B. Klimek NASA Glenn Research Center robert.klimek@grc.nasa.gov (216) 433-2837 -------------------------------------------------- From jeffrey.simpson@supplysolution.com Fri Oct 13 20:29:40 2000 From: jeffrey.simpson@supplysolution.com (Jeff Simpson) Date: Fri, 13 Oct 2000 12:29:40 -0700 Subject: [Image-SIG] Image.tostring method Message-ID: <39E762A4.176FA143@supplysolution.com> I'm trying to use the Image.tostring method to spit out data for a gif image I have generated in a script. I can successfully use Image.save('blah.gif') to create a gif, but would like to be able to store this data in memory and eventually shove it into a web page - sans file. Does anyone have an example call (with args for the encoder). Here is what I've been using for Image.tostring: ....some steps to create the image with RGBA mode skipped # Now I wanna get the str data >>> data = im.tostring('gif', 'RGBA') >>> im.save(blah_a.gif') >>> fd = open('blah_b.gif', 'w') >>> fd.write(data) >>> fd.close() blah_a, generated from Image.save is happy and I can viedw it with xv. blah_b, generated with Image.tostring is bogus. I'm a little confused as to what needs to be passed to the encoder to make it work correctly. Help? Thanks From kcaza@cymbolic.com Fri Oct 13 20:55:44 2000 From: kcaza@cymbolic.com (kcaza@cymbolic.com) Date: Fri, 13 Oct 2000 12:55:44 -0700 Subject: [Image-SIG] Image.tostring method Message-ID: <88256977.006D79AF.00@mail.cymbolic.com> Image.tostring() does not give you a string representation of a GIF image... it gives you the image data itself, pixel for pixel. If you want to format that into a GIF file, you'll have to do it some other way. I'd suggest either saving it as a GIF normally, the reading it back in from that file as a binary stream, or finding a way of capturing the Image .save function to memory instead of disk. Kevin. Jeff Simpson on 10/13/2000 12:29:40 PM To: image-sig@python.org cc: (bcc: Kevin Cazabon/cymbolic/gig) Subject: [Image-SIG] Image.tostring method I'm trying to use the Image.tostring method to spit out data for a gif image I have generated in a script. I can successfully use Image.save('blah.gif') to create a gif, but would like to be able to store this data in memory and eventually shove it into a web page - sans file. Does anyone have an example call (with args for the encoder). Here is what I've been using for Image.tostring: ....some steps to create the image with RGBA mode skipped # Now I wanna get the str data >>> data = im.tostring('gif', 'RGBA') >>> im.save(blah_a.gif') >>> fd = open('blah_b.gif', 'w') >>> fd.write(data) >>> fd.close() blah_a, generated from Image.save is happy and I can viedw it with xv. blah_b, generated with Image.tostring is bogus. I'm a little confused as to what needs to be passed to the encoder to make it work correctly. Help? Thanks _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://www.python.org/mailman/listinfo/image-sig From Joerg.Baumann@stud.informatik.uni-erlangen.de Sat Oct 14 16:25:53 2000 From: Joerg.Baumann@stud.informatik.uni-erlangen.de (Joerg Baumann) Date: Sat, 14 Oct 2000 17:25:53 +0200 (MET DST) Subject: [Image-SIG] Image.tostring method In-Reply-To: <39E762A4.176FA143@supplysolution.com> Message-ID: On Fri, 13 Oct 2000, Jeff Simpson wrote: > I'm trying to use the Image.tostring method to spit out data for a gif > image I have generated in a script. I can successfully use > Image.save('blah.gif') to create a gif, but would like to be able to > store this data in memory and eventually shove it into a web page - sans > file. Does anyone have an example call (with args for the encoder). > Here is what I've been using for Image.tostring: > > ....some steps to create the image with RGBA mode skipped > # Now I wanna get the str data > >>> data = im.tostring('gif', 'RGBA') > >>> im.save(blah_a.gif') > >>> fd = open('blah_b.gif', 'w') > >>> fd.write(data) > >>> fd.close() > > blah_a, generated from Image.save is happy and I can viedw it with xv. > blah_b, generated with Image.tostring is bogus. I'm a little confused > as to what needs to be passed to the encoder to make it work correctly. > Help? > > Thanks > data=im.tostring("jpeg","RGB") works for me, perhaps "RGBA" with gif gives the troubles? gif supports natively only 'P' or 'L'. joerg From clee@v1.wustl.edu Sat Oct 14 20:04:28 2000 From: clee@v1.wustl.edu (Christopher Lee) Date: Sat, 14 Oct 2000 14:04:28 -0500 Subject: [Image-SIG] using PIL as a package-PIL doesn't load all ImagePlugins-patch? Message-ID: <200010141904.OAA01891@gnwy100.wuh.wustl.edu> Hello, I'm trying to use PIL (Imaging-1.1) as a package, i.e., without adding the PIL directory to the python path. I appear to be having trouble because Image.py:: init() doesn't load the plugins appearing in the PIL directory w/o it being on the path. The code appears like this: for path in filter(os.path.isdir, sys.path): for file in os.listdir(path): if file[-14:] == "ImagePlugin.py": ## and so on ## ... Thus, for example, the PngImagePlugin.py is missed because it's nolonger on sys.path and it's not listed among the default plugins loaded in preinit(). I don't know if there a patch for this or a standard mechanism for dealing with this. I have fixed it "by hand" by enlarging the search to include the "PIL" directory (my patch starts after "cwl") : def init(): "Load all file format drivers." global _initialized if _initialized >= 2: return import os, sys # only check directories (including current, if present in the path) # cwl: have added directory that Image.py resides in to path search list tmppath = sys.path (directory, basename) = os.path.split(__file__) tmppath.append(directory) # print "directory is %s" % directory for path in filter(os.path.isdir, tmppath): for file in os.listdir(path): if file[-14:] == "ImagePlugin.py": p, f = os.path.split(file) f, e = os.path.splitext(f) try: sys.path.insert(0, path) try: __import__(f, globals(), locals(), []) finally: del sys.path[0] except ImportError: if DEBUG: print "Image: failed to import", print f, ":", sys.exc_value if OPEN or SAVE: _initialized = 2 From parkw@better.net Sat Oct 14 20:42:10 2000 From: parkw@better.net (William Park) Date: Sat, 14 Oct 2000 15:42:10 -0400 Subject: [Image-SIG] using PIL as a package-PIL doesn't load all ImagePlugins-patch? In-Reply-To: <200010141904.OAA01891@gnwy100.wuh.wustl.edu>; from clee@gnwy100.wuh.wustl.edu on Sat, Oct 14, 2000 at 02:04:28PM -0500 References: <200010141904.OAA01891@gnwy100.wuh.wustl.edu> Message-ID: <20001014154210.A5739@better.net> On Sat, Oct 14, 2000 at 02:04:28PM -0500, Christopher Lee wrote: > Hello, > > I'm trying to use PIL (Imaging-1.1) as a package, i.e., without adding the > PIL directory to the python path. Why? ---William Park, Open Geometry Consulting From clee@v1.wustl.edu Sat Oct 14 20:51:09 2000 From: clee@v1.wustl.edu (Christopher Lee) Date: Sat, 14 Oct 2000 14:51:09 -0500 (CDT) Subject: [Image-SIG] using PIL as a package-PIL doesn't load all ImagePlugins-patch? Message-ID: <14824.47405.199442.678392@gnwy100.wuh.wustl.edu> >>>>> "William" == William Park writes: William> On Sat, Oct 14, 2000 at 02:04:28PM -0500, Christopher Lee William> wrote: >> Hello, >> >> I'm trying to use PIL (Imaging-1.1) as a package, i.e., without >> adding the PIL directory to the python path. William> Why? Unfortunately, there are other programs that use the same module names (e.g., Zope). -chris From parkw@better.net Sat Oct 14 21:04:52 2000 From: parkw@better.net (William Park) Date: Sat, 14 Oct 2000 16:04:52 -0400 Subject: [Image-SIG] using PIL as a package-PIL doesn't load all ImagePlugins-patch? In-Reply-To: <14824.47405.199442.678392@gnwy100.wuh.wustl.edu>; from clee@gnwy100.wuh.wustl.edu on Sat, Oct 14, 2000 at 02:51:09PM -0500 References: <14824.47405.199442.678392@gnwy100.wuh.wustl.edu> Message-ID: <20001014160452.A5811@better.net> On Sat, Oct 14, 2000 at 02:51:09PM -0500, Christopher Lee wrote: > >>>>> "William" == William Park writes: > > William> On Sat, Oct 14, 2000 at 02:04:28PM -0500, Christopher Lee > William> wrote: > >> Hello, > >> > >> I'm trying to use PIL (Imaging-1.1) as a package, i.e., without > >> adding the PIL directory to the python path. > > William> Why? > > Unfortunately, there are other programs that use the same module names > (e.g., Zope). If I remember from Python documentation, you can put module in subdirectories, and call it by specifying the path, ie. import dir.subdir.module See the doc for exact syntax. ---William Park, Open Geometry Consulting From clee@v1.wustl.edu Sat Oct 14 21:16:17 2000 From: clee@v1.wustl.edu (Christopher Lee) Date: Sat, 14 Oct 2000 15:16:17 -0500 (CDT) Subject: [Image-SIG] using PIL as a package-PIL doesn't load all ImagePlugins-patch? In-Reply-To: <20001014160452.A5811@better.net> References: <14824.47405.199442.678392@gnwy100.wuh.wustl.edu> <20001014160452.A5811@better.net> Message-ID: <14824.48913.801432.155094@gnwy100.wuh.wustl.edu> >>>>> "William" == William Park writes: William> If I remember from Python documentation, you can put module in William> subdirectories, and call it by specifying the path, ie. William> import dir.subdir.module See the doc for exact syntax. Yes, I we're talking about the same thing. I'm using PIL as a package so that instead of doing an "import Image" I do "import PIL.Image". However, the init() code in Image.py relies upon Image.py being on the python path in order to find many of the image plugins (eg. PngImagingPlugin.py). The few lines of code I added appears to fix this problem. -chris From parkw@better.net Sat Oct 14 21:20:52 2000 From: parkw@better.net (William Park) Date: Sat, 14 Oct 2000 16:20:52 -0400 Subject: [Image-SIG] using PIL as a package-PIL doesn't load all ImagePlugins-patch? In-Reply-To: <14824.48913.801432.155094@gnwy100.wuh.wustl.edu>; from clee@gnwy100.wuh.wustl.edu on Sat, Oct 14, 2000 at 03:16:17PM -0500 References: <14824.47405.199442.678392@gnwy100.wuh.wustl.edu> <20001014160452.A5811@better.net> <14824.48913.801432.155094@gnwy100.wuh.wustl.edu> Message-ID: <20001014162052.A5872@better.net> On Sat, Oct 14, 2000 at 03:16:17PM -0500, Christopher Lee wrote: > Yes, I we're talking about the same thing. I'm using PIL as a package so > that instead of doing an "import Image" I do "import PIL.Image". However, > the init() code in Image.py relies upon Image.py being on the python path > in order to find many of the image plugins (eg. PngImagingPlugin.py). The > few lines of code I added appears to fix this problem. Sorry. I've been up all night. ---William Park, Open Geometry Consulting From fredrik@pythonware.com Sun Oct 15 13:05:05 2000 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sun, 15 Oct 2000 14:05:05 +0200 Subject: [Image-SIG] using PIL as a package-PIL doesn't load all ImagePlugins-patch? References: <200010141904.OAA01891@gnwy100.wuh.wustl.edu> Message-ID: <009701c036a0$2bcfa670$0900a8c0@SPIFF> Christopher wrote: > I appear to be having trouble because Image.py:: init() doesn't load the > plugins appearing in the PIL directory w/o it being on the path. it's a known bug in 1.1. the usual workaround is to explicitly import the file formats you need: from PIL import Image, PngImagePlugin, JpegImagePlugin (note that PIL successfully imports a couple of plugins if you *open* a file; it's only a real problem if you're writing out images you've created internally, or if you're using less common file formats). ::: > tmppath = sys.path note that this creates a reference to sys.path, and the following append will modify sys.path as well. use "tmppath = sys.path[:]" to create a (shallow) copy. ::: the "right" way to do this is to use the __path__ variable instead of sys.path (but only if it exists): try: tmppath = __path__ except: tmppath = sys.path ::: and yes, this is fixed in the upcoming 1.2 release. From fredrik@pythonware.com Sun Oct 15 12:58:23 2000 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sun, 15 Oct 2000 13:58:23 +0200 Subject: [Image-SIG] Image.tostring method References: <39E762A4.176FA143@supplysolution.com> Message-ID: <009601c036a0$2b9116d0$0900a8c0@SPIFF> jeff wrote: > I'm trying to use the Image.tostring method to spit out data for a gif > image I have generated in a script. I can successfully use > Image.save('blah.gif') to create a gif, but would like to be able to > store this data in memory and eventually shove it into a web page - sans > file. Does anyone have an example call (with args for the encoder). "tostring" only gives you the image data, not a complete file (codecs and file format handlers are two different things in PIL) to do what you want, use the "save" method, and save to a StringIO object: file = StringIO.StringIO() im.save(file, "GIF") data = file.getvalue() hope this helps! From galle@rostock.zgdv.de Wed Oct 18 11:41:37 2000 From: galle@rostock.zgdv.de (Torsten Gallmeister) Date: Wed, 18 Oct 2000 12:41:37 +0200 Subject: [Image-SIG] create image-instances from data strings Message-ID: <39ED7E61.2294DDCF@rostock.zgdv.de> Hello, can anyone help me? I try to convert JPEG images from LDAP and put it in an ZOPE-Application. I think I have to use the fromstring and tostring methods, but don't know, which parameters to use. Image.fromstring("RGB",(150,200), data) raises "ValueError: not enough image data" Another problem in this way is to get the imagesize. Or is there another way to do that. Putting the data in an file , using Image.open(), Image.save() an finally read the data from the saved file works. But it's not the way I want to do that. Perhaps there is a similar way to .open() and .save() with using memory data ?? Thanks for any help, Torsten. From fredrik@pythonware.com Wed Oct 18 12:00:18 2000 From: fredrik@pythonware.com (Fredrik Lundh) Date: Wed, 18 Oct 2000 13:00:18 +0200 Subject: [Image-SIG] create image-instances from data strings References: <39ED7E61.2294DDCF@rostock.zgdv.de> Message-ID: <013a01c038f2$9b18aaa0$0900a8c0@SPIFF> Torsten wrote: > I try to convert JPEG images from LDAP and put it in an > ZOPE-Application. /.../ > Putting the data in an file , using Image.open(), Image.save() an > finally read the data from the saved file works. But it's not the way I > want to do that. Perhaps there is a similar way to .open() and .save() > with using memory data ?? sure: just wrap the data in a StringIO object, and use Image.open() on that object: file = StringIO.StringIO(data) image = Image.open(file) saving to a string is as easy (cf. the recent "Image.tostring" thread) file = StringIO.StringIO() im.save(file, "JPEG") data = file.getvalue() From galle@rostock.zgdv.de Wed Oct 18 13:34:53 2000 From: galle@rostock.zgdv.de (Torsten Gallmeister) Date: Wed, 18 Oct 2000 14:34:53 +0200 Subject: [Image-SIG] create image-instances from data strings References: <39ED7E61.2294DDCF@rostock.zgdv.de> <013a01c038f2$9b18aaa0$0900a8c0@SPIFF> Message-ID: <39ED98ED.E348E999@rostock.zgdv.de> Cool, that works but only for the open method. Image.save(file) and getting values with file.getvalue() gives me the initial data of der StringIO object.Image.save("filename") makes the correct/changed imagefile. do you know what's happen? Torsten. > sure: just wrap the data in a StringIO object, and use > Image.open() on that object: > > file = StringIO.StringIO(data) > image = Image.open(file) > > saving to a string is as easy (cf. the recent "Image.tostring" thread) > > file = StringIO.StringIO() > im.save(file, "JPEG") > data = file.getvalue() > > From Joerg.Baumann@stud.informatik.uni-erlangen.de Wed Oct 18 13:45:44 2000 From: Joerg.Baumann@stud.informatik.uni-erlangen.de (Joerg Baumann) Date: Wed, 18 Oct 2000 14:45:44 +0200 (MET DST) Subject: [Image-SIG] create image-instances from data strings In-Reply-To: <39ED98ED.E348E999@rostock.zgdv.de> Message-ID: On Wed, 18 Oct 2000, Torsten Gallmeister wrote: > Cool, that works but only for the open method. Image.save(file) and getting > values with file.getvalue() gives me the initial data of der StringIO > object.Image.save("filename") makes the correct/changed imagefile. > do you know what's happen? > > Torsten. > the example: file = StringIO.StringIO() im.save(file, "JPEG") data = file.getvalue() works for me (linux, Python 1.5.2, PIL 1.1) Perhaps you have following problem: file = StringIO.StringIO() file is a write-only file-like-object file = StringIO.StringIO(data) file is a read-only file-like-object Joerg Baumann joerg.baumann@stud.informatik.uni-erlangen.de +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Beware of bugs in the above code; I have only proved it correct, not tried it. Don Knuth From fredrik@pythonware.com Wed Oct 18 13:49:25 2000 From: fredrik@pythonware.com (Fredrik Lundh) Date: Wed, 18 Oct 2000 14:49:25 +0200 Subject: [Image-SIG] create image-instances from data strings References: <39ED7E61.2294DDCF@rostock.zgdv.de> <013a01c038f2$9b18aaa0$0900a8c0@SPIFF> <39ED98ED.E348E999@rostock.zgdv.de> Message-ID: <01c001c03901$d93ae500$0900a8c0@SPIFF> Torsten wrote: > Cool, that works but only for the open method. Image.save(file) and getting > values with file.getvalue() gives me the initial data of der StringIO > object. what initial data? (a new StringIO object has no content). here's an example cut and pasted from a terminal window (using Python 1.5.2, PIL 1.1): >>> import Image >>> im = Image.open("/images/lenna.im") >>> import StringIO >>> file = StringIO.StringIO() >>> im.save(file, "JPEG") >>> data = file.getvalue() >>> len(data) 29921 >>> repr(data[:10]) "'\\377\\330\\377\\340\\000\\020JFIF'" From galle@rostock.zgdv.de Wed Oct 18 14:46:52 2000 From: galle@rostock.zgdv.de (Torsten Gallmeister) Date: Wed, 18 Oct 2000 15:46:52 +0200 Subject: [Image-SIG] create image-instances from data strings References: <39ED7E61.2294DDCF@rostock.zgdv.de> <013a01c038f2$9b18aaa0$0900a8c0@SPIFF> <39ED98ED.E348E999@rostock.zgdv.de> <01c001c03901$d93ae500$0900a8c0@SPIFF> Message-ID: <39EDA9CB.60FE72E8@rostock.zgdv.de> I need to change only data: I get the data from LDAP and I want to change the size and palette and then create an ZOPE - image object from that data.Now, after reading the reply from Joerg Baumann I used two StringIO objects, one for reading LDAP data and one for saving changes. The result is now better. But only resizing is o.k. . The palette-manipulations I get only in a saved file with Image.save("img.jpg"). I use Python 1.5.2 and PIL 1.1 too. my code is : # photo are dats from LDAP readfile=StringIO.StringIO(photo) witefile=StringIO.StringIO() im=Image.open(readfile) b,h=im.size im=im.convert("L").convert("RGB") im=im.resize((b*height/h,height)) im=im.convert("L").convert("P") # put a new palette area im.putpalette(palette) # this imagedata are only resized im.convert("RGB").save(writefile,"JPEG") # and here is all ok im.convert("RGB").save("img.jpg") dats=writefile.getvalue() # ZOPE -> create the Zope-Image obj ph=OFS.Image.Image('photo.jpg','Photo',dats) self.local_images._setObject('photo.jpg',ph) > Torsten wrote: > > Cool, that works but only for the open method. Image.save(file) and getting > > values with file.getvalue() gives me the initial data of der StringIO > > object. > > what initial data? (a new StringIO object has no content). > > here's an example cut and pasted from a terminal window > (using Python 1.5.2, PIL 1.1): > > >>> import Image > >>> im = Image.open("/images/lenna.im") > >>> import StringIO > >>> file = StringIO.StringIO() > >>> im.save(file, "JPEG") > >>> data = file.getvalue() > >>> len(data) > 29921 > >>> repr(data[:10]) > "'\\377\\330\\377\\340\\000\\020JFIF'" > > From galle@rostock.zgdv.de Wed Oct 18 14:53:37 2000 From: galle@rostock.zgdv.de (Torsten Gallmeister) Date: Wed, 18 Oct 2000 15:53:37 +0200 Subject: [Image-SIG] create image-instances from data strings References: <39ED7E61.2294DDCF@rostock.zgdv.de> <013a01c038f2$9b18aaa0$0900a8c0@SPIFF> <39ED98ED.E348E999@rostock.zgdv.de> <01c001c03901$d93ae500$0900a8c0@SPIFF> Message-ID: <39EDAB61.7D273237@rostock.zgdv.de> I solved the problem: With creating a new Image with Image.copy() and making manipulations on it works. Thanks for your help, Torsten. From clee@v1.wustl.edu Wed Oct 18 19:16:31 2000 From: clee@v1.wustl.edu (Christopher Lee) Date: Wed, 18 Oct 2000 13:16:31 -0500 Subject: [Image-SIG] help building on WinNT Message-ID: <200010181816.NAA30583@gnwy100.wuh.wustl.edu> Hello, I just picked up a copy of MSVC and I'm making my first attempt at building Imaging-1.1 for win32. Unfortunately, I'm a bit lost. Does anyone have a project file that works with MS Visual studio that I could look at? Many thanks, -chris p.s. I have the binary version of python 1.5.2 installed and I have the python source available. I tried using David Ascher's compile.py to generate a project file, but couldn't get it to parse my Setup file correctly. From tdh101@york.ac.uk Fri Oct 20 12:43:33 2000 From: tdh101@york.ac.uk (Tom) Date: Fri, 20 Oct 2000 12:43:33 +0100 (BST) Subject: [Image-SIG] Problem installing PIL. Message-ID: I'm having problems getting PIL to work. I'm using Windows 98 and Python v2.0. After installing PIL, I can access the various modules OK, but whenever I actually try to do some image processing I get the message "C _imaging Library is not installed" For example: import Image im = Image.open("D:\\myPic.bmp") im.show() error - "C _imaging Library is not installed". There is an _imaging.dll file included in the download, as far as I can tell, it is in the Python path. What more installation does it need? Hope you can help. Tom Thomas David Heseltine - Computer Science Student - University of York Home Telephone: 01904 644514 Mobile Telephone: 07715833818 Instant Messaging: tomheseltine Email -> Mobile (140 characters max.): tomheseltine@sms.genie.co.uk From fredrik@pythonware.com Fri Oct 20 12:56:35 2000 From: fredrik@pythonware.com (Fredrik Lundh) Date: Fri, 20 Oct 2000 13:56:35 +0200 Subject: [Image-SIG] Problem installing PIL. References: Message-ID: <017c01c03a8c$cc635bf0$0900a8c0@SPIFF> Tom wrote > I'm having problems getting PIL to work. I'm using Windows 98 and Python > v2.0. After installing PIL, I can access the various modules OK, but > whenever I actually try to do some image processing I get the message "C > _imaging Library is not installed" > > For example: > > import Image > im = Image.open("D:\\myPic.bmp") > im.show() > > error - "C _imaging Library is not installed". what happens if you type "import _imaging" ? From info@pythonware.com Mon Oct 23 14:09:41 2000 From: info@pythonware.com (PythonWare) Date: Mon, 23 Oct 2000 15:09:41 +0200 Subject: [Image-SIG] ANNOUNCEMENT: The Python Imaging Library, version 1.1.1 (oct 20, 2000) Message-ID: <003b01c03cf2$82f217f0$0900a8c0@SPIFF> yet another release from the labs: The Python Imaging Library (PIL) adds image processing capabilities to your Python interpreter. This library supports many file formats, and provides powerful image processing and graphics capabilities. Version 1.1.1 is a maintenance upgrade. The changes include proper handling of TIFF files under Python 2.0, better plugin detection when using PIL as a package, and some bug fixes. Get your copy of the source kit here: http://www.pythonware.com/downloads.htm#pil11 For more information, including support options, see the product site: http://www.pythonware.com/products/pil/ enjoy, the pil team "Secret Labs -- makers of fine pythonware since 1997." From fredrik@pythonware.com Mon Oct 23 14:20:16 2000 From: fredrik@pythonware.com (Fredrik Lundh) Date: Mon, 23 Oct 2000 15:20:16 +0200 Subject: [Image-SIG] ANNOUNCEMENT: The Python Imaging Library, version 1.1.1 (oct 20, 2000) References: <003b01c03cf2$82f217f0$0900a8c0@SPIFF> Message-ID: <004301c03cf3$fc830ba0$0900a8c0@SPIFF> > Version 1.1.1 is a maintenance upgrade. The changes include proper > handling of TIFF files under Python 2.0, better plugin detection when > using PIL as a package, and some bug fixes. the usual image-sig specific followup: - this release only changes a couple of python files. if you already have 1.1, you only need to replace the contents of the PIL directory. - there will be another release (1.2), probably in early November. - there are no binary kits available right now. sorry. $ cd Imaging-1.1.1 $ more CHANGES ... *** Changes from release 1.0 to 1.1.1 *** + Additional fixes for Python 1.6/2.0, including TIFF "save" bug. + Changed "init" to properly load plugins when PIL is used as a package. + Fixed broken "show" method (on Unix) ... From clee@v1.wustl.edu Mon Oct 23 19:49:43 2000 From: clee@v1.wustl.edu (Christopher Lee) Date: Mon, 23 Oct 2000 13:49:43 -0500 Subject: [Image-SIG] importing plugins in PIL-1.1.1 Message-ID: <200010231849.NAA27013@gnwy100.wuh.wustl.edu> Hello again, I just compiled Imaging-1.1.1 and tried using PIL as a package again (without PIL being in sys.path). The Image.py does not import the ImagingPlugins in the PIL directory with the code as written. The problem appears to be that the __path__ variable is not working as expected. On my system (Linux, python 1.5.2), the __path__ variable is not defined when init() is being called, so the code reverts back to using sys.path which doesn't contain PIL. I can fix it with my previous method using the __file__ variable. Here's what I have now: try: directories = __path__[:] except NameError: directories = sys.path[:] (thisdir, thisfile) = os.path.split(__file__) if not thisdir in directories: directories.append(thisdir) # only check directories (including current, if present in the path) for path in filter(os.path.isdir, directories): I continue to be confused about the use of __path__. Perhaps someone has some enlightenment to offer? -chris p.s. Here's a diff -c between the two files *** /usr/local/src/Python/Extensions/Imaging-1.1.1/PIL/Image.py Mon Oct 23 05:47:25 2000 --- Image.py Mon Oct 23 13:46:07 2000 *************** *** 192,200 **** import os, sys try: ! directories = __path__ except NameError: ! directories = sys.path # only check directories (including current, if present in the path) for path in filter(os.path.isdir, directories): --- 192,204 ---- import os, sys try: ! directories = __path__[:] except NameError: ! directories = sys.path[:] ! ! (thisdir, thisfile) = os.path.split(__file__) ! if not thisdir in directories: ! directories.append(thisdir) # only check directories (including current, if present in the path) for path in filter(os.path.isdir, directories): From jeffrey.simpson@supplysolution.com Tue Oct 24 02:41:47 2000 From: jeffrey.simpson@supplysolution.com (Jeff Simpson) Date: Mon, 23 Oct 2000 18:41:47 -0700 Subject: [Image-SIG] PNG vs. GIF89a Message-ID: <39F4E8DB.800FEEC@supplysolution.com> I've been using PIL to generate some images in the PNG format. This has worked out well, except I'm having trouble with transparent backgrounds in browsers - namely IE 5.5. IE5.5 supposedly only supports transparent PNG images with 256 bits using palette mode. Does this make sense to anyone and if so do you have any experience using palette mode in PIL to create a a PNG image viewable in IE 5.5? Actually, any examples of using palette and achieving transparency in a PNG would be helpful. If I convert my images to GIF89a, using ImageMagick, I can render the image, but it is both time consuming and supports the whole LZW issue. BTW, the PNG support in Mozilla M17 is suberb and renders the images nicely :) Thanks From vmanera@manord.com Tue Oct 24 14:20:39 2000 From: vmanera@manord.com (Manera, Villiam) Date: Tue, 24 Oct 2000 15:20:39 +0200 Subject: [Image-SIG] Help about PIL Message-ID: <801EB84B006ED411898D00B0D03E524712C6CC@PROXYMAIL> Hello, I'm a new python programmer from Italy, I'm trying to install PIL product but I need some help. I have put the pil folder, the PIL.pth file and _imaging.dll,tkinter.pyd in the same directory of python 1.5.2 but: PythonWin 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam Portions Copyright 1994-1999 Mark Hammond (MHammond@skippinet.com.au) >>> import Image >>> import _imaging Traceback (innermost last): File "", line 1, in ? ImportError: DLL load failed: Impossibile trovare il modulo specificato. >>> I tried to put imaging.dll,tkinter.pyd under DLLs folder, I added the path of the dll in the path variable without changing the error message. What I have to do? regards Villiam Manera Manifatture del nord Reggio Emilia Italy From aa8vb@yahoo.com Tue Oct 24 16:25:44 2000 From: aa8vb@yahoo.com (Randall Hopper) Date: Tue, 24 Oct 2000 11:25:44 -0400 Subject: [Image-SIG] Re: show() and save() glitches (PIL 1.1, Py 2.0b2) In-Reply-To: <20001011185657.A1694680@vislab.epa.gov>; from aa8vb@yahoo.com on Wed, Oct 11, 2000 at 06:56:57PM -0400 References: <20001011185657.A1694680@vislab.epa.gov> Message-ID: <20001024112544.A16346@vislab.epa.gov> Randall Hopper: | Trying out PIL 1.1 on Python 2.0b2 here. I'm really impressed it can |read and thumbnail this image, and fast, without requiring massive VM. | | Hit a few stumbles though in doing something simple with the thumbnail |though. show() trips on an internal error, and so does save(). Note that |this is a "huge" 8-bit palettized image (mode P). It thumbnails fine. The |problem is then doing a show() or doing a save() to TIFF on the resulting |thumbnail. Just wanted to feed back that my show() and save() glitches with palettized TIFF images are gone with PIL 1.1.1. Thanks, Randall -- Randall Hopper aa8vb@yahoo.com From clee@users.sourceforge.net Tue Oct 24 18:53:33 2000 From: clee@users.sourceforge.net (Christopher Lee) Date: Tue, 24 Oct 2000 12:53:33 -0500 Subject: [Image-SIG] win32 binary available Message-ID: <200010241753.MAA02634@gnwy100.wuh.wustl.edu> Hello, I've made a win32 binary available of Imaging-1.1.1 at http://piddle.sourceforge.net/downloads/PIL-1.1.1-win32-bin-for-py152.zip It's compiled for python 1.5.2. It includes the minor patch to Image.py which I mentioned earlier that fixes a the import of ImagingPlugins when using PIL as a package. I know that it works with the win32 binary version of python 1.5.2 as it comes from python.org. Hope it's useful. -chris From trnka2@TCNJ.EDU Fri Oct 27 04:45:29 2000 From: trnka2@TCNJ.EDU (Keith Trnka) Date: Thu, 26 Oct 2000 23:45:29 -0400 Subject: [Image-SIG] PIL Message-ID: <002301c03fc8$5ccb2480$90965b9f@tcnj.edu> Is there a descriptive site on how I can install Python Imaging Library on Win98? I tried using the precompiled binaries, and I tried extracting the files to many different places, but it never really worked. The most I could get was access to them, but Image.show() wouldn't work. I believe it said that I don't have something the __imaging.dll needs. Any help please? keith trnka From Aureli.Soria_Frisch@ipk.fhg.de Fri Oct 27 11:47:54 2000 From: Aureli.Soria_Frisch@ipk.fhg.de (Aureli Soria Frisch) Date: Fri, 27 Oct 2000 12:47:54 +0200 Subject: [Image-SIG] PIL In-Reply-To: <002301c03fc8$5ccb2480$90965b9f@tcnj.edu> Message-ID: At 23:45 Uhr -0400 26.10.2000, Keith Trnka wrote: >Is there a descriptive site on how I can install Python Imaging Library on >Win98? I tried using the precompiled binaries, and I tried extracting the >files to many different places, but it never really worked. The most I could >get was access to them, but Image.show() wouldn't work. I believe it said >that I don't have something the __imaging.dll needs. Any help please? > I am having the same problem and did not found any information.... ################################# Aureli Soria Frisch Fraunhofer IPK Dept. Pattern Recognition post: Pascalstr. 8-9, 10587 Berlin, Germany e-mail:aureli@ipk.fhg.de fon: +49 30 39 00 61 50 fax: +49 30 39 17 517 ################################# From michaelbaker@operamail.com Fri Oct 27 20:52:21 2000 From: michaelbaker@operamail.com (michaelbaker@operamail.com) Date: Fri, 27 Oct 2000 12:52:21 -0700 Subject: [Image-SIG] PIL In-Reply-To: <002301c03fc8$5ccb2480$90965b9f@tcnj.edu> Message-ID: <4.3.2.7.1.20001027124920.00b73250@operamail.com> At 11:45 PM 10/26/00 -0400, Keith Trnka wrote: >Is there a descriptive site on how I can install Python Imaging Library on >Win98? I tried using the precompiled binaries, and I tried extracting the >files to many different places, but it never really worked. The most I could >get was access to them, but Image.show() wouldn't work. I believe it said >that I don't have something the __imaging.dll needs. Any help please? > >keith trnka > >I have a win95 machine running python. I moved the imaging.dll to the same >directory as the python executable and everything worked. Image.show() >will invoke whatever app is associated with that file type - I've >forgotten just how to check file type associations in windows - chech win help. mb >_______________________________________________ >Image-SIG maillist - Image-SIG@python.org >http://www.python.org/mailman/listinfo/image-sig From parz@home.com Sat Oct 28 07:39:49 2000 From: parz@home.com (Parzival Herzog) Date: Sat, 28 Oct 2000 01:39:49 -0500 Subject: [Image-SIG] Compiling PIL imaglibe 1.1.1 on Windows NT, using VC++ 6.0 Message-ID: <01e601c040a9$df06a820$73666c18@burows1.mb.wave.home.com> Hello, I have been trying to compile the Python Imaging Library 1.1.1 on = Windows Nt 4.0 using VC++ 6.0. I have encountered two problems: 1) The library includes standard headers, which under VC++, eventually = pull in . This file defines basic datatypes used by MS. Among them, = is "UINT32". This typedef conflicts with the macro "UINT32" defined in = implatform.h. I "solved" this conflict by changing all the macro definitions in = "implatform.h" to be (nearly) equivalent typedefs, and in a few places in the imaging = library code where there were usages that assumed macros such as "unsigned INT32", I = changed these to the the type now defined in "implatform.h", say = "UINT32". The library then compiled without syintax errors. 2) The library would not link because the symbols declared in imaging.h: /* Exceptions */ /* ---------- */ extern void* ImagingError_IOError(void); extern void* ImagingError_MemoryError(void); extern void* ImagingError_ModeError(void); /* maps to ValueError by = default */ extern void* ImagingError_Mismatch(void); /* maps to ValueError by = default */ extern void* ImagingError_ValueError(const char* message); are not defined. As far as I can tell these are functions not = exceptions. There is no code defining these symbols in the distribution. I also have not = found any documentation about these symbols. I don't know about UNIX, but as = far as I know, a Windows dll can't be built with undefined symbols.=20 So I imagine that this version of the library has not been compiled on = Win NT, Also, I imagine that the interface to the library must have changed to = require some external definition of the symbols, but there is no documentation. So either I am ignorant of some essential fact, or perhaps there are a = couple of problems in this version of the source code. Can anyone shed more light on the cause and/or solution to this problem? = I don't subscribe to the mailing list image-sig@python.org, (please tell me how = to subscribe), so please email me any response that you have. Thanks, Parzival =20 From fredrik@pythonware.com Sat Oct 28 10:19:17 2000 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sat, 28 Oct 2000 11:19:17 +0200 Subject: [Image-SIG] Compiling PIL imaglibe 1.1.1 on Windows NT, using VC++ 6.0 References: <01e601c040a9$df06a820$73666c18@burows1.mb.wave.home.com> Message-ID: <004a01c040c0$76a0c4c0$0900a8c0@SPIFF> Parzival Herzog wrote: > 1) The library includes standard headers, which under VC++, eventually pull in > . This file defines basic datatypes used by MS. Among them, is > "UINT32". This typedef conflicts with the macro "UINT32" defined in implatform.h. this is a VC6-specific problem (I'm mostly using VC5), and I plan to sort it out in the next major release. (can anyone verify that the standard typedefs are 100% correct? an ifdef around the PIL definitions is probably the best solution -- changing the names would break third-party code, and I'd rather not bump the version number to 2.0 just for this) > 2) The library would not link because the symbols declared in imaging.h: /.../ > are not defined. As far as I can tell these are functions not exceptions. There > is no code defining these symbols in the distribution. I also have not found > any documentation about these symbols. maybe you've misinterpreted the error message: these functions are defined in several places (stub versions in the core library, and Python-aware versions in the glue layer). for example: $ grep ImagingError_IOError *.c libImaging/*.c _imaging.c:ImagingError_IOError(void) libImaging/Except.c:ImagingError_IOError(void) while Unix linkers are smart enough to pick the right version, Windows will complain if you define the same function twice in the same project. that's why the README file says: Building your own copy under Visual Studio should be straightforward; create a new project based on the sample extensions provided with Python (the target should be "_imaging.dll"), add all C files except "Except.c" and "coretest.c" to that project, check the contents of the "ImConfig.h" file (modify it if necessary), and build the DLL. in other words, remove Except.c, and everything should work. > So I imagine that this version of the library has not been compiled on Win NT, well, it's actually developed under Windows (originally on Win95, currently on Win2K). but not under Visual Studio, and not under the same version of VC as you're using. > Can anyone shed more light on the cause and/or solution to this problem? I don't > subscribe to the mailing list image-sig@python.org, (please tell me how to subscribe), http://www.python.org/mailman/listinfo/image-sig/ hope this helps! cheers /F From parz@home.com Sat Oct 28 21:39:07 2000 From: parz@home.com (Parzival Herzog) Date: Sat, 28 Oct 2000 15:39:07 -0500 Subject: [Image-SIG] Compiling PIL imaglibe 1.1.1 on Windows NT, using VC++ 6.0 References: <01e601c040a9$df06a820$73666c18@burows1.mb.wave.home.com> <004a01c040c0$76a0c4c0$0900a8c0@SPIFF> Message-ID: <026301c0411f$1e61c750$73666c18@burows1.mb.wave.home.com> Thanks for the (very prompt) help! I stupidly didn't realise that "all C files" included files ABOVE the = libImaging directory, and I also didn't search those files for the = missing symbols! The failure of the types to work helped me to jump to = the conclusion that the code had never been compiled on Windows. Sorry. Anyways, after doing that, and messing with the search paths and library = locations for a couple of iterations, it all compiled and linked. ----- Original Message -----=20 From: Fredrik Lundh To: Cc: Parzival Herzog Sent: Saturday, October 28, 2000 4:19 Subject: Re: [Image-SIG] Compiling PIL imaglibe 1.1.1 on Windows NT, = using VC++ 6.0 [snip] > maybe you've misinterpreted the error message: these functions > are defined in several places (stub versions in the core library, and > Python-aware versions in the glue layer). for example: >=20 > $ grep ImagingError_IOError *.c libImaging/*.c > _imaging.c:ImagingError_IOError(void) > libImaging/Except.c:ImagingError_IOError(void) >=20 >=20 > Building your own copy under Visual Studio should be = straightforward; > create a new project based on the sample extensions provided with > Python (the target should be "_imaging.dll"), add all C files = except > "Except.c" and "coretest.c" to that project, check the contents of = the > "ImConfig.h" file (modify it if necessary), and build the DLL. >=20 > in other words, remove Except.c, and everything should work.