From zack@lems.brown.edu Wed Jul 3 18:27:07 1996 From: zack@lems.brown.edu (Zack Roadhouse) Date: Wed, 3 Jul 1996 13:27:07 -0400 Subject: [PYTHON IMAGE-SIG] Where should tkImaging.c be? Message-ID: <199607031727.NAA10196@lems61.lems.brown.edu> I get this error when I try to run python. ImportError: ld.so.1: /vision/packages/arch/SunOS5.5/bin/python: fatal: relocation error: symbol not found: ImagingTkInstall: referenced in /vision/packages/Python/1.3/lib/python/sunos5/tkintermodule.so Where should I compile and link tkImaging.c? --Zack /--------------------------------------------------------------------- Zachary F. Roadhouse Home: (401)421-0751 Box 220, Brown University, Providence, RI 02912 Work: (401)863-2760 E-MAIL: Zachary_Roadhouse@brown.edu WWW: http://www.netspace.org/~zack ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From dcb@lems.brown.edu Wed Jul 3 21:39:38 1996 From: dcb@lems.brown.edu (Dale C. Bertrand) Date: Wed, 3 Jul 1996 16:39:38 -0400 Subject: [PYTHON IMAGE-SIG] Making an Image fromstring() Message-ID: <199607032039.QAA11935@lems61.lems.brown.edu> I'm trying to make a PIL Image from a string of data. I've used the show() method on the Image which successfully brings up and xv window displaying my string as an image. The problem is: when I convert that image to a PhotoImage and try to use it on a label (an operation that has worked for me in the past) it gives me an "image doesn't exist error." Does anyone know how I can get this to work? The code and error message are listed below. Thanks, Dale Bertrand dcb@lems.brown.edu --- CODE --- i = new("L",(128,128)) # The demensions are (128,128) # and the image is greyscale string_data = _ImageMagick.MIFFToString(image) # The string is the right # length (128*128) i._fromstring( string_data ) i.show() # This pops up an xv representation of my image beautifully tkim = ImageTk.PhotoImage(i.mode,i.size) tkim.paste(i) root = Tk() label = Label(root,image=tkim) label.pack() root.mainloop() --- ERROR MESSAGE --- File "ImageMagick.py", line 61, in ? label = Label(root,image=tkim) File "/vision/packages/Python/1.3/lib/python/tkinter/Tkinter.py", line 1093, in __init__ Widget.__init__(self, master, 'label', cnf, kw) File "/vision/packages/Python/1.3/lib/python/tkinter/Tkinter.py", line 786, in __init__ Widget.config(self, cnf) File "/vision/packages/Python/1.3/lib/python/tkinter/Tkinter.py", line 807, in config apply(self.tk.call, (self._w, 'configure') TclError: image "" doesn't exist >>> ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Thu Jul 4 11:59:12 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Thu, 4 Jul 1996 12:59:12 +0200 Subject: [PYTHON IMAGE-SIG] Making an Image fromstring() In-Reply-To: <199607032039.QAA11935@lems61.lems.brown.edu> (dcb@lems.brown.edu) Message-ID: <9607041059.AA16254@arnold.image.ivab.se> > [tk] gives me an "image doesn't exist error." You must pass the image attribute of the ImageTk object to Label, not the object itself: tkim = ImageTk.PhotoImage(i.mode,i.size) tkim.paste(i) root = Tk() label = Label(root,image=tkim.image) ^^^^^^ added Looking in my sample stuff, I found that I used a "tkim = tkim.image" statement just after the paste. You might have dropped that line by mistake. Regards /F ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Thu Jul 4 12:02:28 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Thu, 4 Jul 1996 13:02:28 +0200 Subject: [PYTHON IMAGE-SIG] Where should tkImaging.c be? In-Reply-To: <199607031727.NAA10196@lems61.lems.brown.edu> (zack@lems.brown.edu) Message-ID: <9607041102.AA19267@arnold.image.ivab.se> > ImportError: ld.so.1: /vision/packages/arch/SunOS5.5/bin/python: > fatal: relocation error: symbol not found: ImagingTkInstall: > referenced in /vision/packages/Python/1.3/lib/python/sunos5/tkintermodule.so > Where should I compile and link tkImaging.c? Add it to the Setup file you use to build the tkinter library proper; I use something like: tkinter tkintermodule.c tkappinit.c tkImaging.c -DWITH_APPINIT -I/usr/local/include -L/usr/local/lib -ltk4.0 -ltcl7.4 -lX11 Regards /F ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From shprentz@bdm.com Wed Jul 10 23:43:17 1996 From: shprentz@bdm.com (Joel Shprentz) Date: Wed, 10 Jul 1996 18:43:17 -0400 Subject: [PYTHON IMAGE-SIG] Selective reads with PIL Message-ID: <2.2.32.19960710224317.006b8770@bdmserver.mcl.bdm.com> At 05:17 PM 5/23/96 +0200, Fredrik Lundh (Fredrik_Lundh@ivab.se) wrote: >*** Changes from release 0.1b1 *** > >+ Added support for yet another file format: PhotoCD (PCD) images. The > base resolution (768x512) can be read from a PhotoCD file. I've been experimenting with the PIL 0.1 release. Now I'm looking ahead to an application that uses PhotoCD images. I would like to be able to read any of the five resolutions from a PhotoCD file. The change announcement states only that the base resolution will be readable. Similar problems arise with other multi-resolution formats and with formats that encode multiple images in one file. Given PIL's excellent architecture, where is the appropriate place to specify which resolution or image should be read? -- Joel Shprentz (202) 863-3487 BDM Federal, Inc. shprentz@bdm.com 1501 BDM Way McLean, VA 22102 ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Thu Jul 11 20:16:26 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Thu, 11 Jul 1996 21:16:26 +0200 Subject: [PYTHON IMAGE-SIG] Selective reads with PIL In-Reply-To: <2.2.32.19960710224317.006b8770@bdmserver.mcl.bdm.com> (message from Joel Shprentz on Wed, 10 Jul 1996 18:43:17 -0400) Message-ID: <9607111916.AA08485@arnold.image.ivab.se> > Now I'm looking ahead to an application that uses PhotoCD images. I would > like to be able to read any of the five resolutions from a PhotoCD file. Unfortunately, Kodak considers the PhotoCD compression method and file format proper to be strictly proprietary stuff. I've already stretched it a little in PIL by supporting the uncompressed base resolution... One solution might be to create a custom plugin using hpcdtoppm the ImageMagick convert utility. (A few weeks ago, Zack Roadhouse (zack@lems.brown.edu) reported that he was working on a tighter interface to ImageMagick. Any news on this front?) > Similar problems arise with other multi-resolution formats and with > formats that encode multiple images in one file. To handle multiple resolutions, the next release (0.2, early August) includes "draft" and "thumbnail" methods that can be used to speed up decoding where possible. This currently includes JPEG (1/2, 1/4, 1/8) and PCD (192x128 and 256x384). To handle multiple images, seek() and tell() methods will be implemented (e.g. TIFF, animated GIF). Regards /F ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From dcb@lems.brown.edu Thu Jul 11 20:48:05 1996 From: dcb@lems.brown.edu (Dale C. Bertrand) Date: Thu, 11 Jul 1996 15:48:05 -0400 Subject: [PYTHON IMAGE-SIG] Selective reads with PIL In-Reply-To: <9607111916.AA08485@arnold.image.ivab.se> References: <2.2.32.19960710224317.006b8770@bdmserver.mcl.bdm.com> <9607111916.AA08485@arnold.image.ivab.se> Message-ID: <199607111948.PAA00171@lems61.lems.brown.edu> Fredrik Lundh writes: > > > Now I'm looking ahead to an application that uses PhotoCD images. I would > > like to be able to read any of the five resolutions from a PhotoCD file. > > Unfortunately, Kodak considers the PhotoCD compression method and file > format proper to be strictly proprietary stuff. I've already > stretched it a little in PIL by supporting the uncompressed base > resolution... > > One solution might be to create a custom plugin using hpcdtoppm the > ImageMagick convert utility. (A few weeks ago, Zack Roadhouse > (zack@lems.brown.edu) reported that he was working on a tighter > interface to ImageMagick. Any news on this front?) Our group has been working for the past week on an ImageMagick Module for Python. The module can access ImageMagick's processing rutines and convert between the internal ImageMagick and PIL formats. It includes a class (MIFFImage) that is a PIL Image with ImageMagick functionality. Right now, the module is in the testing stage. We've plugged it into a project that we are working on and are currently working out the kinks. -Dale Bertrand dcb@lems.brown.edu ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From shprentz@bdm.com Fri Jul 12 02:29:44 1996 From: shprentz@bdm.com (Joel Shprentz) Date: Thu, 11 Jul 1996 21:29:44 -0400 Subject: [PYTHON IMAGE-SIG] Selective reads with PIL Message-ID: <2.2.32.19960712012944.006ba734@bdmserver.mcl.bdm.com> >> Similar problems arise with other multi-resolution formats and with >> formats that encode multiple images in one file. > >To handle multiple resolutions, the next release (0.2, early August) >includes "draft" and "thumbnail" methods that can be used to speed up >decoding where possible. This currently includes JPEG (1/2, 1/4, 1/8) >and PCD (192x128 and 256x384). > >To handle multiple images, seek() and tell() methods will be >implemented (e.g. TIFF, animated GIF). I recommend that the draft() and thumbnail() methods be augmented with a method the reports the resolutions available and another method that selects one of these resolutions. This would parallel your tell() and seek() methods for handling multiple images. -- Joel Shprentz (202) 863-3487 BDM Federal, Inc. shprentz@bdm.com 1501 BDM Way McLean, VA 22102 ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From phil@geog.ubc.ca Mon Jul 15 00:05:53 1996 From: phil@geog.ubc.ca (Phil Austin) Date: Sun, 14 Jul 1996 16:05:53 -0700 (PDT) Subject: [PYTHON IMAGE-SIG] georeferencing and satellite image processing Message-ID: <199607142305.QAA06166@coot.geog.ubc.ca> I've hired an engineering co-op student to investigate Python and Khoros as possible platforms for a (relatively) simple satellite image processing system. Currently Khoros has toolboxes available to do 1) map transformations and 2) vector-raster overlays of contour diagrams and coastlines, and I'm wondering how big a job it would be to add this capability to the Python image library? We have the coastline database and the C subroutines to do the coordinate transformations--we would be interested in developing a simple interface that zoomed/panned on rubber-banded regions, manipulated color maps, applied fourier and wavelet filters, etc. Thanks for any information, Phil Austin INTERNET: phil@geog.ubc.ca (604) 822-2175 FAX: (604) 822-6150 http://www.geog.ubc.ca/~phil Associate Professor Atmospheric Sciences Programme Geography #217 University of British Columbia 1984 W Mall Vancouver, BC V6T 1Z2 CANADA ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Mon Jul 15 11:17:53 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Mon, 15 Jul 1996 12:17:53 +0200 Subject: [PYTHON IMAGE-SIG] georeferencing and satellite image processing In-Reply-To: <199607142305.QAA06166@coot.geog.ubc.ca> (message from Phil Austin on Sun, 14 Jul 1996 16:05:53 -0700 (PDT)) Message-ID: <9607151017.AA13266@arnold.image.ivab.se> > I've hired an engineering co-op student to investigate Python and > Khoros as possible platforms for a (relatively) simple satellite > image processing system. Cool! > I'm wondering how big a job it would be to add [these Khoros > capabilities] to the Python image library? > > 1) map transformations The easiest way is probably to create a variant of the transform method (it currently deals with affine transforms only). A brute-force (and thus very PILish) solution would be to provide a transformation callback which is simply called for every pixel in the output image. As it turns out, this is also quite efficient on modern platforms, given that the transform is not too heavy. Expect this to be stuffed into the 0.2 release. Note the current restrictions of PIL though: 8-bit layers and nearest neighbour resampling only. (BTW, if you need to get around this right now, there happens to be commercial alternatives to PIL. Contact me off this list for more information). > > 2) vector-raster overlays of contour diagrams and coastlines To draw vector overlays into an image, you can use the ImageDraw interface. Note that in the current release, the ImageDraw module will work with 8-bit (1, L, P) images only. To draw in RGB images, you have to use split/merge. This will probably be fixed for release 0.2, though. To draw raster overlays, you can use the paste method. For example, assuming the overlay contain 0 for transparency and 255 for features, you could do something like: ink = Image.new("L", image.size, colour) image.paste(ink, None, overlay) That is, create an image containing the colour you wish to use, and paste it into the image using the overlay as a transparency mask. Again, to draw in an RGB image, you have to use split/merge. And again, this will probably be improved in 0.2. > > fourier and wavelet filters For this kind of signal processing, the best way is probably to implement it using the Numerical Python module, and convert images to arrays as necessary. David Asher has a FFT module running; not sure if anyone have done anything with wavelets yet. Regards /F (daytime remote sensing hacker) ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From ve6ahm@ve6ahm-1.ampr.ab.ca Sun Jul 14 07:25:26 1996 From: ve6ahm@ve6ahm-1.ampr.ab.ca (Les Davies) Date: Sat, 13 Jul 1996 23:25:26 -0700 (MST) Subject: [PYTHON IMAGE-SIG] Re: img by Jack Jensen Message-ID: <199607140625.XAA07590@ve6ahm-1.ampr.ab.ca> I am attempting to install img as loadable modules. The problem I am having is that when I import imgcolormap I get the message that symbols pm_message and pm_perror cannot be found. I am using linux 1.2.13 with python 1.3. I know that the symbols are used in dither.c and genmap.c and defined in libpbm1.c in pbmplus. I have tried several things to get the symbols recognized. any ideas? ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From sac@lems.brown.edu Wed Jul 17 19:43:00 1996 From: sac@lems.brown.edu (Seth A. Coe) Date: Wed, 17 Jul 1996 14:43:00 -0400 Subject: [PYTHON IMAGE-SIG] postscript printing Message-ID: <199607171843.OAA18198@lems61.lems.brown.edu> I'm trying to dump the contents of a canvas widget to a postscript file for printing, but have run into a few problems. the canvas.postscript() function doesn't handle any images on the canvas, so it just outputs a file with lines etc. but no image. I also tried to use the PSDraw class to create a file, and have managed to make the image appear in the file, but the PSDraw.rectangle(), and PSDraw.line() functions do not seem to be working properly. If anyone has any advice or patches that will allow me to write a ps file with both images and lines, I would be grateful. Thanks in advance. Seth Coe ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Thu Jul 18 13:54:06 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Thu, 18 Jul 1996 14:54:06 +0200 Subject: [PYTHON IMAGE-SIG] postscript printing In-Reply-To: <199607171843.OAA18198@lems61.lems.brown.edu> (sac@lems.brown.edu) Message-ID: <9607181254.AA20097@arnold.image.ivab.se> > I also tried to use the PSDraw class to create a file, and have > managed to make the image appear in the file, but the > PSDraw.rectangle(), and PSDraw.line() functions do not seem to be > working properly. Have you applied the patches I posted earlier (and have attached to this mail)? Without them, the PostScript coordinate system gets seriously messed up as soon as you print an image. I'll take a look at the PSDraw module, and see if there are more problems lurking around. Stay tuned. /F -------------------------------------------------------------------- In Lib/PSDraw.py: dx = (xmax - x) / 2 + box[0] dy = (ymax - y) / 2 + box[1] + self.fp.write("matrix currentmatrix\n") self.fp.write("%f %f translate\n" % (dx, dy)) if (x, y) != im.size: # EpsImagePlugin._save prints the image at (0,0,xsize,ysize) sx = x / im.size[0] sy = y / im.size[1] self.fp.write("%f %f scale\n" % (sx, sy)) EpsImagePlugin._save(im, self.fp, None, 0) ! self.fp.write("\nsetmatrix\n") In libImaging/EpsEncode.c: if (++state->y >= state->ysize) { state->errcode = IMAGING_CODEC_END; ! return ptr - buf; } in = (UINT8*) im->image[state->y]; } ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From sac@lems.brown.edu Thu Jul 18 15:56:13 1996 From: sac@lems.brown.edu (Seth A. Coe) Date: Thu, 18 Jul 1996 10:56:13 -0400 Subject: [PYTHON IMAGE-SIG] Using Color Ink in the PSDraw class Message-ID: <199607181456.KAA06895@lems61.lems.brown.edu> Thanks for the last advice, I didn't have the patch and that fixed it. Now I'm wondering if there is anyway to write color or at least specify the grayscale that I am writing in. The docs have a setink() function, but my PSDraw.py doesn't have it (yet?). Anymore advice or patches that I'm missing? Thanks in advance, Seth Coe ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Thu Jul 18 19:32:20 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Thu, 18 Jul 1996 20:32:20 +0200 Subject: [PYTHON IMAGE-SIG] Using Color Ink in the PSDraw class In-Reply-To: <199607181456.KAA06895@lems61.lems.brown.edu> (sac@lems.brown.edu) Message-ID: <9607181832.AA22412@arnold.image.ivab.se> > The docs have a setink() function, but my PSDraw.py doesn't have it > (yet?). Anymore advice or patches that I'm missing? Add the following method to PSDraw (off the top of my head, so you may have to fix any typos yourself :-) def setink(self, ink): if type(ink) == type(0): # greyscale value (0..255) self.fp.write("%g setgray\n" % (ink / 255.0)) else: # truecolour 3-tuple self.fp.write("%g %g %g setrgbcolor\n" % (ink[0] / 255.0, ink[1] / 255.0, ink[2] / 255.0)) I'll add this (or something similar) in 0.2. Regards /F ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From ve6ahm@ampr.ab.ca Fri Jul 19 01:18:35 1996 From: ve6ahm@ampr.ab.ca (Les Davies) Date: Thu, 18 Jul 1996 17:18:35 -0700 (MST) Subject: [PYTHON IMAGE-SIG] Re: img by Jack Jensen (fwd) Message-ID: ---------- Forwarded message ---------- Date: Sat, 13 Jul 1996 23:25:26 -0700 (MST) From: Les Davies To: image-sig@python.org Subject: [PYTHON IMAGE-SIG] Re: img by Jack Jensen I am attempting to install img as loadable modules. The problem I am having is that when I import imgcolormap I get the message that symbols pm_message and pm_perror cannot be found. I am using linux 1.2.13 with python 1.3. I know that the symbols are used in dither.c and genmap.c and defined in libpbm1.c in pbmplus. I have tried several things to get the symbols recognized. any ideas? ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From sac@lems.brown.edu Fri Jul 19 16:08:39 1996 From: sac@lems.brown.edu (Seth A. Coe) Date: Fri, 19 Jul 1996 11:08:39 -0400 Subject: [PYTHON IMAGE-SIG] more on PSDraw Message-ID: <199607191508.LAA13415@lems61.lems.brown.edu> One other problem with the PSDraw class is that IT outputs an entire page-sized file. I would like to be able to just output a file with the area of interest. If anyone knows how I could handle this problem, I would appreciate the advice. -Seth Coe ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From sac@lems.brown.edu Tue Jul 23 20:57:25 1996 From: sac@lems.brown.edu (Seth A. Coe) Date: Tue, 23 Jul 1996 15:57:25 -0400 Subject: [PYTHON IMAGE-SIG] getPixel function? Message-ID: <199607231957.PAA06103@lems61.lems.brown.edu> I'm wondering if PIL has a method to simply return a pixel value given it's x,y coordinates (or even better a list of x,y coordinates)? I can't seem to find one, but it seems like a simple enough operation, so I thought that the code might already exist. Thanks, Seth Coe ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org ================= From fredrik_lundh@ivab.se Thu Jul 25 10:51:01 1996 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Thu, 25 Jul 1996 11:51:01 +0200 Subject: [PYTHON IMAGE-SIG] [PREANNOUNCEMENT] netCDF reader for the matrix and image extensions Message-ID: <9607250951.AA02801@arnold.image.ivab.se> Just a little teaser ;-) I've pulled together a netCDF reader that doesn't need any C library: data = NetCdfDataFile.open("dataset.cdf") # list variables print "variables:", data.keys() # global attributes print "global attributes:", data.attr.keys() # dump all variables in the file for i in data.keys(): var = data[i] print i, data.type, data.shape print "- data:", var[:] if var.attr: print "- local attributes:", var.attr.keys() It currently sports a slightly different interface compared to Bill Noon's, but they can probably be unified. And of course, to create or modify netCDF files, you need to use the real library. - The above module can be used with the Numerical extension to load data as multidimensional arrays for further processing. var = data["foo"] foo = Numeric.array(var) # 1-dimensional foo.reshape(var.shape) # make n-dimensional - It can also be used with the next version of PIL 0.2 in order to load image data from netCDF files (PIL still supports 8-bit data only, but you can use scale/offset to fit other data into the 0..255 range). # foo must be a 2-dimensional variable var = data["foo"] im = Image.new("L", var.shape) im.putdata(var, scale, offset) im.save("output.jpg") I plan to release this with PIL 0.2. Comments and flames are welcome. /F ================= IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org =================