From pg@hse.ch Tue Oct 6 08:14:44 1998 From: pg@hse.ch (HSE, Graf Patrick) Date: Tue, 6 Oct 1998 09:14:44 +0200 Subject: [Image-SIG] How to compress Gif files with the GifImagePlugin Message-ID: I'm using Python to upload image files to an Internet server. This upload script does also some modification to the image (resize with thumbnail function of the Image library). This all works fine, but surprise, surprise if I upload a GIF image the file increases the file size from 16k to 42k!!! After some mailing with Frederik Ludth I was told, that the files are saved uncompressed in Python.(License problems for this LWZ compressing routine). But there is a possibility with the GifImagePlugin to compress the Gif files. Can anyone help me with this. I tried to use the GifImagePlugin and I also changed the "register_save..:" entry at the bottom of the GifImagePlugin.py file as described. Then I opened my image file and tried to save it with another filename. I got an error that the file is in use by another process. What am I doing wrong? I only want to save the Gif image file compressed as it was. Thanks for any help Patrick Graf pg@hse.ch Example script: >>> import Image >>> import GifImagePlugin >>> im=Image.open("c:\\temp4\\nv01.gif") >>> im.save("c:\\temp4\\nv02.gif") # does this save the file compressed ? The process can not access the file becaus it's in use by another process. >>>^Z c:\ From guido@CNRI.Reston.VA.US Thu Oct 15 15:20:37 1998 From: guido@CNRI.Reston.VA.US (Guido van Rossum) Date: Thu, 15 Oct 1998 10:20:37 -0400 Subject: [Image-SIG] Come to the Python conference! Message-ID: <199810151420.KAA12981@eric.cnri.reston.va.us> Many of you on this list may not realize that the Python conference is less than four weeks away. Don't miss this unique opportunity to meet key players in the Python community, such as Fredrik Lundh, the author of the Python Image Library and the Tkinter tutorial at Pythonware.com, as well as many other Python luminaries such as multiple O'Reilly book author Mark Lutz. Also meet Open Source guru Eric Raymond, who will give a keynote speech. Consider some of our excellent tutorials, for example Numerical Python by David Ascher and JPython by Jim Hugunin (JPython's creator!). Register and pay by October 16 (tomorrow!) to save $75 on registration. For more info, see: http://www.foretec.com/python/workshops/1998-11/ The four-day conference starts on Tuesday, November 10, in Houston, Texas. --Guido van Rossum (home page: http://www.python.org/~guido/) From image_sig@opti.okdirect.com Fri Oct 16 22:29:59 1998 From: image_sig@opti.okdirect.com (Daniel Walton) Date: Fri, 16 Oct 1998 16:29:59 -0500 Subject: [Image-SIG] PIL 0.3b2 corrupt? Message-ID: <4.1.19981016161737.0159dce0@okdirect.com> I've been trying to download the latest version of PIL today from the pythonware.com/downloads.htm page and after multiple attempts I always get files that gunzip complains are corrupt. Is anyone else having this problem? Anyone have a non-corrupt copy they could send me in email? I'd greatly appreciate it! Thank You! Daniel Walton Pyxos, Inc. http://www.pyxos.com From image_sig@opti.okdirect.com Sat Oct 17 06:50:38 1998 From: image_sig@opti.okdirect.com (Daniel Walton) Date: Sat, 17 Oct 1998 00:50:38 -0500 Subject: [Image-SIG] PIL 0.3b2 corrupt? In-Reply-To: <13864.2369.296244.867950@dt09q1n8c.nycap.rr.com> References: <4.1.19981016161737.0159dce0@okdirect.com> <4.1.19981016161737.0159dce0@okdirect.com> Message-ID: <4.1.19981017004903.00c1c6b0@okdirect.com> Thanks Skip! That seems to have done the trick. Is it just me or is the file on pythonware.com really corrupt? Dan At 11:05 PM 10/16/98 -0400, you wrote: > > Daniel> Anyone have a non-corrupt copy they could send me in email? I'd > Daniel> greatly appreciate it! > >Daniel, > >Hope you don't get too many copies. I just downloaded it on 10/13... > >Skip Montanaro | Advertise on Musi-Cal for as little as $20: >skip@calendar.com | http://concerts.calendar.com/cgi-bin/genad > > > From fredrik@pythonware.com Sat Oct 17 17:44:21 1998 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sat, 17 Oct 1998 18:44:21 +0200 Subject: [Image-SIG] PIL 0.3b2 corrupt? Message-ID: <019401bdf9f1$338ec0f0$f29b12c2@pythonware.com> Daniel Walton wrote: >I've been trying to download the latest version of PIL today from the >pythonware.com/downloads.htm page and after multiple attempts I always get >files that gunzip complains are corrupt. Is anyone else having this problem? Some versions of Netscape treat that .tgz file as a text file. Here's an alternative link (using this will cause problems for some versions of MSIE...) http://www.pythonware.com/downloads/Imaging-0.3b2.tar.gz Cheers /F fredrik@pythonware.com http://www.pythonware.com From image_sig@opti.okdirect.com Sat Oct 17 19:03:22 1998 From: image_sig@opti.okdirect.com (Daniel Walton) Date: Sat, 17 Oct 1998 13:03:22 -0500 Subject: [Image-SIG] PIL 0.3b2 corrupt? In-Reply-To: <019401bdf9f1$338ec0f0$f29b12c2@pythonware.com> Message-ID: <4.1.19981017130307.00c76c50@okdirect.com> Yeah, that could certainly be it, I did use Netscape to download it. I've always found HTTP downloads to be somewhat troublesome. Why not provide downloads via anonymous FTP? Dan At 06:44 PM 10/17/98 +0200, you wrote: >Daniel Walton wrote: >>I've been trying to download the latest version of PIL today from the >>pythonware.com/downloads.htm page and after multiple attempts I always get >>files that gunzip complains are corrupt. Is anyone else having this problem? > >Some versions of Netscape treat that .tgz file as a text file. >Here's an alternative link (using this will cause problems for >some versions of MSIE...) > >http://www.pythonware.com/downloads/Imaging-0.3b2.tar.gz > >Cheers /F >fredrik@pythonware.com >http://www.pythonware.com > > >_______________________________________________ >Image-SIG maillist - Image-SIG@python.org >http://www.python.org/mailman/listinfo/image-sig > From image_sig@opti.okdirect.com Sun Oct 18 03:00:04 1998 From: image_sig@opti.okdirect.com (Daniel Walton) Date: Sat, 17 Oct 1998 21:00:04 -0500 Subject: [Image-SIG] ImageFileIO? Message-ID: <4.1.19981017205617.00c17480@okdirect.com> Under the tutorial section of the PIL documentation there is a section near the end entitled "Reading Images from Streams" which specifies that a class ImageFileIO is available to read images from sockets but I was not able to find it in the 0.3b2 distribution? Is this something that has been discontinued and if so what is the recommended method of reading images of unknown dimensions from a socket? Daniel Walton From fredrik@pythonware.com Sun Oct 18 15:41:27 1998 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sun, 18 Oct 1998 16:41:27 +0200 Subject: [Image-SIG] PIL 0.3b2 corrupt? Message-ID: <033f01bdfaa5$64c06480$f29b12c2@pythonware.com> >Yeah, that could certainly be it, I did use Netscape to download it. I've >always found HTTP downloads to be somewhat troublesome. Why not >provide downloads via anonymous FTP? It's a site hosting issue. For now, there's no such thing as ftp.pythonware.com. This might change in the future. Cheers /F fredrik@pythonware.com http://www.pythonware.com From fredrik@pythonware.com Sun Oct 18 15:45:04 1998 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sun, 18 Oct 1998 16:45:04 +0200 Subject: [Image-SIG] ImageFileIO? Message-ID: <035c01bdfaa5$e557b440$f29b12c2@pythonware.com> Daniel Walton wrote: >Under the tutorial section of the PIL documentation there is a section near >the end entitled "Reading Images from Streams" which specifies that a class >ImageFileIO is available to read images from sockets but I was not able to >find it in the 0.3b2 distribution? I'm afraid it's not there. See http://www.python.org/pipermail/1998q3.image-sig/25865886b3b5.html for the full story. Cheers /F fredrik@pythonware.com http://www.pythonware.com From gulliver@mic.atr.co.jp Wed Oct 21 17:22:39 1998 From: gulliver@mic.atr.co.jp (Lopez-Gulliver, Roberto) Date: Thu, 22 Oct 1998 01:22:39 +0900 (JST) Subject: [Image-SIG] Re: Image-SIG digest, Vol 1 #44 - 1 msg In-Reply-To: <199810061600.MAA01395@python.org> Message-ID: Dear all, I know the mail enclosed below is pretty old (1996!) but I'm stuck trying to change my images to array back and forth for speed. Is this still working or have it changed with my new version PILv03.a3? Any/all help will be much appreciated. --desesperado Roberto --------------------------------------------------------------------- Fredrik Lundh fredrik_lundh@ivab.se Wed, 3 Apr 1996 13:25:19 +0200 Previous message: Going multimedia? Next message: Grail + PIL = true! Messages sorted by: [ date ][ thread ][ subject ][ author ] If someone would like to fool around with the Python Imaging Library and the Numerical extension at the same time, here's a really minimal interface between these two libraries. A little more checking should of course be added, to make sure that the image isn't multiband, and that the array really contains unsigned 8-bit integers, but at least you'll get the idea :-) /F -------------------------------------------------------------------- import Image, Numeric 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 # "If you cannot do it in 8 lines of Python, it is probably # not worth doing." -------------------------------------------------------------------- From fredrik@pythonware.com Thu Oct 22 18:50:03 1998 From: fredrik@pythonware.com (Fredrik Lundh) Date: Thu, 22 Oct 1998 19:50:03 +0200 Subject: [Image-SIG] Re: Image to MumPy array with PIL Message-ID: <075401bdfde4$73660ac0$f29b12c2@pythonware.com> (cross-mailing to the image-sig -- as so often before, several people posted very similar questions the very same day...) Konrad Hinsen wrote: >Forced by the need to extract data from a scanned image, I finally >installed PIL, and was pleasantly surprised by it. It's rare to >find packages that do what they promise and even come with decent >documentation! I had my problem solved by 15 lines of code in >10 minutes, so I have no reason to complain. Glad you liked it! >However, it would have been even easier to solve my problem if there >were some way to obtain the pixel data in the form of a NumPy array. >Maybe that exists, and I just didn't find it. If not, it would >be a good idea for a future release. I ended up reading each pixel >by getpixel(), which doesn't look particularly efficient. I'm waiting for Guido to move the multiarray stuff into the Python core distribution... In the meantime, using tostring/fromstring is probably the most efficient way to transfer data between PIL and NumPy. I'm not a regular NumPy-user, but something like the following appears to work pretty well: import Numeric, Image def image2array(im): if im.mode not in ("L", "F"): raise ValueError, "can only convert single-layer images" if im.mode == "L": a = Numeric.fromstring(im.tostring(), Numeric.UnsignedInt8) else: a = Numeric.fromstring(im.tostring(), Numeric.Float32) a.shape = im.size[1], im.size[0] return a def array2image(a): if a.typecode() == Numeric.UnsignedInt8: mode = "L" elif a.typecode() == Numeric.Float32: mode = "F" else: raise ValueError, "unsupported image mode" return Image.fromstring(mode, (a.shape[1], a.shape[0]), a.tostring()) Improvements or better solutions are welcome. Cheers /F fredrik@pythonware.com http://www.pythonware.com From cgw@pgt.com Fri Oct 30 18:45:28 1998 From: cgw@pgt.com (Charles G Waldman) Date: Fri, 30 Oct 1998 13:45:28 -0500 (EST) Subject: [Image-SIG] pilplot? Message-ID: <13882.2376.827153.340660@hermes.pgt.com> Is Pilplot still alive? Can I download a working version from somewhere? I checked dejanews and the python.org website; references to pilplot are scarce and none of them are recent...