From Kevin Cazabon" This is a multi-part message in MIME format. ------=_NextPart_000_0006_01BE6341.24E89940 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I can't seem to find the bdf2pil.py module mentioned in the = documentation for converting Xwindows fonts to PIL format. I'm running = on a PC (Win98/NT), and need to make a whole bunch of fonts available = for a program I'm writing. Is there a PC version of the bdf2pil.py available, or any other tools = for easily converting fonts? Type1 fonts would also be nice, as well as = TrueType or PostScript fonts as well... OR, is there a library of PIL formatted fonts already? Thanks, Kevin Cazabon kcaza@cymbolic.com kcazabon@rogers.wave.ca ------=_NextPart_000_0006_01BE6341.24E89940 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I can't seem to find the bdf2pil.py = module=20 mentioned in the documentation for converting Xwindows fonts to PIL=20 format.  I'm running on a PC (Win98/NT), and need to make a whole = bunch of=20 fonts available for a program I'm writing.
 
Is there a PC version of the = bdf2pil.py=20 available, or any other tools for easily converting fonts?  Type1 = fonts=20 would also be nice, as well as TrueType or PostScript fonts as=20 well...
 
OR, is there a library of PIL = formatted fonts=20 already?
 
Thanks,
 
Kevin Cazabon
kcaza@cymbolic.com
kcazabon@rogers.wave.ca
 
 
------=_NextPart_000_0006_01BE6341.24E89940-- From tsbarry@nortelnetworks.com Mon Mar 1 10:44:57 1999 From: tsbarry@nortelnetworks.com (Barry Scott) Date: Mon, 1 Mar 1999 10:44:57 -0000 Subject: [Image-SIG] ImageDraw / ImageFont ... font conversion Message-ID: <81C8165DD2A7D111AD700000F81F29CB02504A86@nwcwi19.europe.nortel.com> Kevin, You need to use the Scripts/pilfont.py module. bdf2pil.py should not have been in the kit. I was mislead by the docs as well. But I cannot find the reference anymore. Do you recall when bdf2pil is referenced? BArry From fredrik@pythonware.com Tue Mar 2 17:27:25 1999 From: fredrik@pythonware.com (Fredrik Lundh) Date: Tue, 2 Mar 1999 18:27:25 +0100 Subject: [Image-SIG] ImageDraw / ImageFont ... font conversion Message-ID: <015401be64d1$f2cd5d00$f29b12c2@pythonware.com> > I can't seem to find the bdf2pil.py module mentioned > in the documentation for converting Xwindows fonts > to PIL format. what documentation? I thought I'd nuked all references to bdf2pil... anyway, the answer is "use pilfont.py" > OR, is there a library of PIL formatted fonts already? I'm not sure about the legal status of the X windows fonts (if someone can sort that out for me, I'm per- fectly willing to put a standard package somewhere on our site). if anyone has pointers to freely redistributable fonts (or pilfont versions of them), please step forward! Cheers /F From fredrik@pythonware.com Tue Mar 2 17:23:59 1999 From: fredrik@pythonware.com (Fredrik Lundh) Date: Tue, 2 Mar 1999 18:23:59 +0100 Subject: [Image-SIG] When will the next PIL beta be released? Message-ID: <015301be64d1$f25323f0$f29b12c2@pythonware.com> > When will the next PIL beta be released? last weekend was the original plan, but 1) we found a few buglets during final testing, and 2) a temporary lack of inspiration. working on both issues right now. Cheers /F From fredrik@pythonware.com Tue Mar 2 17:32:49 1999 From: fredrik@pythonware.com (Fredrik Lundh) Date: Tue, 2 Mar 1999 18:32:49 +0100 Subject: [Image-SIG] Saving GIFs with added transparency Message-ID: <018f01be64d2$b5122e90$f29b12c2@pythonware.com> in a message that outlook express refused to display, Steve Purcell wrote: >I tried doing this by setting the 'transparency' entry of the image's >'info' dictionary. On saving, this information was ignored. Maybe this >was the wrong way to do it, but if it's not, I have a patch to offer for >'GifImagePlugin.py'. > >It involves the addition of the following lines before the 'return' of >the 'getheader' function: this is a classic patch by now; by some odd reason, I seem to have lost similar changes at least twice :-( anyway, something very similar to this patch will make it into 1.0 final. promise. Thanks /F From Anthony Baxter Wed Mar 3 07:30:02 1999 From: Anthony Baxter (Anthony Baxter) Date: Wed, 03 Mar 1999 18:30:02 +1100 Subject: [Image-SIG] ImageDraw / ImageFont ... font conversion In-Reply-To: Your message of "Tue, 02 Mar 1999 18:27:25 BST." <015401be64d1$f2cd5d00$f29b12c2@pythonware.com> Message-ID: <199903030730.SAA10027@mbuna.arbhome.com.au> > > I can't seem to find the bdf2pil.py module mentioned > > in the documentation for converting Xwindows fonts > > to PIL format. > > what documentation? I thought I'd nuked all > references to bdf2pil... given how often it keeps coming up, you should create a bdf2pil that just says "use pilfont.py" > I'm not sure about the legal status of the X windows > fonts (if someone can sort that out for me, I'm per- > fectly willing to put a standard package somewhere > on our site). > > if anyone has pointers to freely redistributable > fonts (or pilfont versions of them), please step > forward! There's stuff on www.gimp.org, under Resources -> Fonts. I can't get to it right now (mmm network) but from memory it had links to font packages, including a bunch of free truetype and postscript fonts... Anthony From barry@scottb.demon.co.uk Wed Mar 3 09:52:51 1999 From: barry@scottb.demon.co.uk (Barry Scott) Date: Wed, 3 Mar 1999 09:52:51 -0000 Subject: [Image-SIG] When will the next PIL beta be released? In-Reply-To: <015301be64d1$f25323f0$f29b12c2@pythonware.com> Message-ID: <000901be655b$9a52a790$060110ac@barrynt.private> /F Thanks for the update. I do not wish to pressure you. I'd rather have PIL done right then shipped fast. I'm Looking forward to helping test the beta. Barry From image_sig@opti.okdirect.com Wed Mar 3 11:43:43 1999 From: image_sig@opti.okdirect.com (Daniel Walton) Date: Wed, 03 Mar 1999 05:43:43 -0600 Subject: [Image-SIG] PIL 1.0b1 and GifImagePlugin.py In-Reply-To: <01e001be64d3$dead02b0$f29b12c2@pythonware.com> Message-ID: <4.1.19990303054211.00ab3cc0@grunt.okdirect.com> --=====================_31443158==_ Content-Type: text/plain; charset="us-ascii" Sure thing! I probably should have done that to start with since the URL wasn't mine. You should find it attached to this email. Daniel Walton At 06:41 PM 3/2/99 +0100, you wrote: >>Looks like it might have something to do with Gif >>global vs. local palettes but I could be wrong. > >sure looks that way. I'll investigate... > >>A GIF image is temporarily available at the following >>URL that exhibits the problem: >> >>http://members.aol.com/HP2000c/pbe/banner1.gif > >...but unfortunately, I seem to have missed it. >could you perhaps mail me a copy? > >Cheers /F > --=====================_31443158==_ Content-Type: image/gif; name="webmaster.gif"; x-mac-type="47494666"; x-mac-creator="4A565752" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="webmaster.gif" R0lGODlh1AE8AAAAAC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QAnaMjdGUJFFdASgsx4bSWQsSYDBR5K3pwT/7ZaERbCIQgCS LOlrGvdmIlABxtcBMvl87kiPPAmUN1kEehmUPQmP68iXqFh4TGBZt3gFJiVCbaVHe+hSzTWM7cUw 7+MJzYVDoGAUl1MEqBEhF9lDB0I+Qnh2QwB8++eId4l/1YgEtSYCIfeWuiZrAKaWx5d8fbmXgwmY frmTgJmTfFmPTEiGTrBOGZCYWfBVxold1QZpMNUQkblcwmhYCPGcTcVYmlATOsGZUPSZ6xFBoimW PnZicEZnRUCNIzmA+OaRR9B/c1Z2uxebJ/d1UxCBpxiF8QiU+qiOQ8mPsOiA+xiL6uh3FFiP9JmK /7hdTNAJ84SMmOAfzbGdFucX/9gAEZOimrq2f4eoiUWAcdtoBNS4Zu7piGtWewCmocfnn0uIhaBY jw3on7JYBFhYeCr6d32nfH/3injHfMr3gC+KoGcQLXtoCA76Iw7wTIcSlqiTStKkbv5XBBmqBOxZ lr/XahvAiHiWahVwni1JhLVphlsohrMYhYHnpUZAi6EIpqkonGLIgKHYo7N4oD4aBpZCnbPQDdUQ Dj5jAKKGpNQDHPp1C9gkBGvmYSIQAup5hBmXg0lgiQCGBPRHYy22liIHqcYnc3NZqUsgijkqnHHA d3H6qW1ASV6GUE4AYnbpBCHApY66cRuXBJSqBA9QY5iaBa7YjnYwlKCaq7pKVyEyiqu7+qvAGqzC OqzEWqzGeqzImqzKuqzM2qzO+qxPEAQAOw== --=====================_31443158==_-- From fredrik@pythonware.com Wed Mar 3 14:02:00 1999 From: fredrik@pythonware.com (Fredrik Lundh) Date: Wed, 3 Mar 1999 15:02:00 +0100 Subject: [Image-SIG] ImageDraw / ImageFont ... font conversion Message-ID: <00dd01be657e$6a1183d0$f29b12c2@pythonware.com> Me: >> if anyone has pointers to freely redistributable >> fonts (or pilfont versions of them), please step >> forward! Anthony: >There's stuff on www.gimp.org, under Resources -> Fonts. >I can't get to it right now (mmm network) but from memory >it had links to font packages, including a bunch of free >truetype and postscript fonts... it seems like all fonts provided with the X11 distribution has a Python-like copyright. this means that we should be able to provide a precompiled set of fonts along with a future version of PIL. to be on the safe side, the pilfont utility (and possibly the format) should be modified to keep the copyright string around. if anyone feels inspired, a contribution along these lines would be highly appreciated. or maybe someone could send me some round tuits? Cheers /F From da@ski.org Wed Mar 3 22:08:10 1999 From: da@ski.org (David Ascher) Date: Wed, 3 Mar 1999 14:08:10 -0800 (Pacific Standard Time) Subject: [Image-SIG] rotated text Message-ID: Anyone done the grunt work which would allow adding rotated text to ImageDraw? At this point, I'm happy with multiples of 90 degrees. --david From cgw@fnal.gov Wed Mar 3 22:20:18 1999 From: cgw@fnal.gov (Charles G Waldman) Date: Wed, 3 Mar 1999 16:20:18 -0600 (CST) Subject: [Image-SIG] rotated text In-Reply-To: References: Message-ID: <14045.46498.830707.423719@acpr5.fnal.gov> David Ascher writes: > Anyone done the grunt work which would allow adding rotated text to > ImageDraw? At this point, I'm happy with multiples of 90 degrees. If you're truly lazy and want rotated text, you can pad your image into a larger image (sqrt(2)x bigger), rotate that, render your text into the rotated image, then rotate it back and crop back to the original size. From mzimmer@hacstx.com Thu Mar 4 21:35:11 1999 From: mzimmer@hacstx.com (Mark Zimmerman) Date: Thu, 4 Mar 1999 14:35:11 -0700 Subject: [Image-SIG] TclError: invalid command name "PyImagingPhoto" Message-ID: <19990304143510.B2410@hacstx.com> Greetings: I just downloaded and compiled Imaging-1.0b1 and I am unable to run the sample scripts. The full text of the error is: bach$ python Scripts/painter.py ~/loop/19990631930.jpeg Traceback (innermost last): File "Scripts/painter.py", line 70, in ? PaintCanvas(root, im).pack() File "Scripts/painter.py", line 29, in __init__ tile = ImageTk.PhotoImage(image.crop(box)) File "./PIL/ImageTk.py", line 83, in __init__ self.paste(image) File "./PIL/ImageTk.py", line 113, in paste self.__photo.tk.call("PyImagingPhoto", self.__photo, block.id) TclError: invalid command name "PyImagingPhoto" I verified, based on access time, that _tkinter.so was found: bach$ ls -slut total 4940 2 drwxr-xr-x 2 root other 1024 Mar 4 13:59 ./ 3040 -r-xr-xr-x 1 root other 1542396 Mar 4 13:59 _tkinter.so* 100 -r-xr-xr-x 1 root other 51172 Mar 4 13:59 arraymodule.so* 66 -r-xr-xr-x 1 root other 33520 Mar 4 13:59 operator.so* 98 -r-xr-xr-x 1 root other 49292 Mar 4 13:59 stropmodule.so* 18 drwxrwxr-x 9 root other 9216 Mar 4 13:58 ../ 272 -r-xr-xr-x 1 root other 126100 Mar 4 13:56 cPickle.so* 224 -r-xr-xr-x 1 root other 101380 Mar 4 13:56 zlibmodule.so* . . . Also, _tkinter.so does contain PyImagingPhoto: bach$ nm _tkinter.so | grep PyImagingPhoto [94] | 199252| 692|FUNC |LOCL |0 |8 |PyImagingPhoto Has anyone else run into this problem? -- Mark Zimmerman Raytheon ITSS Corporation mzimmer@hacstx.com From mzimmer@hacstx.com Fri Mar 5 15:51:03 1999 From: mzimmer@hacstx.com (Mark Zimmerman) Date: Fri, 5 Mar 1999 08:51:03 -0700 Subject: [Image-SIG] Re: TclError: ... Never Mind In-Reply-To: <19990304143510.B2410@hacstx.com>; from Mark Zimmerman on Thu, Mar 04, 1999 at 02:35:11PM -0700 References: <19990304143510.B2410@hacstx.com> Message-ID: <19990305085103.A13353@hacstx.com> Greetings: Sorry to spam everyone with my installation difficulties. I went back and recompiled and reinstalled tcl, tk, python, and Imaging and the problem disappeared. There must have been some sort of version mismatch somewhere. -- Mark Zimmerman Raytheon ITSS Corporation mzimmer@hacstx.com From steve@websentric.com Mon Mar 8 14:46:36 1999 From: steve@websentric.com (Steve Purcell) Date: Mon, 08 Mar 1999 14:46:36 +0000 Subject: [Image-SIG] PIL 1.0b1 and GifImagePlugin.py Message-ID: <36E3E2CC.DF4865AB@websentric.com> Re: Daniel Walton's reported error with local/global palettes in GIF images, namely: File "/usr/local/lib/python1.5/site-packages/PIL/GifImagePlugin.py", line 109, in seek self.palette = self.global_palette AttributeError: global_palette I have also experienced this error for the first time today, and have a patch to offer. It seems to work for his sample image and those with global palettes, but I didn't test exhaustively (with, for example, animated GIFs). The innocuous patch is to insert the following at line 78 of 'GifImagePlugin.py': else: self.global_palette = None as a counterpart to the 'if' on line 73: if flags & 128: Works for me. Hope this helps Daniel and/or others somehow. BTW, a ready source of these local-palette images is the GIF encoder built into the MS Office 2000 preview. These images also confuse the well-known 'xv' viewer, so PIL is in somewhat illustrious company on this issue. Regards, -Steve -- Steve Purcell | Stunt Programmer & steve@websentric.com | Software Design Engineer From ecompas@socket.net Mon Mar 8 22:24:06 1999 From: ecompas@socket.net (Eric Compas) Date: Mon, 08 Mar 1999 15:24:06 -0700 Subject: [Image-SIG] GeoTIFF support? Message-ID: <36E44E06.A99F3AAF@socket.net> Folks, Forgive me if this has already been asked, but I've heard rumor that PIL has some support for the GeoTIFF format (a TIFF specification for geographic/spatial-referenced images). True? If so, is any of it documented? Thanks, Eric Compas From image_sig@opti.okdirect.com Thu Mar 11 11:31:20 1999 From: image_sig@opti.okdirect.com (Daniel Walton) Date: Thu, 11 Mar 1999 05:31:20 -0600 Subject: [Image-SIG] PIL 1.0b1 and GifImagePlugin.py In-Reply-To: <36E3E2CC.DF4865AB@websentric.com> Message-ID: <4.1.19990311053021.00c07bb0@grunt.okdirect.com> Looks like it worked for me! Thanks Steve! Dan At 02:46 PM 3/8/99 +0000, you wrote: >Re: Daniel Walton's reported error with local/global palettes in GIF >images, namely: > > File "/usr/local/lib/python1.5/site-packages/PIL/GifImagePlugin.py", >line > 109, in seek > self.palette = self.global_palette > AttributeError: global_palette > >I have also experienced this error for the first time today, and have a >patch to offer. It seems to work for his sample image and those with >global palettes, but I didn't test exhaustively (with, for example, >animated GIFs). The innocuous patch is to insert the following at line >78 of 'GifImagePlugin.py': > > else: > self.global_palette = None > >as a counterpart to the 'if' on line 73: > > if flags & 128: > > >Works for me. Hope this helps Daniel and/or others somehow. > >BTW, a ready source of these local-palette images is the GIF encoder >built into the MS Office 2000 preview. These images also confuse the >well-known 'xv' viewer, so PIL is in somewhat illustrious company on >this issue. > >Regards, > > >-Steve > >-- >Steve Purcell | Stunt Programmer & >steve@websentric.com | Software Design Engineer > >_______________________________________________ >Image-SIG maillist - Image-SIG@python.org >http://www.python.org/mailman/listinfo/image-sig > From da@ski.org Thu Mar 11 19:32:32 1999 From: da@ski.org (David Ascher) Date: Thu, 11 Mar 1999 11:32:32 -0800 (Pacific Standard Time) Subject: [Image-SIG] function to find out about output formats Message-ID: I'd like to find out programmatically how many output formats I can save an RGB image file to from PIL, or rather what file format extensions those correspond to. Is there an easy way to do this? --david From herzog@online.de Sat Mar 13 19:08:56 1999 From: herzog@online.de (Bernhard Herzog) Date: 13 Mar 1999 20:08:56 +0100 Subject: [Image-SIG] Install script for PIL Message-ID: I asked for it, so I wrote it: an install script for PIL. I've only tested this on Linux, but I expect it to work on other Unix(-like) systems as well. See the usage message in the script for what it actually does and how to invoke it. #! /usr/bin/env python # # Install script for the Python Imaging Library # import sys, os import glob import compileall import shutil from string import split, join class DefaultOptions: # # Directories # # The directory prefix prefix = sys.prefix # The python library directory. libdir = None # The site-packages directory sitepackagedir = None # The include file directory for python's header files includedir = None # The include file directory for extension header files extensionincludedir = None # # Other options # # if true, just print messages about what the script would be doing # but don't actually do anything. noop = 0 # Print lots of messages verbose = 1 # help = 0 # # Some methods # def print_messages(self): return self.verbose or self.noop def fix_directories(self): pyverdir = 'python' + sys.version[:3] if self.libdir is None: self.libdir = os.path.join(self.prefix, 'lib', pyverdir) if self.sitepackagedir is None: self.sitepackagedir = os.path.join(self.libdir, 'site-packages') if self.includedir is None: self.includedir = os.path.join(self.prefix, 'include', pyverdir) if self.extensionincludedir is None: self.extensionincludedir = os.path.join(self.includedir, 'extensions') options = DefaultOptions() def create_directory(dir): '''Create the directory dir and its parent directories if necessary''' if os.path.isdir(dir): return parent, base = os.path.split(dir) create_directory(parent) try: if options.print_messages(): print 'create directory %s' % dir if not options.noop: os.mkdir(dir, 0777) except os.error, exc: sys.stderr.write("can't create directory %s:%s\n" % (dir, exc)) def install_file(srcfile, dest, **flags): '''Copy the file srcfile, into the directory dest. If srcfile is a relative filename and the optional keyword argument recursive is true, preserve the leading directory components of the source filename and create the appropriate subdirectories in dest. ''' srcdir, basename = os.path.split(srcfile) if flags.get('recursive') and not os.path.isabs(srcdir): destdir = os.path.join(dest, srcdir) else: destdir = dest create_directory(destdir) destfile = os.path.join(destdir, basename) if options.print_messages(): print 'copying %s to %s' % (srcfile, destfile) if not options.noop: shutil.copy(srcfile, destfile) def bytecompile(dir): '''Bytecompile all python source files in dir recursively''' if options.noop: print 'Bytecompile all python source files under %s' % dir else: compileall.compile_dir(os.path.join(os.getcwd(), dir)) def install(pattern, dest, **flags): '''Install the files described by pattern pattern into the directory dest. The shell pattern is expanded by the glob module. An optional keyword argument recursive, if true, means to preserve the leading directory components of the source filenames if they are relative filenames and create the appropriate subdirectories in dest. ''' files = glob.glob(pattern) if not files: sys.stderr.write('No files matching %s\n' % pattern) for file in files: apply(install_file, (file, dest), flags) def check_option(option, value): if value is None: sys.stderr.write('Value required for option %s\n' % option) sys.exit(1) def parse_cmd_line(): argv = sys.argv[1:] for arg in argv: if '=' in arg: arg, value = split(arg, '=', 1) else: value = None if arg in ('-h', '--help'): options.help = 1 elif arg == '--prefix': options.prefix = os.path.expanduser(value) elif arg == '--install-dir': check_option('--prefix', value) options.sitepackagedir = os.path.expanduser(value) elif arg == '--include-dir': check_option('--include-dir', value) options.extensionincludedir = os.path.expanduser(value) elif arg == '--noop': options.noop = 1 else: sys.stderr.write('Unknown option %s\n' % arg) def print_help(): opt = DefaultOptions() opt.fix_directories() dict = opt.__class__.__dict__.copy() dict.update(opt.__dict__) dict['pyversion'] = sys.version[:3] print help_message % dict help_message = """\ usage: install.py [options...] install.py install the Python Imaging Library and its headerfiles. Normally the PIL is installed in the site-packages directory and the headerfiles in a subdirectory under the directory containing Python's headerfiles. You can change these directories with the options listed below. Options: -h, --help Print this help message. Do nothing else --noop Do nothing. Just print messages about what would be done. --prefix=DIR Install PIL files in DIR/lib/python-%(pyversion)s/site-packages/PIL Default is %(prefix)s --install-dir=DIR Install PIL in DIR. Default is %(sitepackagedir)s --include-dir=DIR Install the PIL header file in DIR. Default is %(extensionincludedir)s """ def main(): parse_cmd_line() if options.help: print_help() else: options.fix_directories() pildir = os.path.join(options.sitepackagedir, 'PIL') install('PIL/*.py', options.sitepackagedir, recursive = 1) install('_imaging.so', pildir, recursive = 1) install('PIL.pth', options.sitepackagedir, recursive = 1) for file in ('Imaging.h', 'ImConfig.h', 'ImPlatform.h'): install(os.path.join('libImaging', file), options.extensionincludedir) bytecompile(pildir) if __name__ == '__main__': main() From steve@websentric.com Tue Mar 16 15:34:32 1999 From: steve@websentric.com (Steve Purcell) Date: Tue, 16 Mar 1999 15:34:32 +0000 Subject: [Image-SIG] Wanted: Win32 DLL for PIL 1.0b1 Message-ID: <36EE7A08.C9D70DC2@websentric.com> Anybody have a Win32 DLL for PIL 1.0b1? The 'pythonware'-downloaded package only includes PIL 0.3, and I need quantising for RGB->P conversion. Any help greatly appreciated, -Steve P. From richard.jones@fulcrum.com.au Wed Mar 17 00:35:53 1999 From: richard.jones@fulcrum.com.au (Richard Jones) Date: Wed, 17 Mar 1999 11:35:53 +1100 Subject: [Image-SIG] ImageFont.load_path() searching patch Message-ID: <199903170035.LAA04562@icarus.fulcrum.com.au> Hi all, Here's a simple patch to ImageFont.load_path() that makes it search the directories specified by the ".pth" files in the Python search path. I'm not sure if I implemented the searching exactly as the interpreter does it - but it works for me. YMMV. Richard *** ImageFont.py.old Wed Mar 17 11:21:23 1999 --- ImageFont.py Wed Mar 17 11:33:29 1999 *************** *** 20,26 **** # import Image ! import math, os, string, sys # -------------------------------------------------------------------- # Font metrics format: --- 20,26 ---- # import Image ! import math, os, string, sys, glob # -------------------------------------------------------------------- # Font metrics format: *************** *** 113,117 **** --- 113,124 ---- return load(os.path.join(dir, filename)) except: pass + for extra in glob.glob(os.path.join(dir, "*.pth")): + try: + dir = os.path.join(dir, string.strip(open(extra).read())) + return load(os.path.join(dir, filename)) + except: + pass + raise IOError, "cannot find font file" From richard.jones@fulcrum.com.au Fri Mar 19 04:42:26 1999 From: richard.jones@fulcrum.com.au (Richard Jones) Date: Fri, 19 Mar 1999 15:42:26 +1100 Subject: [Image-SIG] ImageFont.load_path() searching patch In-Reply-To: Message from Richard Jones of 1999-Mar-17 11:35:53, <199903170035.LAA04562@icarus.fulcrum.com.au> Message-ID: <199903190442.PAA10359@icarus.fulcrum.com.au> [Richard Jones] > Here's a simple patch to ImageFont.load_path() that makes it search the > directories specified by the ".pth" files in the Python search path. I'm not > sure if I implemented the searching exactly as the interpreter does it - but > it works for me. YMMV. Here's a "better" snippet of code to find those pesky .pth files. I've added this to my application now instead of ImageFont - I figure it's probably better this way... import site if sys.path[0] == '': path = '.' else: path = sys.path[0] site.addsitedir(path) Richard From udrea@lxi005.gsi.de Fri Mar 19 14:12:37 1999 From: udrea@lxi005.gsi.de (Serban Udrea) Date: Fri, 19 Mar 1999 15:12:37 +0100 (CET) Subject: [Image-SIG] Unsuccessful installation Message-ID: Dear Sirs, I was unsuccessful in my atempt to install the Python Imaging Library 1.0 beta 1. After unpacking the PIL distribution and building it '$ make check' worked O.K. but I got the following message after '$ make -f Makefile.pre.in boot': /u/udrea/lib/python1.5/config/makesetup \ -m Makefile.pre -c /u/udrea/lib/python1.5/config/config.c.in Setup -n /u/udrea/lib/python1.5/config/Setup bad word libImaging/libImaging.a*noobjects* in _imaging _imaging.c decode.c encode.c map.c display.c path.c -IlibImaging libImaging/libImaging.a*noobjects* make[1]: *** [Makefile] Error 1 make[1]: Leaving directory `/u/udrea/Python-1.5.1/Extensions/Imaging-1.0b1' make: *** [boot] Error 2 (There was also something before, but I think that the error is announced here.) I have to mention the following: 1. My Python/Extensions directory is /u/udrea/Python-1.5.1/Extensions (This directory didn't exist when I unpacked the Python distribution, I created it) 2. The Python binary is in /u/udrea/bin and is called python1.5 3. Other Python related files are in /u/udrea/lib/python1.5 and /u/udrea/include/python1.5 4. I made the following changes in Makefile.pre.in: 'installdir= /usr/local' changed to 'installdir= /u/udrea' 'TARGET= python' changed to 'TARGET= python1.5' 'PYTHON= python' changed to 'PYTHON= python1.5' 'prefix= /usr/local' changed to 'prefix= /u/udrea' 5. I was unable to figure out what the following in the Makefile.pre.in realy means: # These two variables can be set in Setup to merge extensions. # See example[23] BASELIB= BASESETUP= Where is 'example[23]' ? What are these variables controlling ? Do I have to give them special values to be able to install the library ? If so, what are these values ? 6. I am working on a Linux-machine with a Debian distribution, kernel 2.0.36. The system administrator is not my friend. Best regards, Serban Udrea From s.havemann@tu-bs.de Fri Mar 19 20:58:00 1999 From: s.havemann@tu-bs.de (Sven Havemann) Date: Fri, 19 Mar 1999 21:58:00 +0100 Subject: [Image-SIG] PIL: Images from C-Extension? Message-ID: <36F2BA58.5CAB756F@tu-bs.de> This is a multi-part message in MIME format. --------------5EE9C53257E2D82FA87CA00B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit fredrik_lundh@ivab.se is invalid?? --------------5EE9C53257E2D82FA87CA00B Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline Return-Path: Received: from rzcomm1.rz.tu-bs.de (rzcomm1.rz.tu-bs.de [134.169.9.107]) by europa.cg.cs.tu-bs.de (8.8.7/8.8.7) with ESMTP id NAA24500; Fri, 19 Mar 1999 13:37:00 +0100 Received: from europa.cg.cs.tu-bs.de (root@europa.cg.cs.tu-bs.de [134.169.83.129]) by rzcomm1.rz.tu-bs.de (8.8.6/8.8.6) with ESMTP id NAA09464; Fri, 19 Mar 1999 13:38:13 +0100 (MET) Received: from tu-bs.de (nurbs.cg.cs.tu-bs.de [134.169.83.189]) by europa.cg.cs.tu-bs.de (8.8.7/8.8.7) with ESMTP id NAA24494; Fri, 19 Mar 1999 13:36:55 +0100 Sender: havemann@europa.cg.cs.tu-bs.de Message-ID: <36F24587.E418569F@tu-bs.de> Date: Fri, 19 Mar 1999 13:39:35 +0100 From: Sven Havemann Organization: Institut fuer Computergrafik X-Mailer: Mozilla 4.07C-SGI [en] (X11; I; IRIX 6.5 IP32) MIME-Version: 1.0 To: fredrik_lundh@ivab.se CC: n.schenk@tu-bs.de Subject: PIL: Images from C-Extension? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, Fredrik! ============ We're currently developing a radio wave field strength prediction tool and would like to display the results using Python/Tkinter/PIL. - Now we have a C-Extension module that performs the time-critical calculation and produces a bitmap as a C-data-structure. How can we display this with PIL? We're currently reading the sources to find a hook; but the problem is to get into PIL's colour and image administration procedures. I.e. what we'd like to do is something like im=Image.new("RGB", 300, 300) RadiowavePredict(im) image=ImageTk.PhotoImage(im) We'll certainly get to this, but our question is: Is there something like a tutorial example which demonstrates image transferral from C? Greetings, Sven. PS. PIL is _very_ cool. -- __________________________________________________________________ dipl-inform. Sven Havemann Institut fuer ComputerGraphik Odastrasse 6 Rebenring 18 38122 Braunschweig - Germany 38106 Braunschweig - Germany Tel. 0531/2808955 Tel. 0531/391-2108, Fax: -2103 s.havemann@tu-bs.de http://www.cg.cs.tu-bs.de --------------5EE9C53257E2D82FA87CA00B-- From s.havemann@tu-bs.de Fri Mar 19 20:58:38 1999 From: s.havemann@tu-bs.de (Sven Havemann) Date: Fri, 19 Mar 1999 21:58:38 +0100 Subject: [Image-SIG] PIL: FAST images from C-Extension? Message-ID: <36F2BA7E.23C287E7@tu-bs.de> This is a multi-part message in MIME format. --------------4548306A96FD939BFBC93FC5 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit fredrik_lundh@ivab.se is invalid?? --------------4548306A96FD939BFBC93FC5 Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline Return-Path: Received: from rzcomm1.rz.tu-bs.de (rzcomm1.rz.tu-bs.de [134.169.9.107]) by europa.cg.cs.tu-bs.de (8.8.7/8.8.7) with ESMTP id VAA27071; Fri, 19 Mar 1999 21:52:46 +0100 Received: from europa.cg.cs.tu-bs.de (root@europa.cg.cs.tu-bs.de [134.169.83.129]) by rzcomm1.rz.tu-bs.de (8.8.6/8.8.6) with ESMTP id VAA11508; Fri, 19 Mar 1999 21:53:58 +0100 (MET) Received: from tu-bs.de (nurbs.cg.cs.tu-bs.de [134.169.83.189]) by europa.cg.cs.tu-bs.de (8.8.7/8.8.7) with ESMTP id VAA27064; Fri, 19 Mar 1999 21:52:42 +0100 Sender: havemann@europa.cg.cs.tu-bs.de Message-ID: <36F2B9BE.10D5EF74@tu-bs.de> Date: Fri, 19 Mar 1999 21:55:26 +0100 From: Sven Havemann Organization: Institut fuer Computergrafik X-Mailer: Mozilla 4.07C-SGI [en] (X11; I; IRIX 6.5 IP32) MIME-Version: 1.0 Newsgroups: comp.lang.python To: Fredrik Lundh , n.schenk@tu-bs.de Subject: PIL: FAST images from C-Extension? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! === We're producing animated bitmaps in a C-extension module to Python and would like to display them FAST using Python/Tkinter/PIL. How can I transfer images from C to Python? I've written a demo extension doing so, you can find THE SOURCE (just 10 kB) in ftp://ftp.cg.cs.tu-bs.de/pub/cg/people/havemann/pildirect/pildirect.zip The problem is: IT IS TOO SLOW! My idea was to have an update function for a Tk Canvas doing the following (in Python): ============================================= im=Image.new("RGB",(800,800)) canvas=Canvas(root,width=802,height=802) imtk = ImageTk.PhotoImage(im) canvas.create_image(0,0,image=imtk,anchor=NW) canvas.pack() def update(): global im,imtk test(im) # updating the image from our extension module imtk.paste(im) # updating the PhotoImage tkroot.after(5,update) # loop ============================================= test(im) extracts the bitmap info from the Image.Image data structure and works quite nicely and fast. But the imtk.paste(im) obviously performs a FLOYD-STEINBERG DITHERING IN EVERY STEP resulting in an unacceptable O(m*n) complexity for bitmap size (m x n). Questions: Why is there dithering at all? Isn't the Tk PhotoImage a Truecolor image? How can I tell Tk to allocate a truecolor visual (by default)? The next idea was to use indexed color PhotoImages. But then I didn't manage to set the image palette and found some inconsistencies in ImagePalette.py from PIL ('raw' attribute not found in image.load()) and fixed it in a copied version... I've discovered that there's a new version of PIL, so I will retry using Imaging-1.0b1.tar.gz instead of Imaging-0.3b2.tgz monday... But maybe someone can tell me whether I run in the WRONG DIRECTION AT ALL and maybe there's obviously a BETTER SOLUTION!!! TIA for any hint, regards, Sven. -- __________________________________________________________________ dipl-inform. Sven Havemann Institut fuer ComputerGraphik Odastrasse 6 Rebenring 18 38122 Braunschweig - Germany 38106 Braunschweig - Germany Tel. 0531/2808955 Tel. 0531/391-2108, Fax: -2103 s.havemann@tu-bs.de http://www.cg.cs.tu-bs.de --------------4548306A96FD939BFBC93FC5-- From barry@scottb.demon.co.uk Mon Mar 22 22:10:34 1999 From: barry@scottb.demon.co.uk (Barry Scott) Date: Mon, 22 Mar 1999 22:10:34 -0000 Subject: [Image-SIG] Patch for ImageFont.py from PIL 1.0B1 Message-ID: <000101be74b0$ceb61c60$060110ac@barrynt.private> In ImageFont.py the function load_path uses "except:" this catches too many errors. I suggest this version of the function: def load_path(filename): "Load a font file, searching along the Python path." for dir in sys.path: try: return load(os.path.join(dir, filename)) except IOError: pass raise IOError, "cannot find font file" I found this out because I upgraded FreeBSD from 2.2.8 to 3.1 and now get the following error that I'm assuming means I must recompile Python and PIL for the new ELF image format of FreeBSD 3.X. File "./isdn_status.py", line 461, in create_graph_single title_face = ImageFont.load_path("BDF/75dpi/timR14.pil") File "/usr/local/lib/python1.5/site-packages/PIL/ImageFont.py", line 115, in load_path return load(os.path.join(dir, filename)) File "/usr/local/lib/python1.5/site-packages/PIL/ImageFont.py", line 106, in load f._load_pilfont(filename) File "/usr/local/lib/python1.5/site-packages/PIL/ImageFont.py", line 79, in _load_pilfont self.image.load() File "/usr/local/lib/python1.5/site-packages/PIL/ImageFile.py", line 111, in load self.map = Image.core.map(self.filename) File "/usr/local/lib/python1.5/site-packages/PIL/Image.py", line 36, in __getattr__ raise ImportError, "The _imaging C module is not installed" ImportError: The _imaging C module is not installed Barry From jeske@egroups.net Tue Mar 23 07:23:11 1999 From: jeske@egroups.net (David Jeske) Date: Mon, 22 Mar 1999 23:23:11 -0800 Subject: [Image-SIG] fromstring() question... Message-ID: <19990322232310.F26061@teapot.findmail.com> I'm having trouble figuring out what I'm supposed to do to get fromstring() to work. What I _want_ to do is: hand fromstring() a string which _is_ the contents of an image file, plus the encoder type (derived from the mime type), and have it pass back the PIL Image it retrieved as a result of decoding that string. For example: # tiff_file_string contains the contents of a tiff file img = PIL.Image.fromstring(tiff_file_string ,decoder_name = "TIFF") gif_file_string = img.tostring(encoder_name = "gif") I don't understand what exactly I'm supposed to pass to the other arguments to fromstring(). I don't know the size of the image yet, PIL's TIFF decoder is supposed to figure that out for me. I also couldn't find reference to what I'm supposed to pass into the final *args argument for the different decoder types. -- David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@egroups.net From fredrik@pythonware.com Tue Mar 23 08:13:45 1999 From: fredrik@pythonware.com (Fredrik Lundh) Date: Tue, 23 Mar 1999 09:13:45 +0100 Subject: [Image-SIG] fromstring() question... References: <19990322232310.F26061@teapot.findmail.com> Message-ID: <00aa01be7505$1449a6d0$f29b12c2@pythonware.com> David Jeske wrote: > I'm having trouble figuring out what I'm supposed to do to get > fromstring() to work. Ignore it ;-) > What I _want_ to do is: hand fromstring() a string which _is_ the > contents of an image file, plus the encoder type (derived from the > mime type), and have it pass back the PIL Image it retrieved as a > result of decoding that string. PIL autodetects all major formats, so you can simply ignore the mime type, and stuff your data into a StringIO object: im = Image.open(StringIO.StringIO(data)) (fromstring is designed to unpack pixel data chunks from a file into an image memory; it doesn't parse file headers). but if you insist in identifying the files yourself, you could roll your own image loader. the following snippet shows how to use the MIME and OPEN registries to pick the right image factory from the start. import Image import StringIO Image.init() MAP = {} # preload handlers for tag in ("GIF", "JPEG"): MAP[Image.MIME[tag]] = Image.OPEN[tag] def image_from_data(data, mime): # disclaimer: this works with PIL 1.0 and earlier. it # may not work with future releases. factory, accept = MAP[mime] if not accept or accept(data): fp = StringIO.StringIO(data) return factory(fp, "") raise IOError, "invalid image file" data = open("/images/sample.jpg", "rb").read() im = image_from_data(data, "image/jpeg") im.load() Cheers /F fredrik@pythonware.com http://www.pythonware.com From heather@v1.wustl.edu Tue Mar 23 18:47:58 1999 From: heather@v1.wustl.edu (Heather Drury) Date: Tue, 23 Mar 1999 12:47:58 -0600 (CST) Subject: [Image-SIG] PIL: viewer.py errors Message-ID: <199903231847.MAA05486@v1.wustl.edu> Hi, I'm trying to run the viewer.py demo program that came with Imaging-1.0b1 (using Python-1.5.2b2), and when I try to display an image, I get the following errors: What have I done wrong? TIA, heather v1 98% py viewer.py ../Images/lena.jpg Traceback (innermost last): File "viewer.py", line 44, in ? UI(root, im).pack() File "viewer.py", line 23, in __init__ self.image = ImageTk.PhotoImage(im) File "/usr/local/lib/python1.5/site-packages/PIL/ImageTk.py", line 83, in __init__ self.paste(image) File "/usr/local/lib/python1.5/site-packages/PIL/ImageTk.py", line 105, in paste im.load() File "/usr/local/lib/python1.5/site-packages/PIL/ImageFile.py", line 162, in load raise IOError, "decoder error %d when reading image file" % e IOError: decoder error -2 when reading image file Heather Drury heather@v1.wustl.edu Washington University School of Medicine http://v1.wustl.edu Department of Anatomy & Neurobiology Phone: 314-362-4325 660 S. Euclid, MS 8108 FAX: 314-747-4370 St. Louis, MO 63110-1093 From jeske@egroups.net Tue Mar 23 20:38:52 1999 From: jeske@egroups.net (David Jeske) Date: Tue, 23 Mar 1999 12:38:52 -0800 Subject: [Image-SIG] partial images possible? Message-ID: <19990323123851.A2169@teapot.findmail.com> I've had trouble loading partial (i.e. truncated) images. (jpeg) Is there some way to get PIL to load just the partial image and leave the rest blank? -- David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@egroups.net From heather@v1.wustl.edu Tue Mar 23 20:51:34 1999 From: heather@v1.wustl.edu (Heather Drury) Date: Tue, 23 Mar 1999 14:51:34 -0600 (CST) Subject: [Image-SIG] PIL: viewer.py errors In-Reply-To: <199903231847.MAA05486@v1.wustl.edu> from "Heather Drury" at Mar 23, 99 12:47:58 pm Message-ID: <199903232051.OAA21498@v1.wustl.edu> Hello, I realize it's bad form to answer my own post, but to save anyone the trouble I figured out that the tkappinit.c file wasn't getting recompiled with the WITH_PIL flag and therefore the relevent PyImagingPhoto command was not getting registered. I realized I need to recompile tkinter.c but didn't think I needed to recompile tkappinit.c since I'm not running "an old Python version" as it says in the README file. At any rate, it works. Heather > > Hi, > > I'm trying to run the viewer.py demo program that came with > Imaging-1.0b1 (using Python-1.5.2b2), and when I try to > display an image, I get the following errors: > > What have I done wrong? > TIA, > > heather > > v1 98% py viewer.py ../Images/lena.jpg > > Traceback (innermost last): > File "viewer.py", line 44, in ? > UI(root, im).pack() > File "viewer.py", line 23, in __init__ > self.image = ImageTk.PhotoImage(im) > File "/usr/local/lib/python1.5/site-packages/PIL/ImageTk.py", line 83, in __init__ > self.paste(image) > File "/usr/local/lib/python1.5/site-packages/PIL/ImageTk.py", line 105, in paste > im.load() > File "/usr/local/lib/python1.5/site-packages/PIL/ImageFile.py", line 162, in load > raise IOError, "decoder error %d when reading image file" % e > IOError: decoder error -2 when reading image file > > Heather Drury heather@v1.wustl.edu > Washington University School of Medicine http://v1.wustl.edu > Department of Anatomy & Neurobiology Phone: 314-362-4325 > 660 S. Euclid, MS 8108 FAX: 314-747-4370 > St. Louis, MO 63110-1093 > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://www.python.org/mailman/listinfo/image-sig > -- Heather Drury heather@v1.wustl.edu Washington University School of Medicine http://v1.wustl.edu Department of Anatomy & Neurobiology Phone: 314-362-4325 660 S. Euclid, MS 8108 FAX: 314-747-4370 St. Louis, MO 63110-1093 From fredrik@pythonware.com Tue Mar 23 21:16:47 1999 From: fredrik@pythonware.com (Fredrik Lundh) Date: Tue, 23 Mar 1999 22:16:47 +0100 Subject: [Image-SIG] partial images possible? References: <19990323123851.A2169@teapot.findmail.com> Message-ID: <005701be7572$779bbfd0$f29b12c2@pythonware.com> David Jeske wrote: > I've had trouble loading partial (i.e. truncated) images. (jpeg) Is > there some way to get PIL to load just the partial image and leave the > rest blank? not in 1.0b1. it's on the list for a future version (probably not 1.0 final, which is essentially frozen by now). if you really need this feature now, you have to hack libImaging/JpegDecode.c yourself (it might work to just comment out "state->errcode = IMAGE_CODEC_BROKEN" in the ImagingJpegDecode function...). Cheers /F http://www.pythonware.com/people/fredrik From uffe@data-dealeren.dk Wed Mar 24 13:03:48 1999 From: uffe@data-dealeren.dk (Uffe Overgaard Koch) Date: Wed, 24 Mar 1999 14:03:48 +0100 Subject: [Image-SIG] Image -> Array -> Image Problems Message-ID: <36F8E2B4.4EB0BFFC@control.auc.dk> I am doing (or trying to) some image analysis and object recognition on some grabbed images. BUT: When I try to convert an image (PIL) into an array (NumPy), copy it pixel by pixel, and convert the new array to an image it looks awkward. It looks like it is skipping some pixels. What d I do wrong? ---EX:--- #!/usr/bin/python import Image, Numeric height = 240 width = 320 def ImageToArray(i): a = Numeric.array(i.tostring(), "b") a.shape = i.size[1], i.size[0] return a def ArrayToImage(a): i = Image.new("L", (a.shape[1], a.shape[0])) i.fromstring(a.tostring()) return i img = Image.open('cap.jpg','r') img.show() inarr = ImageToArray(img) outarr = Numeric.zeros((height,width)) for y in range(1,height-1): for x in range(1,width-1): outarr[y][x] = inarr[y][x] imout = ArrayToImage(outarr) imout.show() ---END EX--- /Uffe Koch Aalborg University - Denmark From godzilla@netmeg.net (Les Schaffer) Thu Mar 25 14:34:04 1999 From: godzilla@netmeg.net (Les Schaffer) (Les Schaffer) Date: Thu, 25 Mar 1999 09:34:04 -0500 (EST) Subject: [Image-SIG] Image -> Array -> Image Problems In-Reply-To: <36F8E2B4.4EB0BFFC@control.auc.dk> References: <36F8E2B4.4EB0BFFC@control.auc.dk> Message-ID: <14074.18780.761948.962901@gargle.gargle.HOWL> >>>>> ">" == Uffe Overgaard Koch writes: >> and convert the new array to an image it looks awkward. It >> looks like it is skipping some pixels. What d I do wrong? i'm trying to figure that out myself. what version of NumPy (LLNLxx) are you using. the latest, 10, had some small changes, one of which broke something (unrelated this this). les schaffer From ken@psych.utoronto.ca Fri Mar 26 04:33:11 1999 From: ken@psych.utoronto.ca (Ken N. Seergobin) Date: Thu, 25 Mar 1999 23:33:11 -0500 (EST) Subject: [Image-SIG] Image file to numeric representation Message-ID: I have what is probably a very simple question... Once an image has been opened, how does one go about converting the internal format to a numeric representation that can be analyzed? As an example, I would like to assess the pairwise correlation of various images. Thanks, Ken From doko@cs.tu-berlin.de Sun Mar 28 09:45:58 1999 From: doko@cs.tu-berlin.de (Matthias Klose) Date: Sun, 28 Mar 1999 11:45:58 +0200 (MET DST) Subject: [Image-SIG] patch to build a Tcl PIL module Message-ID: <14077.63763.239659.348259@bolero> The current (1.0b1) approach has the disadvantage that you have to rebuild _tkinter to use Tkinter support. The following patch builds the Tcl PIL module as a shared module --- python-pil-0.3b2.orig/PIL/ImageTk.py +++ python-pil-0.3b2/PIL/ImageTk.py @@ -110,6 +110,7 @@ block = image.new_block(self.__mode, im.size) image.convert2(block, image) # convert directly between buffers + self.__photo.tk.call("package", "require", "Pil") self.__photo.tk.call("PyImagingPhoto", self.__photo, block.id) --- python-pil-0.3b2.orig/Tk/tkImaging.c +++ python-pil-0.3b2/Tk/tkImaging.c @@ -183,9 +183,22 @@ } +#ifdef PIL_MODULE +int +Pil_Init(Tcl_Interp* interp) +{ + Tcl_CreateCommand(interp, "PyImagingPhoto", PyImagingPhoto, + (ClientData) 0, (Tcl_CmdDeleteProc*) NULL); + if (Tcl_PkgProvide(interp, "Pil", "1.0") != TCL_OK) { + return TCL_ERROR; + } + return TCL_OK; +} +#else void TkImaging_Init(Tcl_Interp* interp) { Tcl_CreateCommand(interp, "PyImagingPhoto", PyImagingPhoto, (ClientData) 0, (Tcl_CmdDeleteProc*) NULL); } +#endif --- python-pil-0.3b2.orig/Tk/Makefile +++ python-pil-0.3b2/Tk/Makefile @@ -0,0 +1,50 @@ +# The C compiler: +CC = cc + +# Compiler options: +COPTS = -O2 -fpic -DPIL_MODULE + +# Name for the shared lib: +SH_LIB = PIL.so + +# Shared library linker command: +SHLINK = cc -shared + +# Where to find tcl.h, tk.h +INCLUDES = + +# Where to find libtcl.a, libtk.a +LIBDIRS = + +# Libraries to link with (-ldl for Linux only?): +LIBS = -ltk8.0 -ltcl8.0 -lm -lc -ldl + +TK_FLAGS = + + +#### Shouldn't have to change anything beyond this point #### + + +CFLAGS = $(COPTS) $(INCLUDES) $(TK_FLAGS) + +LFLAGS = $(LIBDIRS) + +all: shared pkgIndex.tcl + +shared: $(SH_LIB) + +tkImaging.o: tkImaging.c + $(CC) -c -I../libImaging $(CFLAGS) tkImaging.c + + +$(SH_LIB): tkImaging.o + $(SHLINK) $(LFLAGS) $(LIBS) tkImaging.o -o $@ + +pkgIndex.tcl: $(SH_LIB) + echo pkg_mkIndex . $(SH_LIB) | tclsh8.0 + +clean: + -rm -f *.o *~ core pkgIndex.tcl + +realclean: + -rm -f *.o *~ core *.so pkgIndex.tcl From steve@websentric.com Tue Mar 30 11:14:48 1999 From: steve@websentric.com (Steve Purcell) Date: Tue, 30 Mar 1999 11:14:48 +0000 Subject: [Image-SIG] PNG test suite Message-ID: <3700B228.F6E3510C@websentric.com> For those that might have more time to work on the PIL source than myself, there's a semi-official set of PNG test images at: http://www.schaik.com/pngsuite/pngsuite.html A quick check shows that PIL's PNG support passes 125 of the 157 test cases. -Steve P. -- Steve Purcell | Stunt Programmer steve@websentric.com | WebSentric Software GmbH From jeske@egroups.net Wed Mar 31 03:51:16 1999 From: jeske@egroups.net (David Jeske) Date: Tue, 30 Mar 1999 19:51:16 -0800 Subject: [Image-SIG] anyone using PIL to deal with group3 fax files? Message-ID: <19990330195116.Z10030@teapot.findmail.com> Has anyone extended PIL to handle group3/group4 compressed TIFF files? -- David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@egroups.net