From luc tonin" well i ve got an python method. It works when i do a python mymethod.py myparameter but when i use it in zope as an external method i ve got this error mesg: Error Type: IOError Error Value: cannot find glyph data file don t know why...... From hannu@tm.ee Wed Jan 3 18:48:25 2001 From: hannu@tm.ee (Hannu Krosing) Date: Wed, 03 Jan 2001 18:48:25 +0000 Subject: [Image-SIG] probleme with PIL and zope References: <070501c07594$557e8b20$6200a8c0@longwy> Message-ID: <3A5373F9.D6A772CA@tm.ee> luc tonin wrote: > > well i ve got an python method. It works when i do a python mymethod.py > myparameter > but when i use it in zope as an external method i ve got this error mesg: > Error Type: IOError > Error Value: cannot find glyph data file > > don t know why...... > Maybe it can't find glyph data file ;) When run in zope, the current dir is not the same as when running from command line, so you should either move the file or use full path for specifying it. -------------- Hannu From Massimo Cavallini Tue Jan 9 13:15:16 2001 From: Massimo Cavallini (Massimo Cavallini) Date: 09 Jan 2001 14:15:16 +0100 Subject: [Image-SIG] PIL on HP-UX Message-ID: <914410865cavallini.m@mmfg.it> Hi, I get this error while configuring PIL on HP-UX: test69:/sviluppo/python152/Imaging-1.1.1/libImaging # ./configure loading cache ./config.cache checking for --without-gcc... no checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... yes checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking for ranlib... ranlib checking for ar... ar checking MACHDEP... hp-uxB checking for jpeg_destroy_compress in -ljpeg... no checking for deflate in -lz... no checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for inline... inline checking whether byte ordering is bigendian... configure: error: can not = run test program while cross compiling Can anybody help me? Best regards From fredrik@pythonware.com Tue Jan 9 13:25:27 2001 From: fredrik@pythonware.com (Fredrik Lundh) Date: Tue, 9 Jan 2001 14:25:27 +0100 Subject: [Image-SIG] PIL on HP-UX References: <914410865cavallini.m@mmfg.it> Message-ID: <002101c07a3f$a1a94fd0$0900a8c0@SPIFF> Massimo wrote: > checking whether the C compiler (gcc ) is a cross-compiler... yes > checking whether byte ordering is bigendian... > configure: error: can not run test program while cross compiling this means that gcc cannot compile, link and run a trivial C program. check your gcc installation, or use the "--without-gcc" option to con- figure (use "./configure --help" to get more info). (looking in the config.log file may also help). regards /F From jonathan.gilligan@vanderbilt.edu Tue Jan 9 21:37:19 2001 From: jonathan.gilligan@vanderbilt.edu (Jonathan M. Gilligan) Date: Tue, 09 Jan 2001 15:37:19 -0600 Subject: [Image-SIG] Histograms: Bug or feature? Message-ID: <5.0.2.1.0.20010109150448.03ec7e80@g.mail.vanderbilt.edu> If img is an image with mode='I' (i.e., 32-bit grayscale), then i.histogram() returns an object of length 256. I was hoping to use the histogram method to do quick normalization of 12-bit grayscale images captured from a video camera. Example: >>> from PIL import Image >>> img = Image.new('I', (255,255), (1 << 11) - 1) >>> img.getpixel((0,0)) 2047 >>> h = img.histogram() >>> len(h) 256 >>> for i in range(len(h)): ... if h[i] > 0: ... print i, h[i] ... >>> In other words, the histogram is all zeroes. Is this a bug in the histogram routine or is it the intended behavior? I see this behavior with both PIL 1.1 and PIL 1.1.1, with Python 2.0 under Win98 and WinNT. The PIL manual does not explain what to expect here. Thanks for any guidance, Jonathan =========================================================================== Jonathan M. Gilligan From jpl@global.co.za Sat Jan 13 17:02:55 2001 From: jpl@global.co.za (James Lockley) Date: Sat, 13 Jan 2001 19:02:55 +0200 Subject: [Image-SIG] re: _imagingtk Message-ID: <000e01c07d82$ac73bae0$2c829e89@poseidon> This is a multi-part message in MIME format. ------=_NextPart_000_000B_01C07D93.6FCE9D10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable hi=20 i am probably doing something very simple very wrong... to try out PIL i tried running the sample script "scripts/viewer.py" . each time getting this error message: File "c:\python20\pil\ImageTk.py", line 123, in paste import _imagingtk ImportError: No module named _imagingtk i've looked for the module in the original files i downloaded but could = only find "_imagingtk.c" in the source distribution... ( am using python 2.0 (BeOpen binary distribution) with NumPy 17, Pil = (from pil111py.zip + _imaging.dll) and win32all (build 135) on winnt4) thanks james ------=_NextPart_000_000B_01C07D93.6FCE9D10 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
hi
i am probably doing something very = simple very=20 wrong...
 
