From suzuki611 at oki.com Mon Jun 2 15:23:54 2003 From: suzuki611 at oki.com (SUZUKI Hisao) Date: Mon Jun 2 01:24:42 2003 Subject: [Image-SIG] Imaging-1.1.4 on Cygwin (Re: Can PIL be installed under Cygwin?) Message-ID: <200306020523.OAA20488@suzuki611.ngo.okisoft.co.jp> Three months ago in , Jason Tishler wrote: > Did you see the following? > http://sources.redhat.com/ml/cygwin/2002-05/msg00582.html [snip] > Use the above URL (possibly modified to deal with the latest Cygwin > Tcl/Tk package) to build a Cygwin PIL. I am afraid the method described there is too complicated and may affect the Cygwin system extensively to build the Imaging library... I succeeded in making Imaging-1.1.4 from the source in an easier way though it was a bit of quick hack. 1) Install the current Cygwin packages of "python", "jpeg", "XFree86-prog" (for /usr/X11R6/include/X11/*) and others. 2) Modify the file "setup.py". *** Imaging-1.1.4/setup.py~ Fri May 9 12:00:56 2003 --- Imaging-1.1.4/setup.py Mon Jun 2 02:15:20 2003 *************** *** 120,131 **** # configure imagingtk module try: ! import _tkinter ! TCL_VERSION = _tkinter.TCL_VERSION[:3] except (ImportError, AttributeError): pass else: ! INCLUDE_DIRS = ["libImaging"] LIBRARY_DIRS = ["libImaging"] LIBRARIES = ["Imaging"] EXTRA_COMPILE_ARGS = None --- 120,133 ---- # configure imagingtk module try: ! #import _tkinter ! #TCL_VERSION = _tkinter.TCL_VERSION[:3] ! TCL_VERSION = "84" except (ImportError, AttributeError): pass else: ! # INCLUDE_DIRS = ["libImaging"] ! INCLUDE_DIRS = ["libImaging", "/usr/X11R6/include"] LIBRARY_DIRS = ["libImaging"] LIBRARIES = ["Imaging"] EXTRA_COMPILE_ARGS = None 3) Follow the instructions written in "README": $ cd libImaging $ ./configure $ make $ cd .. $ python setup.py build $ python setup.py install 4) Now you can test the library: $ python selftest.py 55 tests passed. Hope this helps, though it may be too late. -- SUZUKI Hisao From jason at tishler.net Mon Jun 2 09:03:31 2003 From: jason at tishler.net (Jason Tishler) Date: Mon Jun 2 08:02:31 2003 Subject: [Image-SIG] Re: Imaging-1.1.4 on Cygwin (Re: Can PIL be installed under Cygwin?) In-Reply-To: <200306020523.OAA20488@suzuki611.ngo.okisoft.co.jp> References: <200306020523.OAA20488@suzuki611.ngo.okisoft.co.jp> Message-ID: <20030602120330.GA2044@tishler.net> SUZUKI Hisao, On Mon, Jun 02, 2003 at 02:23:54PM +0900, SUZUKI Hisao wrote: > Three months ago in , > Jason Tishler wrote: > > Did you see the following? > > http://sources.redhat.com/ml/cygwin/2002-05/msg00582.html > [snip] > > Use the above URL (possibly modified to deal with the latest Cygwin ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > Tcl/Tk package) to build a Cygwin PIL. ^^^^^^^^^^^^^^ > > I am afraid the method described there is too complicated and may > affect the Cygwin system extensively to build the Imaging library... > I succeeded in making Imaging-1.1.4 from the source in an easier way > though it was a bit of quick hack. > > [snip] AFAICT, Chuck and your procedure (and patch) are essentially the same. The only extra steps that his one had are: 1. creating some missing symlinks 2. rebasing the system to prevent the known Cygwin fork() problem Step 1 may have been obviated by the newer Cygwin Tcl/Tk packages and Step 2 is likely necessary with your approach too. Jason -- PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6 From fredrik at pythonware.com Mon Jun 2 23:53:27 2003 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon Jun 2 16:54:28 2003 Subject: [Image-SIG] Re: Compile errors ad nauseum References: <20030531154916.M97247@pop> Message-ID: "doug" wrote: > > That seems to have worked! Thanks Frederik! you're welcome! > Unfortunately I have run onto another issue: > > Tk/tkImaging.c: In function `TkImaging_Init': > Tk/tkImaging.c:191: warning: passing arg 3 of `Tcl_CreateCommand' from > incompatible pointer type > gcc -shared ./_imagingtk.o ./tkImaging.o -L/usr/local/lib -ltcl8.0 -ltk8.0 > -L/usr/X11R6/lib -lX11 -o ./_imagingtk.so > /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../../../i386-slackware-linux/bin/ld: > cannot find -ltcl8.0 > collect2: ld returned 1 exit status > make: *** [_imagingtk.so] Error 1 > > My Slackware 9 install has tcl8.4. What am I missing here, folks? if you have tcl/tk 8.4, why are you linking against 8.0 ? ;-) I cannot tell if you're using the setup.py build approach (preferred) or the older Makefile.pre.in approach; if the former, the above means that Python's Tkinter module was built against 8.0; if the latter, you have to edit the Setup.in to match your local configuration: $ rm Setup $ emacs Setup.in (change 8.0 to 8.4, and make sure the path's are correct) $ make Makefile.pre.in boot $ make From suzuki611 at oki.com Tue Jun 3 09:29:36 2003 From: suzuki611 at oki.com (SUZUKI Hisao) Date: Mon Jun 2 19:30:26 2003 Subject: [Image-SIG] Re: Imaging-1.1.4 on Cygwin (Re: Can PIL be installed under Cygwin?) In-Reply-To: <20030602120330.GA2044@tishler.net> (message from Jason Tishler on Mon, 02 Jun 2003 08:03:31 -0400) Message-ID: <200306022329.IAA20935@suzuki611.ngo.okisoft.co.jp> In <20030602120330.GA2044@tishler.net>, Jason Tishler wrote: > AFAICT, Chuck and your procedure (and patch) are essentially the same. > The only extra steps that his one had are: > > 1. creating some missing symlinks > 2. rebasing the system to prevent the known Cygwin fork() problem > > Step 1 may have been obviated by the newer Cygwin Tcl/Tk packages and > Step 2 is likely necessary with your approach too. No, step 2 is not necessary with my approach. Please try it. The key difference is not to import _tkinter in my setup.py. -- SUZUKI Hisao From lbates at syscononline.com Mon Jun 2 19:52:06 2003 From: lbates at syscononline.com (Larry Bates) Date: Tue Jun 3 03:51:48 2003 Subject: [Image-SIG] .DCX files and dpi information Message-ID: <000f01c32961$f9d29580$9500a8c0@larrywxp> I have some incoming fax files in .DCX format. I need to obtain the horizontal and vertical resolutions and number of pixels for each page that is stored in a separate file. I tried: import image i=Image.open("file001.dcx") hres, vres=i.info i.info returns (1728, 2159) which is pixels of horizontal and vertical dots on the page. Question: How can I obtain the resolution (e.g. dpi) of the pixels as they are encoded in the file? The faxes can come in in either 100 or 200 dpi vertical resolution (e.g. fine setting on fax machine) and I need to handle each differently. Thanks in advance for any help. Regards, Larry Bates From jason at tishler.net Tue Jun 3 12:58:33 2003 From: jason at tishler.net (Jason Tishler) Date: Tue Jun 3 12:01:02 2003 Subject: [Image-SIG] Re: Imaging-1.1.4 on Cygwin (Re: Can PIL be installed under Cygwin?) In-Reply-To: <200306022329.IAA20935@suzuki611.ngo.okisoft.co.jp> References: <20030602120330.GA2044@tishler.net> <200306022329.IAA20935@suzuki611.ngo.okisoft.co.jp> Message-ID: <20030603155833.GA1556@tishler.net> SUZUKI Hisao, On Tue, Jun 03, 2003 at 08:29:36AM +0900, SUZUKI Hisao wrote: > In <20030602120330.GA2044@tishler.net>, Jason Tishler wrote: > > AFAICT, Chuck and your procedure (and patch) are essentially the > > same. The only extra steps that his one had are: > > > > 1. creating some missing symlinks > > 2. rebasing the system to prevent the known Cygwin fork() > > problem > > > > Step 1 may have been obviated by the newer Cygwin Tcl/Tk packages > > and Step 2 is likely necessary with your approach too. > > No, step 2 is not necessary with my approach. OK, but if you use Cygwin Python, shared extensions, and fork(), then you will need to rebase your DLLs sooner rather than later. > The key difference is not to import _tkinter in my setup.py. Oops, I missed that! Anyway, that's cheating! :,) BTW, rebasing is much easier now that I contributed the rebase package to the standard Cygwin distribution: http://www.tishler.net/jason/software/rebase/rebase-2.2.README Jason -- PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6 From Chris.Barker at noaa.gov Mon Jun 2 20:30:54 2003 From: Chris.Barker at noaa.gov (Chris Barker) Date: Tue Jun 3 12:42:30 2003 Subject: [Image-SIG] .DCX files and dpi information References: <000f01c32961$f9d29580$9500a8c0@larrywxp> Message-ID: <3EDC085E.613DD5E9@noaa.gov> Larry Bates wrote: > i.info returns (1728, 2159) which is pixels of horizontal and vertical > dots on the page. > > Question: How can I obtain the resolution (e.g. dpi) of the pixels as > they are encoded in the file? The faxes can come in in either 100 > or 200 dpi vertical resolution (e.g. fine setting on fax machine) and Well, it's a kludge, but if you can't get the info directly, it's pretty obvious that the above example is 200 dpi (1728 / 200. = 8.64), unless someone is sending a fax from a machine that can handle 17in wide paper. If the options are really only 100 or 200 dpi, it shojuld be easy to figure it out for any reasonable image. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From jmricker at nc.rr.com Wed Jun 4 20:00:55 2003 From: jmricker at nc.rr.com (Jody) Date: Wed Jun 4 19:01:19 2003 Subject: [Image-SIG] Splitting Images [Was: .DCX files and dpi information] In-Reply-To: <3EDC085E.613DD5E9@noaa.gov> Message-ID: <006f01c32aed$28369f70$1d944a18@joelom35kpq2rs> > -----Original Message----- > From: image-sig-bounces@python.org > [mailto:image-sig-bounces@python.org] On Behalf Of Chris Barker > Well, it's a kludge, but if you can't get the info directly, > it's pretty obvious that the above example is 200 dpi (1728 / > 200. = 8.64), unless someone is sending a fax from a machine > that can handle 17in wide paper. If the options are really > only 100 or 200 dpi, it shojuld be easy to figure it out for > any reasonable image. I also needed to know the dpi of my images. Is there a way to do it interactively? At the moment I know what the dpi of the images I need to handle are set at but would like to set up my script to be more dynamic. Also, the script I'm working is I need to split a large image into printer page sized sheets. If I understand the meaning of dpi, that's how many printed dots per inch. So to crop one page worth of material, I need a bounding box set: Width of image in pixels / dpi * 8.5 ## Rounded down Height of image in pixels / dpi * 11 ## Rounded down Thanks, Jody From fog at debian.org Thu Jun 5 11:37:32 2003 From: fog at debian.org (Federico Di Gregorio) Date: Thu Jun 5 04:37:37 2003 Subject: [Image-SIG] BUG: PIL Ghostscript can't be used in a daemon Message-ID: <20030605083732.GA29079@initd.org> Hi *, we were trying to use the PIL in a daemon started at boot (via init.d) and we encountered some problems with the Ghostscript function in EpsImagePlugin.py. the popen call fails unless /dev/tty redirection is removed from the command (we replaced it with /dev/null, a daemon is not interested in gs output.) moreover you don't check the return value from gs.close(), so the code fails when trying to open the generated file at line 80. i think something like: status = gs.close() if status != 0: raise IOError("gs failed: return code = %d" % status) ... would be more appropriate. the PIL version is 1.1.3. ciao, federico -- Federico Di Gregorio Debian GNU/Linux Developer & Italian Press Contact fog@debian.org Those who do not study Lisp are doomed to reimplement it. Poorly. -- from Karl M. Hegbloom .signature From lbates at syscononline.com Tue Jun 10 12:29:12 2003 From: lbates at syscononline.com (Larry Bates) Date: Tue Jun 10 12:34:02 2003 Subject: [Image-SIG] Broken PIL Message-ID: <005c01c32f6d$6d957d00$9500a8c0@larrywxp> All of the sudden I'm getting an odd error/traceback when I try to use PIL. I recently downloaded and installed 1.1.4a3 (Windows installer version). I did patch this with the PcxImagePlugin that Fredrick sent me last week. Below is a sample program and traceback that I'm getting. It doesn't seem to matter if I change the output format to JPG (e.g. I get the same traceback). Thanks in advance for any assistance. Regards, Larry import Image import PcxImagePlugin infilename=r"c:\Windows\Temp\J0001579.001" outfilename=r"c:\Windows\Temp\J0001579.PDF" im=Image.open(infilename) im.save(outfilename, "PDF") Traceback (most recent call last): File "C:\Python22\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 301, in RunScript exec codeObject in __main__.__dict__ File "F:\Swami\Projects\AFR\TestPDF.py", line 26, in ? im.save(outfilename, "PDF") File "C:\Python22\Lib\site-packages\PIL\Image.py", line 1084, in save self.load() File "C:\Python22\Lib\site-packages\PIL\ImageFile.py", line 156, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "C:\Python22\Lib\site-packages\PIL\Image.py", line 271, in _getdecoder return apply(decoder, (mode,) + args + extra) TypeError: function takes exactly 2 arguments (3 given) >>> Can not watch file F:\Swami\Projects\AFR for changes - Incorrect function. Traceback (most recent call last): File "C:\Python22\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 301, in RunScript exec codeObject in __main__.__dict__ File "F:\Swami\Projects\AFR\test.py", line 7, in ? im.save(outfilename, "PDF") File "C:\Python22\Lib\site-packages\PIL\Image.py", line 1084, in save self.load() File "C:\Python22\Lib\site-packages\PIL\ImageFile.py", line 156, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "C:\Python22\Lib\site-packages\PIL\Image.py", line 271, in _getdecoder return apply(decoder, (mode,) + args + extra) TypeError: function takes exactly 2 arguments (3 given) From Doug.Shawhan at ge.com Tue Jun 10 15:05:57 2003 From: Doug.Shawhan at ge.com (Shawhan, Doug (EM, ITS)) Date: Tue Jun 10 14:06:39 2003 Subject: [Image-SIG] Re: Compile errors ad nauseum Message-ID: Sorry! Away from all nettage for a week. Thanks very much for your help Frederik! -----Original Message----- From: Fredrik Lundh [mailto:fredrik@pythonware.com] Sent: Monday, June 02, 2003 3:53 PM To: image-sig@python.org Subject: [Image-SIG] Re: Compile errors ad nauseum "doug" wrote: > > That seems to have worked! Thanks Frederik! you're welcome! > Unfortunately I have run onto another issue: > > Tk/tkImaging.c: In function `TkImaging_Init': > Tk/tkImaging.c:191: warning: passing arg 3 of `Tcl_CreateCommand' from > incompatible pointer type > gcc -shared ./_imagingtk.o ./tkImaging.o -L/usr/local/lib -ltcl8.0 -ltk8.0 > -L/usr/X11R6/lib -lX11 -o ./_imagingtk.so > /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/../../../../i386-slackware-linux/bin/ld: > cannot find -ltcl8.0 > collect2: ld returned 1 exit status > make: *** [_imagingtk.so] Error 1 > > My Slackware 9 install has tcl8.4. What am I missing here, folks? if you have tcl/tk 8.4, why are you linking against 8.0 ? ;-) I cannot tell if you're using the setup.py build approach (preferred) or the older Makefile.pre.in approach; if the former, the above means that Python's Tkinter module was built against 8.0; if the latter, you have to edit the Setup.in to match your local configuration: $ rm Setup $ emacs Setup.in (change 8.0 to 8.4, and make sure the path's are correct) $ make Makefile.pre.in boot $ make _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig From fredrik at pythonware.com Tue Jun 10 21:19:34 2003 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue Jun 10 14:21:43 2003 Subject: [Image-SIG] Re: Broken PIL References: <005c01c32f6d$6d957d00$9500a8c0@larrywxp> Message-ID: Larry Bates wrote: > All of the sudden I'm getting an odd error/traceback when I try to use > PIL. I recently downloaded and installed 1.1.4a3 (Windows installer > version). I did patch this with the PcxImagePlugin that Fredrick > sent me last week. > > Below is a sample program and traceback that I'm getting. It doesn't > seem to matter if I change the output format to JPG (e.g. I get the > same traceback). > return apply(decoder, (mode,) + args + extra) > TypeError: function takes exactly 2 arguments (3 given) the usual cause for this problem is that Python is picking up the PIL Python files for one PIL version, and the _imaging module for another one. (in this case, it looks like newer Python files, and an old _imaging module) try this: >>> import Image >>> print Image.__file__ >>> import _imaging >>> print _imaging.__file__ and make sure that the output is what you expect. if you cannot sort it out, get rid of all _imaging.dll and _imaging.pyd files in the Python tree (and if necessary, the application tree), and reinstall. From hjeet_in at yahoo.com Wed Jun 11 10:52:47 2003 From: hjeet_in at yahoo.com (=?iso-8859-1?q?JEET?=) Date: Wed Jun 11 08:46:09 2003 Subject: [Image-SIG] Creating Multipage Tiff Message-ID: <20030611085247.30705.qmail@web8206.mail.in.yahoo.com> Hello everybody !... I am a bit new to this list.. I have started using PIL for some tiff image processing but encountered with some problem. 1 ) PIL only supports certain formats for tiff like LZW or Packbits. Do we have a decoder for Group4 compression 2) I am able to split a multipage tiff image but is not able to find a way to merge individual tiff images and create a multipage tiff. Do PIL supports merging of several tiff images into one multipage tiff Any solutions will be highly appreciated Regards DEB Catch all the cricket action. Download Yahoo! Score tracker -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20030611/50de3b03/attachment.htm From piot at mail.desy.de Fri Jun 13 02:44:01 2003 From: piot at mail.desy.de (Philippe Regis-Guy Piot) Date: Thu Jun 12 19:44:36 2003 Subject: [Image-SIG] problem building Imaging-1.1.4 (PIL) Message-ID: Hi, When I try to build the PIL library everything goes well up to the point where I need to do a: python setup.py build_ext -i it results in the error: File "setup.py", line 193 for fw in 'Tcl', 'Tk' which I do not get (sorry I am a newcomer to python). Thank you in advance for any suggestion/help. -- Philippe Piot From fredrik at pythonware.com Fri Jun 13 23:36:45 2003 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri Jun 13 16:42:06 2003 Subject: [Image-SIG] Re: problem building Imaging-1.1.4 (PIL) References: Message-ID: Philippe Regis-Guy Piot wrote: > When I try to build the PIL library everything > goes well up to the point where I need to do a: > > python setup.py build_ext -i > > it results in the error: > > File "setup.py", line 193 > for fw in 'Tcl', 'Tk' > > which I do not get (sorry I am a newcomer to python). in 1.1.4, the setup.py script requires Python 2.1 or newer. on some systems, "python" is an old version (usually 1.5.2), and "python2" is 2.1 or later. try running "python2 setup.py" instead. otherwise, you have to use the Makefile.pre.in build approach. see the README file for details. From rasika at accmt.ac.lk Tue Jun 17 15:31:48 2003 From: rasika at accmt.ac.lk (Rasika) Date: Tue Jun 17 07:11:32 2003 Subject: [Image-SIG] (no subject) Message-ID: <000801c334aa$e745c5a0$0255f8c0@ac.lk> How can we use the getpixel function in Delphi programming language to retrieve the RGB value -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20030617/0d925458/attachment.htm From howard at eegsoftware.com Wed Jun 18 14:34:34 2003 From: howard at eegsoftware.com (howard@eegsoftware.com) Date: Wed Jun 18 16:33:32 2003 Subject: [Image-SIG] Problem building PIL with freetype Message-ID: <3EF06A6A.28476.567DBC8@localhost> (Windows98, PIL1.1.4, Freetype 2.1.4,zlib.1.1.4 (? without looking),jpeg.6b) When I try building PIL with FREETYPEDIR pointing to the source directories, I get the following error: Creating library build\temp.win32-2.2\Release\_imagingft.lib and object build \temp.win32-2.2\Release\_imagingft.exp ftinit.obj : error LNK2001: unresolved external symbol _pfr_driver_class ftinit.obj : error LNK2001: unresolved external symbol _t42_driver_class ftinit.obj : error LNK2001: unresolved external symbol _pshinter_module_class ftinit.obj : error LNK2001: unresolved external symbol _bdf_driver_class ftinit.obj : error LNK2001: unresolved external symbol _pcf_driver_class build\lib.win32-2.2\_imagingft.pyd : fatal error LNK1120: 5 unresolved externals error: command '"D:\Microsoft Visual Studio\VC98\BIN\link.exe"' failed with exit status 1120 When I try pointing FREETYPEDIR to just the built-up libraries, I get the following error: _imagingft.obj : error LNK2001: unresolved external symbol _FT_Set_Pixel_Sizes _imagingft.obj : error LNK2001: unresolved external symbol _FT_New_Face _imagingft.obj : error LNK2001: unresolved external symbol _FT_Init_FreeType _imagingft.obj : error LNK2001: unresolved external symbol _FT_Load_Glyph _imagingft.obj : error LNK2001: unresolved external symbol _FT_Get_Char_Index _imagingft.obj : error LNK2001: unresolved external symbol _FT_Done_Face build\lib.win32-2.2\_imagingft.pyd : fatal error LNK1120: 6 unresolved externals I am not sure where to go next...... Suggestions welcomed since this is the last link before I have to deliver something... From fredrik at pythonware.com Thu Jun 19 00:42:23 2003 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Jun 18 17:46:00 2003 Subject: [Image-SIG] Re: Problem building PIL with freetype References: <3EF06A6A.28476.567DBC8@localhost> Message-ID: "howard@eegsoftware.com" wrote: > When I try building PIL with FREETYPEDIR pointing to the source directories, I get > the following error: > > Creating library build\temp.win32-2.2\Release\_imagingft.lib and object build > \temp.win32-2.2\Release\_imagingft.exp > ftinit.obj : error LNK2001: unresolved external symbol _pfr_driver_class > ftinit.obj : error LNK2001: unresolved external symbol _t42_driver_class > ftinit.obj : error LNK2001: unresolved external symbol _pshinter_module_class > ftinit.obj : error LNK2001: unresolved external symbol _bdf_driver_class > ftinit.obj : error LNK2001: unresolved external symbol _pcf_driver_class > build\lib.win32-2.2\_imagingft.pyd : fatal error LNK1120: 5 unresolved externals > > error: command '"D:\Microsoft Visual Studio\VC98\BIN\link.exe"' failed with exit > status 1120 I'm not sure I've tested the setup.py file with that version of freetype. try comparing the file list in the setup.py file with the list of source files in the freetype distribution, and add what's missing. From bbaxter at wadsworth.org Wed Jun 18 18:54:53 2003 From: bbaxter at wadsworth.org (William Baxter) Date: Wed Jun 18 17:56:31 2003 Subject: [Image-SIG] core dump Message-ID: <3EF0DFAD.8B6ECF29@wadsworth.org> Hi. I've been trying to install Imaging-1.1.4 on IRIX64. It complained that Tk_FindPhoto had too many arguments. I noticed in some older message boards that the opposite used to be the case! Anyway, I changed photo = Tk_FindPhoto(interp, argv[1]); to photo = Tk_FindPhoto(argv[1]); and it compiled and I can import Image, ImageTk But it doesn't work: >>> from Tkinter import * >>> import Image, ImageTk >>> filename = 'lena.gif' >>> im = Image.open(filename) >>> root = Tk() >>> import sys >>> root.title(filename) '' >>> image = ImageTk.PhotoImage(im) Bus error (core dumped) Is this related to the change I made? Thanks, Bill Baxter From hancock at anansispaceworks.com Thu Jun 19 10:27:45 2003 From: hancock at anansispaceworks.com (Terry Hancock) Date: Thu Jun 19 10:28:38 2003 Subject: [Image-SIG] core dump In-Reply-To: <3EF0DFAD.8B6ECF29@wadsworth.org> References: <3EF0DFAD.8B6ECF29@wadsworth.org> Message-ID: On Wednesday 18 June 2003 02:54 pm, William Baxter wrote: > I've been trying to install Imaging-1.1.4 on IRIX64. It complained that > Tk_FindPhoto had too many arguments. I noticed in some older message > boards that the opposite used to be the case! Anyway, I changed > photo = Tk_FindPhoto(interp, argv[1]); > to > photo = Tk_FindPhoto(argv[1]); > and it compiled and I can import Image, ImageTk I think you'll need to say what version of Tk and Tkinter you're using. If you have an API mismatch, that's probably the culprit. HTH, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com From howard at eegsoftware.com Fri Jun 20 12:08:31 2003 From: howard at eegsoftware.com (howard@eegsoftware.com) Date: Fri Jun 20 14:07:27 2003 Subject: [Image-SIG] Problem printing images via ImageWin Message-ID: <3EF2EB2F.10614.4F69BC6@localhost> I am trying to use the code snippet below to print images (under Windows). The output file (out.png) is correctly saved but nothing ever prints. When I uncomment out the WritePrinter command, the text prints so I am *assuming* I opened the printer OK. It appears that expose function does not send anything to the printer context. This is PIL.1.1.4 (binary installer). What AM I doing wrong? -------- # grab image img=_grabwidget(container.fr) img.save("out.png") ##translate gray to white ##optionally make grayscale dib=ImageWin.Dib('RGB',img.size) dib.paste(img,None) # get DC try: hnum=win32print.OpenPrinter(pname) except: if prt: print 'failure OpenPrinter' return try: win32print.StartDocPrinter(hnum,1,('Test',None,None)) except: if prt: print 'failure startdocprint' ##win32print.WritePrinter(hnum,'This is a test\n') try: dc=win32ui.CreateDCFromHandle(hnum) except: if prt: print 'failure getting DC' return # output to DC hdc=dc.GetHandleAttrib() dib.expose(hdc) # close DC del dc win32print.EndDocPrinter(hnum) win32print.ClosePrinter(hnum) del dib del img From fredrik at pythonware.com Sat Jun 21 16:28:49 2003 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat Jun 21 09:28:59 2003 Subject: [Image-SIG] Re: Problem printing images via ImageWin References: <3EF2EB2F.10614.4F69BC6@localhost> Message-ID: howard@eegsoftware.com wrote: > I am trying to use the code snippet below to print images (under > Windows). The output file (out.png) is correctly saved but nothing ever > prints. When I uncomment out the WritePrinter command, the text prints > so I am *assuming* I opened the printer OK. > > It appears that expose function does not send anything to the printer > context. This is PIL.1.1.4 (binary installer). iirc, expose uses the BitBlt method, which is not supported by all printer drivers. try using the "draw" method instead: dib.draw(hdc, xy) where "xy" is a 4-tuple giving the (left, upper, right, lower) border, in printer coordinates. to check if this works, start with dib.draw(hdc, (0, 0) + img.size) and tweak as necessary. From wmcclain at salamander.com Mon Jun 23 11:25:51 2003 From: wmcclain at salamander.com (wmcclain@salamander.com) Date: Mon Jun 23 11:24:18 2003 Subject: [Image-SIG] background fill for rotate() Message-ID: <20030623102551.0637dd46.wmcclain@salamander.com> Hello. Searching the archives, I did not see this topic addressed: I'm using rotate() on 1-bit images, and the new areas created are filled with black. Is there any way to control this? I'd rather have white. My application: I'm deskewing scanned text pages for a facsimile reprint of an old astronomy book. -Bill -- Sattre Press Curiosities of the Sky http://sattre-press.com/ by Garrett Serviss info@sattre-press.com http://csky.sattre-press.com/ From schutte at fel.tno.nl Mon Jun 23 18:31:44 2003 From: schutte at fel.tno.nl (K Schutte) Date: Mon Jun 23 11:31:52 2003 Subject: [Image-SIG] background fill for rotate() References: <20030623102551.0637dd46.wmcclain@salamander.com> Message-ID: <3EF71D60.5391655E@fel.tno.nl> How about: invert - rotate - invert? This will give in inverted black == white. Klamer wmcclain@salamander.com wrote: > > Hello. Searching the archives, I did not see this topic addressed: > I'm using rotate() on 1-bit images, and the new areas created are filled > with black. Is there any way to control this? I'd rather have white. > > My application: I'm deskewing scanned text pages for a facsimile reprint > of an old astronomy book. > > -Bill > -- > Sattre Press Curiosities of the Sky > http://sattre-press.com/ by Garrett Serviss > info@sattre-press.com http://csky.sattre-press.com/ > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig -- Klamer Schutte, E-mail: Schutte@fel.tno.nl Electro-Optical Systems, TNO Physics and Electronics Laboratory Tel: +31-70-3740469 -- Fax: +31-70-3740654 -- Mobile: +31-6-51316671 From wmcclain at salamander.com Mon Jun 23 14:35:07 2003 From: wmcclain at salamander.com (wmcclain@salamander.com) Date: Mon Jun 23 14:33:36 2003 Subject: [Image-SIG] background fill for rotate() In-Reply-To: <3EF71D60.5391655E@fel.tno.nl> References: <20030623102551.0637dd46.wmcclain@salamander.com> <3EF71D60.5391655E@fel.tno.nl> Message-ID: <20030623133507.6538d7cd.wmcclain@salamander.com> On Mon, 23 Jun 2003 17:31:44 +0200 K Schutte wrote: > invert - rotate - invert? This will give in inverted black == white. Yes, that works. ImageOps.invert() doesn't work with mode "1", so I convert to mode "L" and back again afterwards. Thanks! In the past I have scripted netpbm utilties to do this sort of work. PIL is better! -Bill -- Sattre Press Curiosities of the Sky http://sattre-press.com/ by Garrett Serviss info@sattre-press.com http://csky.sattre-press.com/ From suresh_vsamy at rediffmail.com Wed Jun 25 08:07:27 2003 From: suresh_vsamy at rediffmail.com (Suresh Kumar) Date: Wed Jun 25 03:07:29 2003 Subject: [Image-SIG] Problem in storing tkinter canvas as PNG file using ImageGrab.grab Message-ID: <20030625070657.3209.qmail@mailweb34.rediffmail.com> Hi, Iam using python2.2/tkinter/windows. I have drawn some rectangles in my canvas. Now I want to store my canvas as a PNG file. Iam using "ImageGrab" to grab the canvas. Iam getting the result as i expected when the canvas size is less than "canvas.winfo_width" and "canvas.winfo_height". But when the size larger than that, iam not getting the entire canvas image. My coding is given below. import sys from Tkinter import * import Tkinter import ImageGrab canvas = Tkinter.Canvas(width=1600, height=1400) canvas.create_line(0, 0, 1600, 1400, fill="red", width=10) canvas.pack() canvas.update() if sys.platform == "win32": # get window location x0 = canvas.winfo_rootx() y0 = canvas.winfo_rooty() x1 = x0 + canvas.winfo_reqwidth() y1 = y0 + canvas.winfo_reqheight() im = ImageGrab.grab((20,20, x1,y1)) print "X1 : ",x1," Y1: ",y1 else: raise NotYetImplemented("oops!") im.show() im.save("c:\\outfile.png", "PNG") root = Tk() root.mainloop() How can i make the entire canvas as PNG file irrespective of its size? With Regards, V.Suresh Kumar ___________________________________________________ Get www. mycompany .com and 5 matching email ids. Just Rs. 1499/ year. Click here http://www.rediffmailpro.com From suresh_vsamy at rediffmail.com Wed Jun 25 18:15:06 2003 From: suresh_vsamy at rediffmail.com (Suresh Kumar) Date: Wed Jun 25 13:15:08 2003 Subject: [Image-SIG] Needs urgent solution................ Message-ID: <20030625171408.31501.qmail@webmail36.rediffmail.com> Hi Alfred, Thanks for your timing reply. I tried the program that is posted in the link given by you. It is working fine. Still i have a problem. In your program you limited the canvas size to 600,600. Since it is less than a normal screen iam getting the entire line wihich is drawn on the canvas. But if i increase the size of canvas to 2 pages, say casvas size is (1600,1500), i am not getting the entire canvas as a PNG file. My coding is given below. import sys from Tkinter import * import Tkinter import ImageGrab canvas = Tkinter.Canvas(width=1600, height=1400) canvas.create_line(0, 0, 1600, 1400, fill="red", width=10) canvas.pack() canvas.update() if sys.platform == "win32": # get window location x0 = canvas.winfo_rootx() y0 = canvas.winfo_rooty() x1 = x0 + canvas.winfo_reqwidth() y1 = y0 + canvas.winfo_reqheight() im = ImageGrab.grab((20,20, x1,y1)) print "X1 : ",x1," Y1: ",y1 else: raise NotYetImplemented("oops!") im.show() im.save("c:\\outfile.png", "PNG") root = Tk() root.mainloop() The above code is not capturing the canvas of size (1600,1400). How can i make the entire canvas as PNG file irrespective of its size? With Regards, V.Suresh Kumar On Wed, 25 Jun 2003 Alfred Milgrom wrote : >At 01:04 PM 24/06/03 +0000, Suresh Kumar wrote: >>Hi, >> >> I am using python/tkinter/windows. How to store tkinter >>canvas screen as a PNG file? I have drawn some rectangles in >>my >>canvas and i want to store it as a PNG file so that i can use >>it >>for further processing. How can i do it? >> >>Thanx. > >Hi: > >I was asking a similar question just a short while ago, got >very >good advice from Magnus Lycka, and I posted my research on >specifically grabbing Tkinter canvas on 19/6: >http://mail.python.org/pipermail/tutor/2003-June/023456.html > >Basically the answer lies in the ImageGrab module available in >the PIL library. PIL is available from >http://www.pythonware.com/products/pil/index.htm#pil114 > >Info on Tkinter grabbing is available at >http://mail.python.org/pipermail/image-sig/2003-May/002292.html > >All the best, >Fred Milgrom > ___________________________________________________ Get www. mycompany .com and 5 matching email ids. Just Rs. 1499/ year. Click here http://www.rediffmailpro.com From dk at lucidstrategies.net Wed Jun 25 14:41:07 2003 From: dk at lucidstrategies.net (Dave Kelly) Date: Wed Jun 25 14:41:11 2003 Subject: [Image-SIG] GIF paste / mask question Message-ID: Hello. I have a widget I've created that displays an animated GIF, and I'm using PIL to step through and read each frame into a sequence. The problem I'm having is that any frames with transparency are not being displayed correctly...the transparent areas are coming through as whatever color they are in the palette. What I think I need to do is get the transparency value from info['transparency'], and then create a mask out of just those pixels that are transparent. Then I can paste each frame onto the previous with the transparency mask, and it _should_ display correctly. This is my theory anyway. (Which, by the way, if anyone has any insight into the correct way to display animated GIF frames, I'd love to hear it, because the GIF spec didn't really help my understanding any...do I layer each one over the previous, or do I do a full redraw, or just redraw those areas that are different??) The problem I have is that I really don't understand very well how to generate a mask...I've looked at the documentation for the Image.point() command, but I can't seem to make it do what I want. So say my info['transparency'] value is 56 (arbitrarily). How would I generate a mask out of my image so that when I paste, anything pixels that map to 56 in the palette table are not pasted? My widget works great for animated GIF's where each frame is a full picture the same size as the original. Unfortunately, not very many animated GIF's do this...most are compressed and use transparency. Thanks in advance for any help!! -D From fredrik at pythonware.com Wed Jun 25 23:14:04 2003 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Jun 25 16:24:39 2003 Subject: [Image-SIG] Re: Problem in storing tkinter canvas as PNG file usingImageGrab.grab References: <20030625070657.3209.qmail@mailweb34.rediffmail.com> Message-ID: Suresh Kumar wrote: > Iam using python2.2/tkinter/windows. I have drawn some > rectangles in my canvas. Now I want to store my canvas as a PNG > file. Iam using "ImageGrab" to grab the canvas. Iam getting the > result as i expected when the canvas size is less than > "canvas.winfo_width" and "canvas.winfo_height". But when the > size larger than that, iam not getting the entire canvas image. I'm not sure I follow -- are you trying to say that you've created a canvas that's larger than the screen? Obviously, the ImageGrab approach doesn't work in that case, since it copies pixels from the display. Some alternatives: - use the Postscript generation mechanisms provided by the Canvas widget, and use Ghostscript or some other postscript renderer to con- vert from postscript to PNG. - or with more work, but less dependencies, use PIL's ImageDraw module (or some other 2D drawing interface) and re-render the canvas contents directly into a pixmap. - or scroll the canvas around (xview, yview), use the update method to make sure it's redrawn, and use ImageGrab to cut out the pieces, and paste them into a full-size image. From fredrik at pythonware.com Wed Jun 25 23:06:01 2003 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Jun 25 16:30:49 2003 Subject: [Image-SIG] Re: GIF paste / mask question References: Message-ID: Dave Kelly wrote: > So say my info['transparency'] value is 56 (arbitrarily). How would I > generate a mask out of my image so that when I paste, anything pixels > that map to 56 in the palette table are not pasted? here's one way to do it: table = [255]*256 table[56] = 0 # don't want this one mask = image.point(table, "1") # make a bilevel mask From suresh_vsamy at rediffmail.com Thu Jun 26 11:26:21 2003 From: suresh_vsamy at rediffmail.com (Suresh Kumar) Date: Thu Jun 26 06:26:22 2003 Subject: [Image-SIG] Storing tkinter canvas as PNG file......... Message-ID: <20030626102517.27409.qmail@webmail35.rediffmail.com> Hi, Thanks Fredrik. I got it. I converted my cansvas to Postscript format. I need one more solution that could complete my project. How can i convert a postscript file to PNG or BMP file in Python? The problem with Postscript format is we need Ghostscript viewer to view the Postcript image which we have to install separately. Since most of the systems running under Windows OS have "Microsoft Photo Editor", it would be nice to have a PNG file rather than PostScript file. I tried with "Image" module to open a ".ps" file and save it in ".png" format. But i didnt work and i got some errors. Now how can i convert a postscript file to PNG or BMP file in Python? With regrads, V.Suresh Kumar ___________________________________________________ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com From suresh_vsamy at rediffmail.com Thu Jun 26 12:51:58 2003 From: suresh_vsamy at rediffmail.com (Suresh Kumar) Date: Thu Jun 26 07:51:59 2003 Subject: [Image-SIG] Converting ".PS" file to ".PNG" in python Message-ID: <20030626115030.16993.qmail@webmail26.rediffmail.com> Hi, Thanks Fredrik. I got it. I converted my cansvas to Postscript format. I need one more solution that could complete my project. How can i convert a postscript file to PNG or BMP file in Python? The problem with Postscript format is we need Ghostscript viewer to view the Postcript image which we have to install separately. Since most of the systems running under Windows OS have "Microsoft Photo Editor", it would be nice to have a PNG file rather than PostScript file. I tried with "Image" module to open a ".ps" file and save it in ".png" format. But i didnt work and i got some errors. Now how can i convert a postscript file to PNG or BMP file in Python? With regrads, V.Suresh Kumar ___________________________________________________ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com From sherwin at lhc.nlm.nih.gov Fri Jun 27 16:58:38 2003 From: sherwin at lhc.nlm.nih.gov (Ziying Sherwin) Date: Fri Jun 27 15:59:14 2003 Subject: [Image-SIG] error compiling PIL 1.1.4 on Solaris 2.8 with python 2.2.3 Message-ID: We are trying to build Python Imaging Library(PIL 1.1.4) with Python 2.2.3 and gcc 3.3 on our Solaris 2.8 machine. Everything went on smoothly until when we tried to build dynamic library at the top level directory. We got the following error messages: gcc -shared ./_imaging.o ./decode.o ./encode.o ./map.o ./display.o ./outline.o ./path.o libImaging/libImaging.a -L/depot/lib -ljpeg -L/depot/lib -lz -o ./_imaging.so Text relocation remains referenced against symbol offset in file 0x168 libImaging/libImaging.a(Unpack.o) 0x16c libImaging/libImaging.a(Unpack.o) 0x170 libImaging/libImaging.a(Unpack.o) 0x174 libImaging/libImaging.a(Unpack.o) 0x178 .... libImaging/libImaging.a(ZipDecode.o) inflateInit_ 0xa4 libImaging/libImaging.a(ZipDecode.o) inflateEnd 0x410 libImaging/libImaging.a(ZipDecode.o) 0x178 libImaging/libImaging.a(ZipEncode.o) 0x17c libImaging/libImaging.a(ZipEncode.o) deflateInit2_ 0x194 libImaging/libImaging.a(ZipEncode.o) deflate 0x70c libImaging/libImaging.a(ZipEncode.o) deflate 0x7b8 libImaging/libImaging.a(ZipEncode.o) ld: fatal: relocations remain against allocatable but non-writable sections collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `_imaging.so' So we have to manually compile the dynamic library by using the command: ld -G ./decode.o ./encode.o ./map.o ./display.o ./outline.o ./path.o -L./libImaging -L/depot/lib -R/depot/lib -ljpeg -L/depot/lib -lz -o ./_imaging.so ./_imaging.o -lImaging -lc -L/depot/package/python_2.2.3/lib/python2.2/config -lpython2.2 -lm -ldl It compiled, but if we tried to test the build by import the library, we got the following error message: nob[root]csh:410>nob[root]csh:410>python Python 2.2.3 (#6, Jun 26 2003, 17:11:25) [GCC 3.3] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import _imaging Traceback (most recent call last): File "", line 1, in ? ImportError: ld.so.1: python: fatal: relocation error: file ./_imaging.so: symbol deflateSetDictionary: referenced symbol not found Any ideas how we can fix it? Thanks in advance. Ziying Sherwin From howard at eegsoftware.com Fri Jun 27 14:21:32 2003 From: howard at eegsoftware.com (Howard Lightstone) Date: Fri Jun 27 16:20:30 2003 Subject: [Image-SIG] Printing under Windows98 using ImageWin Message-ID: <3EFC44DC.18769.46125B2@localhost> I am still pretty baffled about this. I am using ImageWin.draw() to try drawing an RGB image to a device context (acquired from win32print/win32ui). I am *pretty* sure the handle opened ok because WritePrinter commands cause actual data to appear on the printer. I use win32ui.CreateDCFromHandle() to create a DC from the printer handle. Then I use GetHandleAttrib() on the DC to get something back to write to using the DIB draw() method. (This scheme comes from examples I may or may not have seen somewhere and from comments in the ImageWin code. It does seem complicated but using the printer handle from win32printer.OpenPrinter directly also does not work). Nothing prints. The result back from StretchDIBits (in DIB.c/ImagingDrawDIB) is a positive number (of scan lines), leading me to believe that Windows wasn't complaining. Where did the data go? I am assuming that I have some clipping/coordinate problem but it is pretty baffling. Any ideas where to search next?