From cgw@pgt.com Sun Nov 1 06:47:26 1998 From: cgw@pgt.com (Charles G Waldman) Date: Sun, 1 Nov 1998 01:47:26 -0500 (EST) Subject: [Image-SIG] Patch for libImaging/Offset.c Message-ID: <13884.1022.503808.889592@sirius> I found that using the Image.offset method frequently gave me corrupted images and core-dumps. I tracked the problem down to this code: int yi = (y - yoffset) % im->ysize; int xi = (x - xoffset) % im->xsize; imOut->image[y][x] = im->image[yi][xi]; The problem is that when (x - xoffset) < 0 then xi is also < 0, since negative%positive is still negative. (ditto for y,yi) The patch below fixes this problem; it replaces the subtraction with an addition, making sure that the offsets used are positive. Since the checks are done outside the loops there is no penalty. Because everything is being done using modular arithmetic, xoffset is equivalent to xoffset + im->xsize. --- Imaging-0.3b2/libImaging/Offset.c 1998/11/01 05:55:58 1.1 +++ Imaging-0.3b2/libImaging/Offset.c 1998/11/01 06:35:20 @@ -6,6 +6,7 @@ * * history: * 96-07-22 fl: Created + * 98-11-01 cgw@pgt.com: Fixed negative-array index bug * * Copyright (c) Fredrik Lundh 1996. * Copyright (c) Secret Labs AB 1997. @@ -32,11 +33,24 @@ ImagingCopyInfo(imOut, im); + /* Set up offsets so they are added rather than subtracted, avoiding + * negative offsets, which can lead to negative values of xi, yi below + */ + xoffset %= im->xsize; + xoffset = im->xsize - xoffset; + if (xoffset<0) + xoffset += im->xsize; + + yoffset %= im->ysize; + yoffset = im->ysize - yoffset; + if (yoffset<0) + yoffset += im->ysize; + #define OFFSET(image)\ for (y = 0; y < im->ysize; y++)\ for (x = 0; x < im->xsize; x++) {\ - int yi = (y - yoffset) % im->ysize;\ - int xi = (x - xoffset) % im->xsize;\ + int yi = (y + yoffset) % im->ysize;\ + int xi = (x + xoffset) % im->xsize;\ imOut->image[y][x] = im->image[yi][xi];\ } From giscanada@hotmail.com Sun Nov 8 22:49:45 1998 From: giscanada@hotmail.com (GIScanada) Date: 8 Nov 1998 22:49:45 -0000 Subject: [Image-SIG] (no subject) Message-ID: <19981108224945.31420.qmail@findmail.com> A new mailing list has been formed especially desinged for GIS in Canada to join: Send a blank email to : gis_canada-subscribe@egroups.com Thank you, Homepage : http://www.egroups.com/list/gis_canada ----- Free e-mail group hosting at http://www.eGroups.com/ From nbs@sonic.net Thu Nov 12 19:50:33 1998 From: nbs@sonic.net (William Kendrick) Date: Thu, 12 Nov 1998 11:50:33 -0800 (PST) Subject: [Image-SIG] Is there anything else for Unix that can read WMF fiels? Message-ID: <199811121950.LAA07697@bolt.sonic.net> Hi - my name's Bill Kendrick, and I'm looking for something that can open and convert Windows Meta Files (WMF's) to something more standard (GIF, PPM, etc.). There's of course zillions of Windows95/NT programs which do this. The only thing that's come even CLOSE for Unix/Linux is "PIL." Unfortunately, not only am I not positive that PIL would do what I need, I don't really want to install the entire Python package (which I'm totally UNfamiliar with as it is!) on my little PC, just to read clipart off of a Windows95 CD! :) So, since I see that opening WMF files has been done in Python, I wonder if you happen to know if there's anything else out there that does it? (Say, "wmftoppm" or something? :) ) Or, convince me that Python isn't really all that scarey, and in fact worth it. Thanks a lot! -bill! nbs@sonic.net http://www.newbreedsoftware.com/ From nbs@sonic.net Thu Nov 12 20:41:32 1998 From: nbs@sonic.net (William Kendrick) Date: Thu, 12 Nov 1998 12:41:32 -0800 (PST) Subject: [Image-SIG] Duh.. Python was already installed Message-ID: <199811122041.MAA10277@bolt.sonic.net> I had a feeling, but "apropos python" came up empty. (Lame on RedHat's part, I think). Anyway, I compiled PIL and get fun errors! % python viewer.py ENCLOSE.WMF Traceback (innermost last): File "viewer.py", line 42, in ? im = Image.open(filename) File "/home/kendrick/Imaging-0.3b2/PIL/Image.py", line 812, in open init() File "/home/kendrick/Imaging-0.3b2/PIL/Image.py", line 166, in init for file in os.listdir(path): os.error: (13, 'Permission denied') FYI, I set "PYTHONPATH" to: .:/home/kendrick/Imaging-0.3b2/:/home/kendrick/Imaging-0.3b2/PIL Any ideas!? Thanks! -bill! From cgw@pgt.com Fri Nov 13 01:59:21 1998 From: cgw@pgt.com (Charles G Waldman) Date: Thu, 12 Nov 1998 20:59:21 -0500 (EST) Subject: [Image-SIG] Duh.. Python was already installed Message-ID: <199811130159.UAA19056@pgt.com> William Kendrick writes: > File "/home/kendrick/Imaging-0.3b2/PIL/Image.py", line 166, in init > for file in os.listdir(path): > os.error: (13, 'Permission denied') > > FYI, I set "PYTHONPATH" to: > > .:/home/kendrick/Imaging-0.3b2/:/home/kendrick/Imaging-0.3b2/PIL Sounds like a pretty straightforward permissions problem. What does "ls -ld /home/kendrick/Imaging-0.3b2/PIL" tell you? BTW, the preferred way to install PIL is to stick all the library files in ls /usr/local/lib/python1.5/site-packages/PIL (you have to create this directory) and then create a file /usr/local/lib/python1.5/site-packages/PIL.pth which contains the single line "PIL". See the installation instructions in the file "README" in the Imaging-0.3b2 distribution. --UAA00406.910918888/luna.localnet-- From cgw@pgt.com Fri Nov 13 06:22:23 1998 From: cgw@pgt.com (Charles G Waldman) Date: Fri, 13 Nov 1998 01:22:23 -0500 (EST) Subject: [Image-SIG] Duh.. Python was already installed In-Reply-To: <199811130517.VAA10636@bolt.sonic.net> References: <199811130159.UAA19056@pgt.com> <199811130517.VAA10636@bolt.sonic.net> Message-ID: <13899.53279.94748.912290@luna.localnet> William Kendrick writes: > Sorry to be such a newbie/baby at all this. :) I went form Atari 8-bit > to Mac System 7 to Windows 95 to Linux, so from semi-hard to insanely easy and > now back to hard. :) I wouldn't say that the difficulties you are having are so much due to the fact that Linux is hard, but rather that you are playing with a piece of software (PIL) which is still a beta-release and has some bugs in it. Uncovering these bugs is part of the beta-testing process. > 5/home/kendrick/Imaging-0.3b2/Scripts>python viewer.py ENCLOSE.WMF > im.load(1) > TypeError: too many arguments; expected 1, got 2 > Exception exceptions.AttributeError: '_PhotoImage__photo' in ignored I am able to reproduce this, so I'd say this is apparently a bug in the Wmf plugin. I hadn't noticed this before since I never use WMF files. Thanks for reporting this bug. I will try to take a look into this. > And how about this? > > 6/home/kendrick/Imaging-0.3b2/Scripts>python viewer.py checks.gif > TclError: invalid command name "PyImagingPhoto" This is a configuration/setup problem. In order to have support for PIL images in Tk, Python's "tkappinit.c" needs to be compiled with "WITH_PIL" #defined (i.e. you have to recompile Python. Yes, this is somewhat of a pain). See "Modules/Setup" in the Python distribution, and also the section on "Adding Tkinter support" in the README file in the PIL distribution. Hopefully this will be simplified in a future release of PIL. ------- end ------- From r.hooft@euromail.net Thu Nov 26 12:18:43 1998 From: r.hooft@euromail.net (Rob Hooft) Date: Thu, 26 Nov 1998 13:18:43 +0100 (MET) Subject: [Image-SIG] Canvas with PhotoImage Message-ID: <13917.18211.857478.580479@octopus.chem.uu.nl> I am trying to make an MPEG movie consisting of subsequent frames of the Tkinter.Canvas containing a PIL image. I dreamt up a scheme that lets the canvas write itself repeatedly as a PostScript file, and then use "mpeg_encode" using ImageMagick (convert and ghostscript) to convert the "eps" files via "ppm" to "mpg". Much to my surprise, it seems that the PIL image that is shown on the screen is not represented in the "postscript" output of the Tkinter.Canvas. Does anyone have a solution for this? I know I can convert a PIL image to PostScript, but I don't know how much work it would be to integrate that with the Canvas-produced code to produce a composite PostScript image. Regards, Rob Hooft -- ===== R.Hooft@EuroMail.net http://www.xs4all.nl/~hooft/rob/ ===== ===== R&D, Nonius BV, Delft http://www.nonius.nl/ ===== ===== PGPid 0xFA19277D ========================== Use Linux! ========= From fredrik@pythonware.com Thu Nov 26 12:46:56 1998 From: fredrik@pythonware.com (Fredrik Lundh) Date: Thu, 26 Nov 1998 13:46:56 +0100 Subject: [Image-SIG] Canvas with PhotoImage Message-ID: <007501be193f$4bd70790$f29b12c2@pythonware.com> >Much to my surprise, it seems that the PIL image that is shown >on the screen is not represented in the "postscript" output of >the Tkinter.Canvas. Does anyone have a solution for this? I know I >can convert a PIL image to PostScript, but I don't know how much work >it would be to integrate that with the Canvas-produced code to produce a >composite PostScript image. Tk's postscript driver boldly ignores image objects displayed on the canvas... IIRC, the "dash" patches to Tk addresses this problem. You can probably find them via the resource section on www.scriptics.com. If you don't want to require a patched version of Tk, you may be able to use PIL's PSDraw module to draw the entire thing directly as postscript. Cheers /F fredrik@pythonware.com http://www.pythonware.com From r.hooft@euromail.net Thu Nov 26 15:14:24 1998 From: r.hooft@euromail.net (Rob Hooft) Date: Thu, 26 Nov 1998 16:14:24 +0100 (MET) Subject: [Image-SIG] Canvas with PhotoImage In-Reply-To: <007501be193f$4bd70790$f29b12c2@pythonware.com> References: <007501be193f$4bd70790$f29b12c2@pythonware.com> Message-ID: <13917.28752.254680.8173@octopus.chem.uu.nl> >>>>> "FL" == Fredrik Lundh writes: FL> IIRC, the "dash" patches to Tk addresses this problem. You can FL> probably find them via the resource section on www.scriptics.com. You did recall correctly, and it does exactly what I want. Converting each 1.5M image to ppm afterwards is a bit slow, so I might go to another solution in due time, but for now it is good enough. Thanks for your quick response. Rob -- ===== R.Hooft@EuroMail.net http://www.xs4all.nl/~hooft/rob/ ===== ===== R&D, Nonius BV, Delft http://www.nonius.nl/ ===== ===== PGPid 0xFA19277D ========================== Use Linux! ========= From fredrik@pythonware.com Fri Nov 27 11:08:46 1998 From: fredrik@pythonware.com (Fredrik Lundh) Date: Fri, 27 Nov 1998 12:08:46 +0100 Subject: [Image-SIG] Canvas with PhotoImage Message-ID: <022e01be19f6$4e848730$f29b12c2@pythonware.com> Rob Hooft wrote: > FL> IIRC, the "dash" patches to Tk addresses this problem. You can > FL> probably find them via the resource section on www.scriptics.com. > >You did recall correctly, and it does exactly what I want. Converting >each 1.5M image to ppm afterwards is a bit slow, so I might go to >another solution in due time, but for now it is good enough. FYI: ----- Original Message ----- From: Jan Nijtmans Newsgroups: comp.lang.tcl Sent: den 27 november 1998 08:02 Subject: Re: Tk and gif >Paul Batten wrote: >> I know that Tk has an option to generate postscript output from a canvas >> widget. Does anybody know if its gif-handling capabilities extend to >> generating gif-ouput files of a canvas ?? > >This is possible with Img1.2a1 as a two-step process: First turn >the canvas into a photo, and then write it as GIF image: > > package require Img 1.2 > update ;# we must be sure that the canvas is complete redrawn > # .c is the canvas we want to convert to a gif > set img [image create photo -format window -data .c] > $img write canvas.gif -format gif > >Currently this only works on UNIX, but Img1.2a2 (to be released >in december) will support it for Windows as well. > >Hope this helps, >-- >Jan Nijtmans, CMG Arnhem B.V. >email: Jan.Nijtmans@wxs.nl (private) > Jan.Nijtmans@cmg.nl (work) >url: http://home.wxs.nl/~nijtmans/ From sk@nvg.ntnu.no Mon Nov 30 12:17:00 1998 From: sk@nvg.ntnu.no (Steinar Knutsen) Date: Mon, 30 Nov 1998 13:17:00 +0100 (CET) Subject: [Image-SIG] PIL Message-ID: On Wed, 30 Sep 1998, Robert wrote: > Could you please help me with PIL > > when ever i try to see the image using > > eg: > > a.show() > > it returns a message to the console: > > Bad command or file name PIL on un*x tries to spawn xv when the show method is invoked. Do you have this available on your system? Steinar