to try out PIL i tried = running the sample=20 script "scripts/viewer.py" .
 
each time getting this error = message:
 
  File = "c:\python20\pil\ImageTk.py",=20 line 123, in paste
    import = _imagingtk
ImportError: No=20 module named _imagingtk
 
i've looked for the module in the = original files i=20 downloaded but could only find "_imagingtk.c"  in the=20 source distribution...
 
( am using python 2.0 (BeOpen = binary=20 distribution) with NumPy 17, Pil (from pil111py.zip + _imaging.dll) and = win32all=20 (build 135) on winnt4)
 
thanks
james
------=_NextPart_000_000B_01C07D93.6FCE9D10-- From brady@mmm.com Tue Jan 16 00:32:45 2001 From: brady@mmm.com (mark brady) Date: Mon, 15 Jan 2001 16:32:45 -0800 Subject: [Image-SIG] PIL and Tk PhotoImage Message-ID: The following simple program is supposed to read an image using PIL and then convert it into a Tkinter PhotoImage (Running on a Mac): from Image import * from Tkinter import * im = open("lena.jpg") im.load() tkIm = PhotoImage(im) Instead, it chokes on the last line, giving the following error message: Traceback (most recent call last): File "Macintosh HD:Applications:Python 2.0:MyToys:MakeTkImage", line 6, in ? tkIm = PhotoImage(im) File "macintosh hd:applications:python 2.0:lib:lib-tk:Tkinter.py", line 2974, in __init__ apply(Image.__init__, (self, 'photo', name, cnf, master), kw) File "macintosh hd:applications:python 2.0:lib:lib-tk:Tkinter.py", line 2915, in __init__ raise RuntimeError, 'Too early to create image' RuntimeError: Too early to create image Why is it too early to create the image? -Mark From nick@nickbower.com Tue Jan 16 01:53:29 2001 From: nick@nickbower.com (Nick Bower) Date: Tue, 16 Jan 2001 01:53:29 GMT Subject: [Image-SIG] PIL and Tk PhotoImage In-Reply-To: References: Message-ID: <20010116.1532900@cricket.> Mark, There's a little more to it than this (unless it changed for Python 2.0)= .=20 PhotoImage is a Tk widget, so must be considered in this framework, not= =20 out on its own like your example program. I got the same error as you have when figuring this all out, but solved = it by playing around with the order of creating a photoimage, canvas,=20 etc. Below is the starting section of code of a Tk Viewport object I use in=20 the Python Data Language (PyDL). You can play around with the order of = things. You'll notice I'm not supplying the PIL image to PhotoImage on = construction, but instead later after it has been embedded in a canvas. = =20 I can't remember whether you can do the former. nick=20 class TkViewport(Frame): def __init__(self, parent, xsize, ysize, title): =20 self.toplevel =3D parent self.xsize =3D xsize self.ysize =3D ysize self.hasdata =3D 0 Frame.__init__(self, parent) self.pack() self.master.title(title) self.imagecanvas =3D Canvas(self, width=3Dxsize, height=3Dysize) self.imagecanvas.pack(side=3DBOTTOM) self.tkimage =3D ImageTk.PhotoImage('P',(self.xsize,self.ysize)) =20 self.imagecanvas.create_image(self.xsize/2,self.ysize/2,image=3Dself.tki= ma ge) then later... self.tkimage.paste(Image.new('P',(400,400))) >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 1/16/01, 8:32:45 AM, mark brady wrote regarding=20 [Image-SIG] PIL and Tk PhotoImage: > The following simple program is supposed to read an image > using PIL and then convert it into a Tkinter PhotoImage (Running > on a Mac): > from Image import * > from Tkinter import * > im =3D open("lena.jpg") > im.load() > tkIm =3D PhotoImage(im) > Instead, it chokes on the last line, giving the following error messag= e: > Traceback (most recent call last): > File "Macintosh HD:Applications:Python 2.0:MyToys:MakeTkImage",= =20 line > 6, in ? > tkIm =3D PhotoImage(im) > File "macintosh hd:applications:python 2.0:lib:lib-tk:Tkinter.p= y", > line 2974, in __init__ > apply(Image.__init__, (self, 'photo', name, cnf, master), k= w) > File "macintosh hd:applications:python 2.0:lib:lib-tk:Tkinter.p= y", > line 2915, in __init__ > raise RuntimeError, 'Too early to create image' > RuntimeError: Too early to create image > Why is it too early to create the image? > -Mark > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig From fredrik@pythonware.com Tue Jan 16 09:49:51 2001 From: fredrik@pythonware.com (Fredrik Lundh) Date: Tue, 16 Jan 2001 10:49:51 +0100 Subject: [Image-SIG] PIL and Tk PhotoImage References: Message-ID: <030601c07fa1$aca683f0$0900a8c0@SPIFF> mark wrote: > The following simple program is supposed to read an image > using PIL and then convert it into a Tkinter PhotoImage (Running > on a Mac): > > from Image import * > from Tkinter import * > > im = open("lena.jpg") > im.load() > tkIm = PhotoImage(im) this won't work: you must use the PIL-aware PhotoImage class from the ImageTk module, not the class with the same name from Tkinter... > RuntimeError: Too early to create image > > Why is it too early to create the image? you need to create a Tk instance first (this initializes the Tcl and Tk subsystems). > from Image import * > from Tkinter import * + import ImageTk > + root = Tk() + root.withdraw() # no root window yet > > im = open("lena.jpg") > im.load() # not really necessary > tkIm = ImageTk.PhotoImage(im) Hope this helps! Cheers /F From bh@intevation.de Tue Jan 16 11:29:52 2001 From: bh@intevation.de (Bernhard Herzog) Date: 16 Jan 2001 12:29:52 +0100 Subject: [Image-SIG] PNG Decoder Bug Message-ID: <6qu26zivkf.fsf@abnoba.intevation.de> PIL has problems decoding some PNG files. An image which PIL fails to load can be found at http://intevation.de/~bh/6x2.png . The error message I get is: >>> import Image >>> i = Image.open("6x2.png") >>> i.load() Traceback (innermost last): File "", line 1, in ? File "/usr/lib/python1.5/site-packages/PIL/ImageFile.py", line 161, in load raise IOError, "decoder error %d when reading image file" % e IOError: decoder error -3 when reading image file I reported this bug before (or at least a very similar one) back in 1999 ( http://mail.python.org/pipermail/image-sig/1999-October/000892.html ) but I ran into it again now. Perhaps someone should set up a bug tracker so such bugs aren't forgotten. Bernhard -- Intevation GmbH http://intevation.de/ Sketch http://sketch.sourceforge.net/ MapIt! http://mapit.de/ From fredrik@pythonware.com Tue Jan 16 11:46:37 2001 From: fredrik@pythonware.com (Fredrik Lundh) Date: Tue, 16 Jan 2001 12:46:37 +0100 Subject: [Image-SIG] PNG Decoder Bug References: <6qu26zivkf.fsf@abnoba.intevation.de> Message-ID: <03fe01c07fb1$fc5b6180$0900a8c0@SPIFF> bernhard wrote: > PIL has problems decoding some PNG files. An image which PIL fails to > load can be found at http://intevation.de/~bh/6x2.png . /.../ > IOError: decoder error -3 when reading image file > > I reported this bug before (or at least a very similar one) back in 1999 > ( http://mail.python.org/pipermail/image-sig/1999-October/000892.html ) > but I ran into it again now. Perhaps someone should set up a bug tracker > so such bugs aren't forgotten. well, it's a known and documented bug. from the "Image File Formats" chapter: The library identifies, reads, and writes PNG files containing "1", "L", "P", "RGB", or "RGBA" data. Interlaced files are currently not supported. Cheers /F From bh@intevation.de Tue Jan 16 12:54:10 2001 From: bh@intevation.de (Bernhard Herzog) Date: 16 Jan 2001 13:54:10 +0100 Subject: [Image-SIG] PNG Decoder Bug In-Reply-To: "Fredrik Lundh"'s message of "Tue, 16 Jan 2001 12:46:37 +0100" References: <6qu26zivkf.fsf@abnoba.intevation.de> <03fe01c07fb1$fc5b6180$0900a8c0@SPIFF> Message-ID: <6qae8rk68d.fsf@abnoba.intevation.de> "Fredrik Lundh" writes: > bernhard wrote: > > > PIL has problems decoding some PNG files. An image which PIL fails to > > load can be found at http://intevation.de/~bh/6x2.png . > > /.../ > > > IOError: decoder error -3 when reading image file > > > > I reported this bug before (or at least a very similar one) back in 1999 > > ( http://mail.python.org/pipermail/image-sig/1999-October/000892.html ) > > but I ran into it again now. Perhaps someone should set up a bug tracker > > so such bugs aren't forgotten. > > well, it's a known and documented bug. > > from the "Image File Formats" chapter: > The library identifies, reads, and writes PNG files containing > > "1", "L", "P", "RGB", or "RGBA" data. Interlaced files are currently > > not supported. Ok, I should have been more specific. The file in question was generated by PIL and is not interlaced. PIL can read most of the other files generated with the same parameters flawlessly. I know about the limitation to non-interlaced PNGs. That's why I linked to the last post in the thread. Its last paragraph is probably the same problem I have now. As Andrew Kuchling had pointed out back then, it might be a zlib bug. I tried to read the file with other programs (netscape, gimp, pngtopnm, gqview) and none have problems with it, but as far as I know all of them use libpng, so that doesn't really prove anything. Bernhard -- Intevation GmbH http://intevation.de/ Sketch http://sketch.sourceforge.net/ MapIt! http://mapit.de/ From fredrik@pythonware.com Tue Jan 16 12:49:45 2001 From: fredrik@pythonware.com (Fredrik Lundh) Date: Tue, 16 Jan 2001 13:49:45 +0100 Subject: [Image-SIG] PNG Decoder Bug References: <6qu26zivkf.fsf@abnoba.intevation.de> <03fe01c07fb1$fc5b6180$0900a8c0@SPIFF> Message-ID: <043601c07fba$ce24b290$0900a8c0@SPIFF> oops. the end of my previous mail should have been: well, it's a known and documented bug. from the "Image File Formats" chapter, the PNG section: "The library identifies, reads, and writes PNG files containing "1", "L", "P", "RGB", or "RGBA" data. Interlaced files are currently not supported. And yes, it's also in our internal bug database. I'm afraid there's no ETA for a fix, though (had it been easy to fix, I would have added it when I first implemented PNG support...) Cheers /F From mathe@exatas.unisinos.br Tue Jan 16 18:59:34 2001 From: mathe@exatas.unisinos.br (Carlos Moreira) Date: Tue, 16 Jan 2001 16:59:34 -0200 Subject: [Image-SIG] A Pil Doubt Message-ID: <3A649A15.BECDFA63@exatas.unisinos.br> Hi, I need some help. How I can, in Python Imaging Library, create a transparent GIF? ======================== Carlos Eduardo Souza Moreira Another GNU/Linux User Powered by Debian GNU/Linux A Python Programmer ======================== From douglas@paradise.net.nz Wed Jan 17 03:17:14 2001 From: douglas@paradise.net.nz (Douglas Bagnall) Date: Wed, 17 Jan 2001 16:17:14 +1300 Subject: [Image-SIG] A Pil Doubt Message-ID: <3A65C58A.10753.5D1326@localhost> Carlos Moreira asks: > Hi, > > I need some help. How I can, in Python Imaging Library, create a > transparent GIF? tsk,tsk.. it's illegal you know. I managed it by using a modifed version of the _save_netpbm function in /PIL/GifImagePlugin.py, which uses the external but common and free netpbm library. I only wanted white as a transparent colour, so I hard-coded in the '#FFFFFF'. Everything except " -transparent '#FFFFFF' " is straight out of PIL. douglas def _save_netpbm_trans(im, fp, filename): import os file = im._dump() if im.mode != "RGB": os.system("ppmtogif -transparent '#FFFFFF' %s >%s" % (file, filename)) else: os.system("ppmquant 256 %s | ppmtogif -transparent '#FFFFFF' >%s" % (file, filename)) try: os.unlink(file) except: pass Image.register_save("GIF", _save_netpbm_trans) #sets PIL to use proper GIF compression ------- End of forwarded message ------- From echuck@mindspring.com Fri Jan 19 16:01:53 2001 From: echuck@mindspring.com (Chuck Esterbrook) Date: Fri, 19 Jan 2001 11:01:53 -0500 Subject: [Image-SIG] Image quality when resizing Message-ID: <5.0.2.1.0.20010119105249.04ed8b60@mail.mindspring.com> Hi, I'm using PIL 1.1.1 on Linux Mandrake 7.0 (equiv to RedHat 6.2) with Py 1.5.2. I notice that when I resize() photographic images to be smaller, the quality of the image looks rather poor compared to doing the same operation in a desktop application such as Jasc's Paint Shop Pro 6 or Adobe's Photoshop. Typically an image is 200-600 pixels per side and gets resized down to a width 130 with aspect ratio preserved. A typical format would be 24-bit JPEG. I tried all three resize arguments: NEAREST, BILINEAR, or BICUBIC. Is anyone aware of this problem and its status? If not, then I can post sample images and code. The reason this is important is that I'm automating some of the image processing for a web site. However, if the automation results in lower quality images than the manual process, it won't be accepted. -Chuck From hannu@tm.ee Sun Jan 21 14:47:26 2001 From: hannu@tm.ee (Hannu Krosing) Date: Sun, 21 Jan 2001 16:47:26 +0200 Subject: [Image-SIG] Image quality when resizing References: <5.0.2.1.0.20010119105249.04ed8b60@mail.mindspring.com> Message-ID: <3A6AF67E.3D4247E7@tm.ee> Chuck Esterbrook wrote: > > Hi, > > I'm using PIL 1.1.1 on Linux Mandrake 7.0 (equiv to RedHat 6.2) with Py 1.5.2. > > I notice that when I resize() photographic images to be smaller, the > quality of the image looks rather poor compared to doing the same operation > in a desktop application such as Jasc's Paint Shop Pro 6 or Adobe's > Photoshop. Typically an image is 200-600 pixels per side and gets resized > down to a width 130 with aspect ratio preserved. A typical format would be > 24-bit JPEG. > > I tried all three resize arguments: NEAREST, BILINEAR, or BICUBIC. > > Is anyone aware of this problem and its status? > > If not, then I can post sample images and code. > > The reason this is important is that I'm automating some of the image > processing for a web site. However, if the automation results in lower > quality images than the manual process, it won't be accepted. You could try to automate it using Gimp if quality is paramount and PIL can't offer acceptable quality. AFAIK it has python scripting support. -------------- Hannu From echuck@mindspring.com Sun Jan 21 15:56:30 2001 From: echuck@mindspring.com (Chuck Esterbrook) Date: Sun, 21 Jan 2001 10:56:30 -0500 Subject: [Image-SIG] Image quality when resizing In-Reply-To: <3A6AF67E.3D4247E7@tm.ee> References: <5.0.2.1.0.20010119105249.04ed8b60@mail.mindspring.com> Message-ID: <5.0.2.1.0.20010121105205.0212fe70@mail.mindspring.com> At 04:47 PM 1/21/2001 +0200, Hannu Krosing wrote: >You could try to automate it using Gimp if quality is paramount and PIL >can't offer acceptable quality. > >AFAIK it has python scripting support. > >-------------- >Hannu That's a good point and in fact, I took a crack at this. I was able to get PIL up and running in less than 60 minutes. After 3 hours with GIMP I still couldn't get it to invoke from the command line let alone from Python. Apparently GIMP is lost without an active X server that belongs to the user invoking GIMP (and my Linux machine is remote). I have no idea why this is a requirement. They have documented a trick for getting around this, but it failed me on Mandrake Linux 7.0. So I thought I would come back to PIL to see how active and supported it was. If things look pretty dry, then I'll go back to GIMP. Thanks for the suggestion, -Chuck From jmr@everest.radiology.uiowa.edu Sun Jan 21 17:24:39 2001 From: jmr@everest.radiology.uiowa.edu (Joe Reinhardt) Date: 21 Jan 2001 11:24:39 -0600 Subject: [Image-SIG] Image quality when resizing In-Reply-To: <5.0.2.1.0.20010119105249.04ed8b60@mail.mindspring.com> References: <5.0.2.1.0.20010119105249.04ed8b60@mail.mindspring.com> Message-ID: >>>>> "CE" == Chuck Esterbrook writes: CE> If not, then I can post sample images and code. It would be interesting to see the examples. If they are too big, can you post a URL? -- Joseph M. Reinhardt, Ph.D. Department of Biomedical Engineering joe-reinhardt@uiowa.edu 1402 SC Telephone: 319-335-5634 University of Iowa FAX: 319-335-5631 Iowa City, IA 52242 From hannu@tm.ee Sun Jan 21 19:19:39 2001 From: hannu@tm.ee (Hannu Krosing) Date: Sun, 21 Jan 2001 21:19:39 +0200 Subject: [Image-SIG] Image quality when resizing References: <5.0.2.1.0.20010119105249.04ed8b60@mail.mindspring.com> <5.0.2.1.0.20010121105205.0212fe70@mail.mindspring.com> Message-ID: <3A6B364B.AA93E710@tm.ee> Chuck Esterbrook wrote: > > At 04:47 PM 1/21/2001 +0200, Hannu Krosing wrote: > >You could try to automate it using Gimp if quality is paramount and PIL > >can't offer acceptable quality. > > > >AFAIK it has python scripting support. > > > >-------------- > >Hannu > > That's a good point and in fact, I took a crack at this. I was able to get > PIL up and running in less than 60 minutes. After 3 hours with GIMP I still > couldn't get it to invoke from the command line let alone from Python. > Apparently GIMP is lost without an active X server that belongs to the user > invoking GIMP (and my Linux machine is remote). I have no idea why this is > a requirement. They have documented a trick for getting around this, but it > failed me on Mandrake Linux 7.0. > > So I thought I would come back to PIL to see how active and supported it > was. If things look pretty dry, then I'll go back to GIMP. Actually I remember I got quite good results from PIL a few years ago. Are you sure that you are doing the conversion on RGB (and not palette) images ? You could try applying a slight blur before conversion to get nicer looking pictures even for NEAREST but you still need to do it in RGB space. ------------- Hannu From echuck@mindspring.com Sun Jan 21 19:24:21 2001 From: echuck@mindspring.com (Chuck Esterbrook) Date: Sun, 21 Jan 2001 14:24:21 -0500 Subject: [Image-SIG] Image quality when resizing In-Reply-To: <3A6B364B.AA93E710@tm.ee> References: <5.0.2.1.0.20010119105249.04ed8b60@mail.mindspring.com> <5.0.2.1.0.20010121105205.0212fe70@mail.mindspring.com> Message-ID: <5.0.2.1.0.20010121142204.02137300@mail.mindspring.com> At 09:19 PM 1/21/2001 +0200, Hannu Krosing wrote: >Actually I remember I got quite good results from PIL a few years ago. I thought my PIL results looked good too until someone showed me a resize in Photoshop after which I tried it in Paint Shop Pro and GIMP. PIL loses to all of them. >Are you sure that you are doing the conversion on RGB (and not palette) >images ? Yes, in fact, I'm putting together the samples now. The original image is a 24 bit RGB jpeg. >You could try applying a slight blur before conversion to get nicer >looking pictures even for NEAREST but you still need to do it in RGB space. Even with other packages you often need to tweak the resulting image (never tried tweaking the original), but I'd prefer to have a good resize() first rather than having to concoct a recipe for it. I'll post my samples shortly. Thanks, -Chuck From echuck@mindspring.com Sun Jan 21 19:30:07 2001 From: echuck@mindspring.com (Chuck Esterbrook) Date: Sun, 21 Jan 2001 14:30:07 -0500 Subject: [Image-SIG] PILResizeQuality.tar.gz Message-ID: <5.0.2.1.0.20010121142730.02130ec0@mail.mindspring.com> This comes with the original image, resize samples from PIL & PSP, source code and a README, 184KB: ftp://webware.sourceforge.net/pub/webware/PILResizeQuality.tar.gz Take a look, if you dare... -Chuck From fredrik@effbot.org Wed Jan 24 15:21:59 2001 From: fredrik@effbot.org (Fredrik Lundh) Date: Wed, 24 Jan 2001 16:21:59 +0100 Subject: [Image-SIG] Image quality when resizing References: <5.0.2.1.0.20010119105249.04ed8b60@mail.mindspring.com> <5.0.2.1.0.20010121105205.0212fe70@mail.mindspring.com> <5.0.2.1.0.20010121142204.02137300@mail.mindspring.com> Message-ID: <050501c08619$66250360$e46940d5@hagrid> Chuck wrote: > >You could try applying a slight blur before conversion to get nicer > >looking pictures even for NEAREST but you still need to do it in RGB space. > > Even with other packages you often need to tweak the resulting image > (never ried tweaking the original), but I'd prefer to have a good resize() > first rather than having to concoct a recipe for it. the correct approach would be to apply a suitable lowpass filter, and then use NEAREST on the result. unfortunately, PIL doesn't support that (yet). here's a brute-force method that might give you somewhat better results: # pseudocode im = Image.open("...") im.draft("RGB", target size) # optional while im.size > target size * 2: im = im.resize(im.size / 2, Image.BILINEAR) thumbnail = im.resize(target size, Image.BILINEAR) (sorry, no time to turn that into a real python script, nor to try it on your samples. maybe later this week) Cheers /F From jmr@everest.radiology.uiowa.edu Thu Jan 25 02:02:32 2001 From: jmr@everest.radiology.uiowa.edu (Joe Reinhardt) Date: 24 Jan 2001 20:02:32 -0600 Subject: [Image-SIG] Image quality when resizing In-Reply-To: <050501c08619$66250360$e46940d5@hagrid> References: <5.0.2.1.0.20010119105249.04ed8b60@mail.mindspring.com> <5.0.2.1.0.20010121105205.0212fe70@mail.mindspring.com> <5.0.2.1.0.20010121142204.02137300@mail.mindspring.com> <050501c08619$66250360$e46940d5@hagrid> Message-ID: >>>>> "FL" == Fredrik Lundh writes: FL> the correct approach would be to apply a suitable lowpass FL> filter, and then use NEAREST on the result. FL> unfortunately, PIL doesn't support that (yet). Wouldn't import ImageFilter imout = im.filter(ImageFilter.BLUR) do the job? - Joe -- Joseph M. Reinhardt, Ph.D. Department of Biomedical Engineering joe-reinhardt@uiowa.edu 1402 SC Telephone: 319-335-5634 University of Iowa FAX: 319-335-5631 Iowa City, IA 52242 From brady@mmm.com Thu Jan 25 19:39:12 2001 From: brady@mmm.com (mark brady) Date: Thu, 25 Jan 2001 11:39:12 -0800 Subject: [Image-SIG] Tkinter bug Message-ID: There seems to be bug in Tkinter regarding canvas cursor locations. The following code prints the cursor location when the mouse is clicked in a scrollable canvas which is in a frame: def drawCallback(event): canvas = event.widget x = canvas.canvasx(event.x) y = canvas.canvasy(event.y) print "clicked at", int(x+.5), int(y+.5) Before scrolling there seems to be an offset of about 4 form the actual canvas location. Maybe the frame location is being used. I suspect this because there is a blank border of about 4 pixels between the frame and the canvas. After scrolling, the error goes away. -Mark From brady@mmm.com Fri Jan 26 22:16:30 2001 From: brady@mmm.com (mark brady) Date: Fri, 26 Jan 2001 14:16:30 -0800 Subject: [Image-SIG] Tk Frame labels Message-ID: Tk frames always come up with a "Tk" title on their title bar by default. Is there some way to put an appropriate title on them? -Mark