From fredrik@pythonware.com Sun Dec 1 16:55:08 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sun, 1 Dec 2002 17:55:08 +0100 Subject: [Image-SIG] Using ImageTk with Pmw.Blt References: <3DE79ECA.3310.1CB4403@localhost> Message-ID: <002001c2995a$b254e650$ced241d5@hagrid> "lightstone@acm.org" wrote: > I am trying to use the .snap() method of Pmw.Blt to get a graph image > which I can then convert using PIL to "something" (PDF or DIB or ??). > > I can't seem to use the ImageTk.PhotoImage() method since apparently > Pmw.Blt doesn't find the PhotoImage part of the object to pass to Blt. PIL's PhotoImage object provides a one-way link between Tkinter and PIL: you can create PhotoImage objects from PIL images, but you cannot get the data back over to PIL. since you're on Windows, you might be able to use the new Image- Grab module to get a copy of the bitmap contents: from Tkinter import * from PIL import ImageGrab def grabwidget(widget): x = widget.winfo_rootx() y = widget.winfo_rooty() w = widget.winfo_width() h = widget.winfo_height() return ImageGrab.grab((x, y, x+w, y+h)) root = Tk() label = Label(root, text="Spam & Eggs") label.pack() label.update() image = grabwidget(label) image.save("c:\out.png") From fredrik@pythonware.com Sun Dec 1 16:55:40 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sun, 1 Dec 2002 17:55:40 +0100 Subject: [Image-SIG] Using ImageTk with Pmw.Blt References: <3DE79ECA.3310.1CB4403@localhost> Message-ID: <002101c2995a$b2f3e570$ced241d5@hagrid> "lightstone@acm.org" wrote: > I am trying to use the .snap() method of Pmw.Blt to get a graph image > which I can then convert using PIL to "something" (PDF or DIB or ??). > > I can't seem to use the ImageTk.PhotoImage() method since apparently > Pmw.Blt doesn't find the PhotoImage part of the object to pass to Blt. PIL's PhotoImage object provides a one-way link between Tkinter and PIL: you can create PhotoImage objects from PIL images, but you cannot get the data back over to PIL. since you're on Windows, you might be able to use the new Image- Grab module to get a copy of the bitmap contents: from Tkinter import * from PIL import ImageGrab def grabwidget(widget): x = widget.winfo_rootx() y = widget.winfo_rooty() w = widget.winfo_width() h = widget.winfo_height() return ImageGrab.grab((x, y, x+w, y+h)) root = Tk() label = Label(root, text="Spam & Eggs") label.pack() label.update() image = grabwidget(label) image.save("c:\out.png") From fredrik@pythonware.com Sun Dec 1 16:57:09 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sun, 1 Dec 2002 17:57:09 +0100 Subject: [Image-SIG] reading JPG metadata with python References: <3DE4D514.303@cri.ensmp.fr> Message-ID: <002401c2995a$b3975160$ced241d5@hagrid> "daniel" wrote: > Having the Pil Handbook not having found any hint; I'm wondering : > U might know Perl's Image::Info, anything of the kind in python ? it might help if you tell people what "Image::Info" does... if all you need know is the size and format, use the "size" and "format" attributes of the Image instance: im = Image.open(...) print im.size, im.format for more information, check the contents of the "info" dictionary. From photo#nms@otdel-1.org Sun Dec 1 17:32:02 2002 From: photo#nms@otdel-1.org (Nikolai SAOUKH) Date: Sun, 1 Dec 2002 20:32:02 +0300 Subject: [Image-SIG] Re: reading JPG metadata with python In-Reply-To: <002401c2995a$b3975160$ced241d5@hagrid> References: <3DE4D514.303@cri.ensmp.fr> <002401c2995a$b3975160$ced241d5@hagrid> Message-ID: <20021201173202.GA439@otdel1.org> On Sun, Dec 01, 2002 at 05:57:09PM +0100, Fredrik Lundh wrote: | > Having the Pil Handbook not having found any hint; I'm wondering : | > U might know Perl's Image::Info, anything of the kind in python ? | | it might help if you tell people what "Image::Info" does... | | if all you need know is the size and format, use the "size" and "format" | attributes of the Image instance: | | im = Image.open(...) | print im.size, im.format | | for more information, check the contents of the "info" dictionary. perl Image::IPTCInfo allows one to extract image metadata from image file. From photo#nms@otdel-1.org Sun Dec 1 17:38:23 2002 From: photo#nms@otdel-1.org (Nikolai SAOUKH) Date: Sun, 1 Dec 2002 20:38:23 +0300 Subject: [Image-SIG] 16 bits per color support in PIL Message-ID: <20021201173823.GB439@otdel1.org> I joined this list few days ago. I assume the subject was already discussed. Is there any materials to read about? After looking at Pack.c/Unpack.c I assume that PIL (1.1.4a2) is still 8 bit per color. From photo#nms@otdel-1.org Sun Dec 1 17:42:14 2002 From: photo#nms@otdel-1.org (Nikolai SAOUKH) Date: Sun, 1 Dec 2002 20:42:14 +0300 Subject: [Image-SIG] Image metadata (XMP/Exif/IPTC/...) support in PIL Message-ID: <20021201174214.GC439@otdel1.org> Anybody working on subject? I would like to add Adobe XMP http://partners.adobe.com/asn/developer/xmp/main.html support to PIL. From kent@springfed.com Sun Dec 1 21:32:32 2002 From: kent@springfed.com (kent@springfed.com) Date: Sun, 1 Dec 2002 15:32:32 -0600 Subject: [Image-SIG] PIL with Python 2.2 Message-ID: <20021201213206.7309F222F84@sa-2.airstreamcomm.net> Howdy, I'm on Win2000 with Python 2.2 Am I correct that currently PIL does not work with 2.2? Will the upcoming final version of PIL 1.4 support Python 2.2 on Windows? Thanks, Kent From fredrik@pythonware.com Mon Dec 2 09:52:37 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Mon, 2 Dec 2002 10:52:37 +0100 Subject: [Image-SIG] PIL with Python 2.2 References: <20021201213206.7309F222F84@sa-2.airstreamcomm.net> Message-ID: <03f301c299e8$8e866530$0900a8c0@spiff> Kent wrote: > I'm on Win2000 with Python 2.2=20 >=20 > Am I correct that currently PIL > does not work with 2.2? nope. I'm not distributing prebuilt binaries for Python 2.2, but the library = works just fine with 2.2 (it works with 2.3 too, but you may get some annoying warnings from pre-alpha versions of Python) you can find activestate builds for 2.2 here: http://www.activestate.com/PPMPackages/PyPPM/2.2/packages/ From jeff@corrt.com Mon Dec 2 16:08:21 2002 From: jeff@corrt.com (Jeff Kunce) Date: Mon, 02 Dec 2002 10:08:21 -0600 Subject: [Image-SIG] IPTC and EXIF in PIL In-Reply-To: <20021127223046.40358218839@sa-3.airstreamcomm.net> Message-ID: <5.1.0.14.0.20021202095706.00ad4390@corrt.com> Good question. PIL reads EXIF data just fine: import Image im1 = Image.open('myimage.jpg') dictionaryContainingExifData = im1.app However, when you save a PIL image, it does not save the EXIF data: im1.store('test.jpg') im2 = Image.open('test.jpg') im2.app contains only a short 'JFIF' entry I asked a while back how to save EXIF data via PIL, but received no response. --Jeff At 04:31 PM 11/27/2002 -0600, kent@springfed.com wrote: >Howdy, > >What is the current capability of PIL in handling >imbedded data; > >[ ] destroys it >[ ] reads >[ ] writes >[ ] other From kevin_cazabon@hotmail.com Mon Dec 2 16:18:47 2002 From: kevin_cazabon@hotmail.com (Kevin Cazabon) Date: Mon, 2 Dec 2002 11:18:47 -0500 Subject: [Image-SIG] Multi-threading and PIL Message-ID: I've been working on a multi-threaded image processing application, and I've seen that only one CPU of a multi-processor system is being used by Python at a time, even if two threads are busy doing PIL processing. I came across the post below talking about Python multi-threading using "GIL" to control if a thread blocks others from executing or not... is it possible to upgrade the PIL c DLL's to release the GIL while processing? I'm not far into this yet, but it would be a huge advantage... anyone looked at this yet? Kevin Cazabon. ============================ "Michael Chermside" wrote in message news:mailman.1031751975.3372.python-list@python.org... > David Brown wrote: > > I've just been reading a little about the GIL and threading in python, and I > > have a couple of questions that I hope someone can answer. > > I'm not an expert, but I'll try. > > > Am I right in thinking that threading in Python does not use the underlying > > OS's threads, but effectively implements its own scheduler? Or does ituse > > the OS's threads, but uses the GIL to ensure that only one is runable ata > > time? > > It uses the OS's threads, and then uses the GIL to ensure that only one > is executing Python bytecodes at a time. However, other threads may be > runable... they could be blocked waiting on I/O, or executing some C > code from a module that releases the GIL before performing a > long-running computation. > If C code (or other extensions) that take significant time, or block for other reasons, release the GIL then there I suppose there is not going to be much of a problem. The point is to maximize the throughput, and avoid threads blocking each other unnecessarily. > > On a dual-processor system, does this mean that only one thread of a Python > > program can run at a time, even when both CPUs are free, so that two > > seperate python interpreter processes are needed to take advantage of the > > two CPUs? > > Yes. It sounds like that is only true for code that does a lot of work in pure python (rather than with time-consuming, GIL-released C code). > > > What about when a Python thread is blocked for some other reason, such as > > while waiting for a file read - will that block other threads, or will the > > waiting thread definitely release the GIL and allow other threads to run? > > Depends on what it's blocked for. If it's blocked for I/O, then the GIL > is released and the other threads will run. I'm not sure what else it > would block for that might be a problem. But you could certainly CREATE > a problem if you tried... simplest way would be to write C code which > ran for a long time WITHOUT releasing the GIL. > > It would be much more difficult to block things through badly written > Python code, since after each bytecode the interpretor can switch to a > different thread. > > > If the GIL does block all threads in this manner, are there any plans to > > introduce more fine-grained locking to improve scalability, analagous to > > locking in the Linux kernel? > > No. The general consensus is that eliminating the GIL would be quite > difficult and that there's not really all that much to gain. (Most > casual users don't have multi-processor systems; serious users of this > sort probably use Numeric and/or put the tight loops into C anyhow.) > However, if you know someone who's good with this stuff and wants to > volunteer, I'm sure they wouldn't turn down working code (unless it > introduced other problems). > > -- Michael Chermside > Thanks for the information - it was definitely helpful. It looks like the system used by Python will work fine in all but a few situations (SMP system in which a lot of work is being done in Python itself, rather than in extension modules - or in badly written extensions which don't release the GIL before doing heavy work). Such situations can be dealt with by running two python processes - if a program really needs to do hard SMP work in python, then that is a small price to pay since I image the GIL simplifies a lot of things. I had been worried that the Python threading scheme would have caused more inefficiences (such as all threads stopping while a single thread was blocked for I/O). From esworp@mac.com Tue Dec 3 08:43:40 2002 From: esworp@mac.com (derek prowse) Date: Tue, 3 Dec 2002 02:43:40 -0600 Subject: [Image-SIG] trying it in osx... In-Reply-To: Message-ID: <5254D90C-069B-11D7-AF6F-003065D8136C@mac.com> Ok.. enter the Idiot Mac User. I've been trying to get PIL to install for a while now, and seem to have met a few problems.. I'm sure this list doesn't get many 'i can't install' posts, and I apologize for being such a lamer. That said, take a look at this: ld: for architecture i386 ld: warning -L: directory name (/usr/local/lib) does not exist ld: warning -L: directory name (/usr/local/lib) does not exist ld: warning /usr/lib/bundle1.o cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded) ld: warning ./_imaging.o cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded) ld: warning ./decode.o cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded) ld: warning ./encode.o cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded) ld: warning ./map.o cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded) ld: warning ./display.o cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded) ld: warning ./outline.o cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded) ld: warning ./path.o cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded) ld: warning libImaging/libImaging.a archive's cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (can't load from it) ld: can't locate file for: -ljpeg make: *** [_imaging.so] Error 1 I get this after the final make command in the install process. As I am pretty much clueless, any help would be great. btw, I'm installing PIL to try and get images out of my handspring visor with this: http://www.tammura.at/eyemodule/ since visor dropped mac support for the springboard cam. grr. From fredrik@pythonware.com Tue Dec 3 14:05:02 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Tue, 3 Dec 2002 15:05:02 +0100 Subject: [Image-SIG] trying it in osx... References: <5254D90C-069B-11D7-AF6F-003065D8136C@mac.com> Message-ID: <0ccd01c29ad4$faef3480$0900a8c0@spiff> derek prowse wrote: > I've been trying to get PIL to install for a while now, and seem to=20 > have met a few problems.. I'm sure this list doesn't get many 'i=20 > can't install' posts, and I apologize for being such a lamer. in my experience, Mac OS X folks either seem to be able to build PIL out of the box without much effort, or they never manage to build it at all. PIL 1.1.2 seems to be available from the fink project: http://fink.sourceforge.net/pdb/package.php/pil Jack Jansen's MacPython kit also includes (some version of) PIL: http://www.cwi.nl/~jack/macpython.html and so does Bob Ippolito's kitchensink distribution: http://redivi.com/~bob/ if you insist on building it yourself, here's a pythonmac thread that = might provide additional information: http://mail.python.org/pipermail/pythonmac-sig/2002-October/006389.html checking with the pythonmac-sig people might also help. if you sort this one out, let me know what you did so I can add the info to the PIL FAQ. From a_list@attbi.com Tue Dec 3 23:41:53 2002 From: a_list@attbi.com (Nigel Moriarty) Date: Tue, 3 Dec 2002 15:41:53 -0800 Subject: [Image-SIG] general question Message-ID: <02fe01c29b25$8f66cf10$d2840380@cciws05> Folks I've just joined this list and have a general question. I wish to scan images of printed images like old posters. Because the original is printed, the CYMK values of the colours seems most appropriate as I can best determine the original colours used by the printers. I've fiddled with the TWAIN module by Kevin Gill and the PIL library but couldn't get CYMK out of TWAIN and into PIL. Does anyone have experience with scanning CYMK and manipulating the images? If so please give me some advice. Nigel From Chris.Barker@noaa.gov Wed Dec 4 00:09:56 2002 From: Chris.Barker@noaa.gov (Chris Barker) Date: Tue, 03 Dec 2002 16:09:56 -0800 Subject: [Image-SIG] trying it in osx... References: <5254D90C-069B-11D7-AF6F-003065D8136C@mac.com> Message-ID: <3DED47D4.1DF6CA3F@noaa.gov> derek prowse wrote: > I've been trying to get PIL to install for a while now, and seem to > have met a few problems.. I'm sure this list doesn't get many 'i > can't install' posts, and I apologize for being such a lamer. > > That said, take a look at this: > > ld: for architecture i386 > ld: warning -L: directory name (/usr/local/lib) does not exist > ld: warning -L: directory name (/usr/local/lib) does not exist > ld: warning /usr/lib/bundle1.o cputype (18, architecture ppc) does not > match cputype (7) for specified -arch flag: i386 (file not loaded) Here's your problem. It's a bug in the Apple distributed version of Python 2.2. What you need to do is edit the /usr/lib/python2.2/config/Makefile and remove the line that says: -arch i386 You can imagine that you really aren't on an i386 machine, after all. I still didn't get jpeg support, but otherwise it works fine. -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 gregc@cgl.ucsf.EDU Wed Dec 4 02:30:42 2002 From: gregc@cgl.ucsf.EDU (Greg Couch) Date: Tue, 3 Dec 2002 18:30:42 -0800 (PST) Subject: [Image-SIG] PATCH: PngImagePlugin.py Message-ID: <200212040230.gB42UgQW954458@adenine.cgl.ucsf.edu> Enclosed is patch that adds support for the PNG 1.2 standard text tags so you can annotate your PNG files. This code only works with Python 2.0 and later due to use of the string title method, tag.title(). For Python 1.5, you would need to use string.capwords(tag) instead. Greg Couch UCSF Computer Graphics Lab gregc@cgl.ucsf.edu P.S. The comment for my last TIFF patch might mention that Adobe Illustrator won't open a TIFF file without the compression tag. ----- *** PngImagePlugin.py 2002/12/04 00:22:21 1.1 --- PngImagePlugin.py 2002/12/04 01:26:30 *************** *** 420,425 **** --- 420,433 ---- chr(0), # 10: compression chr(0), # 11: filter category chr(0)) # 12: interlace flag + + # output standard text chunks (PNG 1.2 specification section 4.3) + for tag in ['title', 'author', 'description', 'copyright', 'creation time', 'software', 'disclaimer', 'warning', 'source', 'comment']: + if not im.encoderinfo.has_key(tag): + continue + # TODO: if type(im.encoderinfo[tag]) is unicode, then use iTXt + # TODO: if len(im.encoderinfo[tag] > 1024, then use zTXt + chunk(fp, "tEXt", tag.title(), chr(0), im.encoderinfo[tag]) if im.mode == "P": chunk(fp, "PLTE", im.im.getpalette("RGB")) From esworp@mac.com Wed Dec 4 04:45:58 2002 From: esworp@mac.com (derek prowse) Date: Tue, 3 Dec 2002 22:45:58 -0600 Subject: [Image-SIG] trying it in osx... In-Reply-To: <3DED47D4.1DF6CA3F@noaa.gov> Message-ID: <482559FF-0743-11D7-AF6F-003065D8136C@mac.com> Heyyyy! Thanks! Nice to see a positive response... The compiler goes a little bit further.. and then starts up with... cc1: warning: changing search order for system directory "/usr/local/include" cc1: warning: as it has already been specified as a non-system directory _imagingtk.c:20:16: tk.h: No such file or directory _imagingtk.c:23: parse error before '*' token _imagingtk.c:23: warning: function declaration isn't a prototype _imagingtk.c:31: parse error before "Tcl_Interp" _imagingtk.c:31: warning: no semicolon at end of struct or union _imagingtk.c:32: warning: type defaults to `int' in declaration of `TkappObject' _imagingtk.c:32: warning: data definition has no type or storage class _imagingtk.c: In function `_tkinit': _imagingtk.c:37: `Tcl_Interp' undeclared (first use in this function) _imagingtk.c:37: (Each undeclared identifier is reported only once _imagingtk.c:37: for each function it appears in.) _imagingtk.c:37: `interp' undeclared (first use in this function) _imagingtk.c:45: parse error before ')' token _imagingtk.c:50: `app' undeclared (first use in this function) _imagingtk.c:50: parse error before ')' token _imagingtk.c: At top level: _imagingtk.c:55: warning: type defaults to `int' in declaration of `TkImaging_Init' _imagingtk.c:55: warning: parameter names (without types) in function declaration _imagingtk.c:55: conflicting types for `TkImaging_Init' _imagingtk.c:23: previous declaration of `TkImaging_Init' _imagingtk.c:55: warning: data definition has no type or storage class _imagingtk.c:57: parse error before '&' token _imagingtk.c: In function `_tkinit': _imagingtk.c:45: warning: statement with no effect make: *** [_imagingtk.o] Error 1 and I'm back to the prompt... Care to come up to bat again? On Tuesday, December 3, 2002, at 06:09 PM, Chris Barker wrote: > derek prowse wrote: >> I've been trying to get PIL to install for a while now, and seem to >> have met a few problems.. I'm sure this list doesn't get many 'i >> can't install' posts, and I apologize for being such a lamer. >> >> That said, take a look at this: >> >> ld: for architecture i386 >> ld: warning -L: directory name (/usr/local/lib) does not exist >> ld: warning -L: directory name (/usr/local/lib) does not exist >> ld: warning /usr/lib/bundle1.o cputype (18, architecture ppc) does not >> match cputype (7) for specified -arch flag: i386 (file not loaded) > > Here's your problem. It's a bug in the Apple distributed version of > Python 2.2. What you need to do is edit the > > /usr/lib/python2.2/config/Makefile > > > and remove the line that says: > > -arch i386 > > You can imagine that you really aren't on an i386 machine, after all. > > I still didn't get jpeg support, but otherwise it works fine. > > -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 > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig From Jack.Jansen@cwi.nl Wed Dec 4 10:41:09 2002 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 4 Dec 2002 11:41:09 +0100 Subject: [Image-SIG] trying it in osx... In-Reply-To: <482559FF-0743-11D7-AF6F-003065D8136C@mac.com> Message-ID: On Wednesday, Dec 4, 2002, at 05:45 Europe/Amsterdam, derek prowse wrote: > Heyyyy! Thanks! Nice to see a positive response... > > > > The compiler goes a little bit further.. and then starts up with... > > cc1: warning: changing search order for system directory > "/usr/local/include" > cc1: warning: as it has already been specified as a non-system > directory > _imagingtk.c:20:16: tk.h: No such file or directory This one is much more difficult to fix: it is trying to build PIL/Tkinter support. Getting Tkinter to work with Apple's /usr/bin/python is pretty much impossible (unless you want to install X11, and then install a fairly standard unix Tk on that). If you indeed need Tkinter support you should probably build Python from scratch, and do a framework build. Or grab a prebuilt framework-python installer from somewhere. See http://www.cwi.nl/~jack/macpython.html for pointers to more info. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From howard@eegsoftware.com Thu Dec 5 20:21:54 2002 From: howard@eegsoftware.com (howard@eegsoftware.com) Date: Thu, 5 Dec 2002 12:21:54 -0800 Subject: [Image-SIG] Problem compiling DIB.C on Windows Message-ID: <3DEF44E2.18513.100687F@localhost> While trying to build Imaging-1.1.3 for Windows, I had compile errors. Looking back, I seem to have fixed this when I built 1.1.1 but perhaps I didn't report it :-( The DIB.C module includes some definitions for INT8, etc. that conflict with the existing definitions in the Microsoft SDK. Well, actually they are the SAME but the VC6SP3 compiler complains because they get expanded on the redefinitions, causing a compiler error. The "fix" is easy: #include BEFORE "Imaging.h" The DIB.C change makes the top look like this: #ifdef WIN32 #include // before other includes #include "Imaging.h" // moved AFTER the WIN32 check #include "ImDib.h" Howard Lightstone From denis.fan@dcs.warwick.ac.uk Fri Dec 6 09:56:14 2002 From: denis.fan@dcs.warwick.ac.uk (Denis Fan) Date: Fri, 06 Dec 2002 09:56:14 +0000 Subject: [Image-SIG] Always crash on ImageTk module Message-ID: <3DF0743E.1E384FAD@dcs.warwick.ac.uk> Hi everyone, I have been trying to find out what's the main reason behind this problem for sometime, however it seems as though I am not getting anywhere near to the success, and hope that some of you may know the way to deal with this problem, many thanks! I am running SunOS on my system. The problem is that whatever I do in PIL or in python, they all works fine, except when I tried to use the PhotoImage class in the ImageTk module (in here I am trying to turn an image that has been opened by the Image module and did some enhancement as well into something that is compatible with the Tkinter in python (so that I could display onto a Canvas)). Unfortunately, the only two results I have got so far is a) Bus Error and b) segmentation fault ... as I know 'Bus Error' appears on the Sun's system can mean a lot of things, but can anyone help me out? In my system, I am using tcl/tk 8.0 or higher, so I imagine that should be ok for both packages? I have updated my X windows patch (from the Sun's web site) to the most stable one already, but I still have this problem again and again ... I am just wondering would that still be my X window's problem? -d -- From Doug.Shawhan@gecits.ge.com Fri Dec 6 18:54:09 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Fri, 6 Dec 2002 13:54:09 -0500 Subject: [Image-SIG] Deliver me from Kludgehood - PIL, filesystems and state Message-ID: <47B6167F8E69D31194BA0008C7918D4205C54F9D@msxcvg02itscge.gecits.ge.com> I have written the following abomination under windows2k: I have written an embarassingly simple cgi script that cleans up old image directories, grabs an image, performs (no) manipulation (as of yet), creates a new directory for the image, writes the image and displays it. The problems with this are many - if more than one person attempts to view the page at once, then the earlier viewer will have a good chance of having his pic wiped out before it can be displayed. My question: is there a method to place an image in a page *without* writing it to the filesystem, thus avoiding keeping state and the security risk of allowing write access? Thanks all! d ---------------------------------yuk---------------------------------------- -- #!c:/python22/python.exe -u import cgi import cgitb; cgitb.enable() import os, string, random, time, glob import Image print 'Content-type: text/html\n\n' print 'yo' old_dirs=glob.glob("\\Program Files\\Apache Group\\Apache2\\htdocs\\img\\*") for each in old_dirs: if os.path.isdir(each): os.remove("%s\\hai.jpg"%each) os.rmdir(each) dirnm=str(random.randint(100,1000)) newImageDir="\\Program Files\\Apache Group\\Apache2\\htdocs\\img\\%s\\"%dirnm os.mkdir(newImageDir) gak=Image.open("pics\\karate.jpg") gak.save("%shai.jpg"%newImageDir,"JPEG") print '' print ''''''%dirnm print '' From kevin_cazabon@hotmail.com Fri Dec 6 19:30:01 2002 From: kevin_cazabon@hotmail.com (Kevin Cazabon) Date: Fri, 6 Dec 2002 14:30:01 -0500 Subject: [Image-SIG] Deliver me from Kludgehood - PIL, filesystems and state References: <47B6167F8E69D31194BA0008C7918D4205C54F9D@msxcvg02itscge.gecits.ge.com> Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_0017_01C29D33.F5FF5700 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Yes, it's easy to send the image over the Internet without writing it to disk: write the image to a StringIO object, then stream that object with a http header that reads: "Content-Type: image/jpg" with the size/etc. there. I do it with one of my scripts, here's the script itself attached (it does some resizing and stuff too, strip out what you don't need) Kevin Cazabon. ------=_NextPart_000_0017_01C29D33.F5FF5700 Content-Type: text/plain; name="sizeImage.py" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="sizeImage.py" #!/usr/bin/python -u # SizeImage # by Kevin Cazabon, kevin@cazabon.com # Copyright 2002, all rights reserved # released under the GNU General Public License, version 2 # This cgi will dynamically resize image files based on the query string # See photoAlbum.cgi for example of usage. # user settings largestWidth =3D 1024 largestHeight =3D 768 imageDir =3D "/home/httpd/html/photoAlbum" defaultCategory =3D "Miscellaneous" # imports import Image, sys, string, os, cgi, StringIO # Gather the input data and validate it try: inputData =3D cgi.FieldStorage() if inputData.has_key("maxWidth"): maxWidth =3D int(min(string.atof(inputData["maxWidth"].value), = largestWidth) + 0.5) else: maxWidth =3D largestWidth if inputData.has_key("maxHeight"): maxHeight =3D int(min(string.atof(inputData["maxHeight"].value), = largestHeight) + 0.5) else: maxHeight =3D largestHeight if inputData.has_key("category"): category =3D os.path.split(inputData["category"].value)[-1] # = just so there's no path-playing games from the user else: category =3D defaultCategory if inputData.has_key("filename"): filename =3D inputData["filename"].value if string.lower(filename[-3:]) not in ["jpg", "peg", "tif", = "gif", "png"]: print "Content-Type: text/html\n\n" print "Invalid Image File Requested: %s\nOnly Jpeg, TIFF, = GIF, and PNG formats supported." %filename sys.exit(-1) filename =3D os.path.join(imageDir, category, = os.path.split(filename)[-1]) # also so there's no path-playing games else: print "Content-Type: text/html\n\n" print "No image file requested!\n\n%s" %inputData sys.exit(-1) except Exception, errorMsg: print "Content-Type: text/html\n\n" print "Error processing query string: %s" %inputData print "\n\n

%s\n

%s" %(Exception, errorMsg) sys.exit(-1) if os.path.isfile(filename): try: image =3D Image.open(filename) imAspect =3D float(image.size[0]) / float(image.size[1]) outAspect =3D float(maxWidth) / float(maxHeight) if imAspect > outAspect: # use maxWidth for sizing image =3D image.resize((maxWidth, int(maxWidth / imAspect + = 0.5))) else: # use maxHeight for sizing image =3D image.resize((int(maxHeight * imAspect + 0.5), = maxHeight), Image.BICUBIC) # save the image to stdout sfp =3D StringIO.StringIO() image.save(sfp,'jpeg') except Exception, errorMsg: print "Content-Type: text/html\n\n" print "Error occurred while processing Image (%s)

\n\n" = %filename print "%s

\n%s" %(Exception, errorMsg) sys.exit(-1) else: print "Content-Type: text/html\n\n" print "Error: requested image file does not exist: %s" %filename sys.exit(-1) # if you got here, everything went ok, and the image is in spf, just = send it home try: print 'Content-Type: image/jpeg\n' # Python adds the extra line = feed to separate the header sys.stdout.write(sfp.getvalue()) sys.exit(0) except Exception, errorMsg: # something went wrong in writing to sys.stdout? print "Content-Type: text/html\n\n" print "Error Printing Image and Header to = sys.stdout\n

\n%s

\n%s" %(Exception, errorMsg) sys.exit(-1) ------=_NextPart_000_0017_01C29D33.F5FF5700-- From Doug.Shawhan@gecits.ge.com Fri Dec 6 19:22:44 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Fri, 6 Dec 2002 14:22:44 -0500 Subject: [Image-SIG] Deliver me from Kludgehood - PIL, filesystems and state Message-ID: <47B6167F8E69D31194BA0008C7918D4205C54FA2@msxcvg02itscge.gecits.ge.com> Wow! Thanks. This helps! -----Original Message----- From: Kevin Cazabon [mailto:kevin_cazabon@hotmail.com] Sent: Friday, December 06, 2002 1:30 PM To: Shawhan, Doug (CAP, ITS, US) Cc: image-sig@python.org Subject: Re: [Image-SIG] Deliver me from Kludgehood - PIL, filesystems and state Yes, it's easy to send the image over the Internet without writing it to disk: write the image to a StringIO object, then stream that object with a http header that reads: "Content-Type: image/jpg" with the size/etc. there. I do it with one of my scripts, here's the script itself attached (it does some resizing and stuff too, strip out what you don't need) Kevin Cazabon. From Doug.Shawhan@gecits.ge.com Fri Dec 6 21:43:15 2002 From: Doug.Shawhan@gecits.ge.com (Doug.Shawhan@gecits.ge.com) Date: Fri, 6 Dec 2002 16:43:15 -0500 Subject: [Image-SIG] StringIO seems to garble images in cgi Message-ID: <47B6167F8E69D31194BA0008C7918D4205C54FA6@msxcvg02itscge.gecits.ge.com> The following almost works, unfortunately the image comes out garbled. I have tried a variety of images in case they are somehow corrupt- no dice. Am I missing a step? d ---------------------snip---------------------------------------------- #!c:/python22/python.exe -u import cgi, StringIO #import cgitb; cgitb.enable() import sys import Image image=Image.open("pics\\karate2.jpg") image.thumbnail((100,100)) image_tub = StringIO.StringIO() image.save(image_tub,'JPEG') try: print 'Content-Type: image/jpeg\n' sys.stdout.write(image_tub.getvalue()) sys.exit(0) except Exception, errorMsg: print "Content-Type: text/html\n\n" print "Error Printing Image and Header to sys.stdout\n

\n%s

\n%s" %(Exception, errorMsg) sys.exit(-1) From fredrik@pythonware.com Sat Dec 7 18:19:56 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sat, 7 Dec 2002 19:19:56 +0100 Subject: [Image-SIG] StringIO seems to garble images in cgi References: <47B6167F8E69D31194BA0008C7918D4205C54FA6@msxcvg02itscge.gecits.ge.com> Message-ID: <017101c29e1d$409e1fa0$ced241d5@hagrid> Doug.Shawhan@gecits.ge.com wrote: > The following almost works, unfortunately the image comes out garbled. I > have tried a variety of images in case they are somehow corrupt- no dice. Am > I missing a step? try saving an image to disk from the browser, and also from within the CGI, and compare the files. if the sizes differ, chances are that your server is ignoring the "-u" option on the first line. > #!c:/python22/python.exe -u > > import cgi, StringIO > #import cgitb; cgitb.enable() > import sys > import Image > > > image=Image.open("pics\\karate2.jpg") > image.thumbnail((100,100)) > image_tub = StringIO.StringIO() > image.save(image_tub,'JPEG') > > try: > print 'Content-Type: image/jpeg\n' > sys.stdout.write(image_tub.getvalue()) > sys.exit(0) > except Exception, errorMsg: > print "Content-Type: text/html\n\n" > print "Error Printing Image and Header to sys.stdout\n

\n%s

\n%s" > %(Exception, errorMsg) > sys.exit(-1) From schorsch@schorsch.com Sat Dec 7 18:48:59 2002 From: schorsch@schorsch.com (Georg Mischler) Date: Sat, 7 Dec 2002 13:48:59 -0500 (EST) Subject: [Image-SIG] StringIO seems to garble images in cgi Message-ID: Oops, that was meant to go to the list... ---------- Forwarded message ---------- Fredrik Lundh wrote: > Doug.Shawhan@gecits.ge.com wrote: > > > The following almost works, unfortunately the image comes out garbled. I > > have tried a variety of images in case they are somehow corrupt- no dice. Am > > I missing a step? > > try saving an image to disk from the browser, and also from within > the CGI, and compare the files. if the sizes differ, chances are that > your server is ignoring the "-u" option on the first line. > > > > > [...] > > > > try: > > print 'Content-Type: image/jpeg\n' Another possibility is that the missing second '\n' here causes the server to send garbage. You need an empty line between the HTTP headers and the data. -schorsch -- Georg Mischler -- simulations developer -- schorsch at schorsch.com +schorsch.com+ -- lighting design tools -- http://www.schorsch.com/ From fredrik@pythonware.com Sun Dec 8 13:08:01 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sun, 8 Dec 2002 14:08:01 +0100 Subject: [Image-SIG] StringIO seems to garble images in cgi References: Message-ID: <00a201c29eba$d7ca24d0$ced241d5@hagrid> Georg Mischler wrote: > > > [...] > > > > > > try: > > > print 'Content-Type: image/jpeg\n' > > > Another possibility is that the missing second '\n' here > causes the server to send garbage. You need an empty line > between the HTTP headers and the data. but the print statement adds an extra newline by itself, right? From fredrik@pythonware.com Sun Dec 8 13:12:37 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Sun, 8 Dec 2002 14:12:37 +0100 Subject: [Image-SIG] Always crash on ImageTk module References: <3DF0743E.1E384FAD@dcs.warwick.ac.uk> Message-ID: <00aa01c29ebb$7f75e160$ced241d5@hagrid> Denis wrote: > I am running SunOS on my system. The problem is that whatever I do in > PIL or in python, they all works fine, except when I tried to use the > PhotoImage class in the ImageTk module (in here I am trying to turn an > image that has been opened by the Image module and did some enhancement > as well into something that is compatible with the Tkinter in python (so > that I could display onto a Canvas)). > > Unfortunately, the only two results I have got so far is a) Bus Error > and b) segmentation fault ... as I know 'Bus Error' appears on the Sun's > system can mean a lot of things, but can anyone help me out? you should be able to use the debugger to figure out where it crashes, either by running the program under the debugger, or via the core file (ask your local expertise for details) > In my system, I am using tcl/tk 8.0 or higher, so I imagine that should > be ok for both packages? I have updated my X windows patch (from the > Sun's web site) IIRC, something in the Tk C API changed somewhere around 8.1 or so. If the debugger doesn't provide more clues, try recompiling, and look for warnings in the compiler log. From schorsch@schorsch.com Sun Dec 8 14:06:48 2002 From: schorsch@schorsch.com (Georg Mischler) Date: Sun, 8 Dec 2002 09:06:48 -0500 (EST) Subject: [Image-SIG] StringIO seems to garble images in cgi In-Reply-To: <00a201c29eba$d7ca24d0$ced241d5@hagrid> Message-ID: Fredrik Lundh wrote: > Georg Mischler wrote: > > > > > try: > > > > print 'Content-Type: image/jpeg\n' > > > > > > Another possibility is that the missing second '\n' here > > causes the server to send garbage. You need an empty line > > between the HTTP headers and the data. > > but the print statement adds an extra newline by > itself, right? There's a point to that... I got confused by the mixed use of print and sys.stdout.write. But then, maybe Python got confused by the same thing, as was mentioned earlier about the -u parameter in the hashbang. I'd recommend not to mix those two, just to be on the safe side. -schorsch -- Georg Mischler -- simulations developer -- schorsch at schorsch.com +schorsch.com+ -- lighting design tools -- http://www.schorsch.com/ From Jack.Jansen@oratrix.com Sun Dec 8 22:39:57 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Sun, 8 Dec 2002 23:39:57 +0100 Subject: [Image-SIG] StringIO seems to garble images in cgi In-Reply-To: <47B6167F8E69D31194BA0008C7918D4205C54FA6@msxcvg02itscge.gecits.ge.com> Message-ID: On vrijdag, dec 6, 2002, at 22:43 Europe/Amsterdam, Doug.Shawhan@gecits.ge.com wrote: > The following almost works, unfortunately the image comes out garbled. > I > have tried a variety of images in case they are somehow corrupt- no > dice. Am > I missing a step? As you're using normal write() calls to sys.stdout you'll be messing up your \r and \n bytes in the image: sys.stdout is a text-mode file so you can't write binary data to it. At least: not on Windows. You'll have to somehow reopen the file in binary mode, but whether the unix idiom of fp = os.fdopen(sys.stdout.fileno(), 'wb') works on Windows remains to be seen... -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From fredrik@pythonware.com Sun Dec 8 23:01:47 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Mon, 9 Dec 2002 00:01:47 +0100 Subject: [Image-SIG] StringIO seems to garble images in cgi References: Message-ID: <004301c29f0d$ca676480$ced241d5@hagrid> jack wrote: > As you're using normal write() calls to sys.stdout you'll be messing up > your \r and \n bytes in the image: sys.stdout is a text-mode file so > you can't write binary data to it. At least: not on Windows. on Windows, the "-u" option sets the output to binary mode: C:/> python -? ... -u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x) ... From jeff@corrt.com Mon Dec 9 04:00:26 2002 From: jeff@corrt.com (Jeff Kunce) Date: Sun, 08 Dec 2002 22:00:26 -0600 Subject: [Image-SIG] StringIO seems to garble images in cgi In-Reply-To: <47B6167F8E69D31194BA0008C7918D4205C54FA6@msxcvg02itscge.ge cits.ge.com> Message-ID: <5.1.0.14.0.20021208215911.00a09ec0@corrt.com> FWIW, this works fine on my win2k machine with Xitami web server... --Jeff At 04:43 PM 12/6/02 -0500, you wrote: >The following almost works, unfortunately the image comes out garbled. I >have tried a variety of images in case they are somehow corrupt- no dice. Am >I missing a step? > >d > >---------------------snip---------------------------------------------- > >... From Belgoking@gmx.de Mon Dec 9 12:18:55 2002 From: Belgoking@gmx.de (Tobias Koelsch) Date: Mon, 9 Dec 2002 13:18:55 +0100 Subject: [Image-SIG] PGM-ASCII support in the PIL Message-ID: <20021209121855.GA2302@boris> Hi, I am trying to give (at least) reading support to the PIL for PGM-ASCII (magic number "P2"). I have almost found everything I need, but can't find the place, where the File is finally read. Can someone point me out the position. I am using the version 1.1.3. Gracias, Tobi From robmyroon@yahoo.com Mon Dec 9 20:33:12 2002 From: robmyroon@yahoo.com (Rob Myroon) Date: Mon, 9 Dec 2002 12:33:12 -0800 (PST) Subject: [Image-SIG] StringIO seems to garble images in cgi In-Reply-To: <47B6167F8E69D31194BA0008C7918D4205C54FA6@msxcvg02itscge.gecits.ge.com> Message-ID: <20021209203312.41383.qmail@web11407.mail.yahoo.com> I am not sure if this helps but I had to do a seek(0) when I used StringIO the other day. fp = StringIO.StringIO() # create StringIO object fp.write(string) # write data into StringIO object fp.seek(0) # put file pointer to the beginning im = Image.open(fp) # create a PIL Image object Rob --- Doug.Shawhan@gecits.ge.com wrote: > The following almost works, unfortunately the image comes out garbled. I > have tried a variety of images in case they are somehow corrupt- no dice. Am > I missing a step? > > d > > ---------------------snip---------------------------------------------- > > > #!c:/python22/python.exe -u > > import cgi, StringIO > #import cgitb; cgitb.enable() > import sys > import Image > > > image=Image.open("pics\\karate2.jpg") > image.thumbnail((100,100)) > image_tub = StringIO.StringIO() > image.save(image_tub,'JPEG') > > try: > print 'Content-Type: image/jpeg\n' > sys.stdout.write(image_tub.getvalue()) > sys.exit(0) > except Exception, errorMsg: > print "Content-Type: text/html\n\n" > print "Error Printing Image and Header to sys.stdout\n

\n%s

\n%s" > %(Exception, errorMsg) > sys.exit(-1) > > > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com From howard@eegsoftware.com Fri Dec 6 03:37:44 2002 From: howard@eegsoftware.com (howard@eegsoftware.com) Date: Thu, 5 Dec 2002 19:37:44 -0800 Subject: [Image-SIG] More problems building Imaging in WIndows Message-ID: <3DEFAB08.971.28F79DE@localhost> I have successfully beat down the (default) library issues with jpeg and zlib and almost managed to build python 2.2, Imaging, et.al. I am stuck now trying to get the tkImaging.c issue figured out. From reading the notes, I needed to build that into _tkinter which I did by adding it to the _tkinter project of python22 and defining WITH_PIL. I still get an undefined when trying to link imaging now. Is there someplace else I have to set up? I am pretty baffled today so perhaps a break (til tomorrow) will help. Thanks Howard Lightstone From denis.fan@dcs.warwick.ac.uk Fri Dec 6 09:23:36 2002 From: denis.fan@dcs.warwick.ac.uk (Denis Fan) Date: Fri, 06 Dec 2002 09:23:36 +0000 Subject: [Image-SIG] Always crash on ImageTk module References: <20021204170003.17280.94611.Mailman@mail.python.org> Message-ID: <3DF06C98.B0F068C5@dcs.warwick.ac.uk> --------------F1F15B1FE0E7197BFAFF6119 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi everyone, I have been trying to find out what's the main reason behind this problem for sometime, however it seems as though I am not getting anywhere near to the success, and hope that some of you may know the way to deal with this problem, many thanks! I am running SunOS on my system. The problem is that whatever I do in PIL or in python, they all works fine, except when I tried to use the PhotoImage class in the ImageTk module (in here I am trying to turn an image that has been opened by the Image module and did some enhancement as well into something that is compatible with the Tkinter in python (so that I could display onto a Canvas)). Unfortunately, the only two results I have got so far is a) Bus Error and b) segmentation fault ... as I know 'Bus Error' appears on the Sun's system can mean a lot of things, but can anyone help me out? In my system, I am using tcl/tk 8.0 or higher, so I imagine that should be ok for both packages? I have updated my X windows patch (from the Sun's web site) to the most stable one already, but I still have this problem again and again ... I am just wondering would that still be my X window's problem? -d -- --------------F1F15B1FE0E7197BFAFF6119 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi everyone,

I have been trying to find out what's the main reason behind this problem for sometime, however it seems as though I am not getting anywhere near to the success, and hope that some of you may know the way to deal with this problem, many thanks!

I am running SunOS on my system. The problem is that whatever I do in PIL or in python, they all works fine, except when I tried to use the PhotoImage class in the ImageTk module (in here I am trying to turn an image that has been opened by the Image module and did some enhancement as well into something that is compatible with the Tkinter in python (so that I could display onto a Canvas)).

Unfortunately, the only two results I have got so far is a) Bus Error and b) segmentation fault ... as I know 'Bus Error' appears on the Sun's system can mean a lot of things, but can anyone help me out?

In my system, I am using tcl/tk 8.0 or higher, so I imagine that should be ok for both packages? I have updated my X windows patch (from the Sun's web site) to the most stable one already, but I still have this problem again and again ... I am just wondering would that still be my X window's problem?

-d

--
  --------------F1F15B1FE0E7197BFAFF6119-- From howard@eegsoftware.com Wed Dec 11 00:25:43 2002 From: howard@eegsoftware.com (howard@eegsoftware.com) Date: Tue, 10 Dec 2002 16:25:43 -0800 Subject: [Image-SIG] Replacing a single color Message-ID: <3DF61587.4076.811CB3@localhost> I would like to take some images (from ImageGrab) and replace all the pixels of one color (the gray plot backgrounds) with another color (white). Seems I am using up ink at an incredible rate. Is there some easy way to do this? It looks like I have to apply a eval function to each pixel but I'm a little confused/unclear about this. Howard Lightstone From howard@eegsoftware.com Wed Dec 11 00:28:13 2002 From: howard@eegsoftware.com (howard@eegsoftware.com) Date: Tue, 10 Dec 2002 16:28:13 -0800 Subject: [Image-SIG] Printing under WIndows Message-ID: <3DF6161D.31090.83662D@localhost> I just have to ask.... To print an image under Windows, I just have to Use ImageWin to create a Dib object Paste my Image map into it Expose the Dib to DC This seems too easy. What am I missing? Howard Lightstone From jeff@corrt.com Thu Dec 12 02:50:47 2002 From: jeff@corrt.com (Jeff Kunce) Date: Wed, 11 Dec 2002 20:50:47 -0600 Subject: [Image-SIG] Replacing a single color In-Reply-To: <3DF61587.4076.811CB3@localhost> Message-ID: <5.1.0.14.0.20021211204839.00a04be0@corrt.com> --=====================_132905595==_ Content-Type: text/plain; charset="us-ascii"; format=flowed >I would like to take some images (from ImageGrab) and replace all >the pixels of one color (the gray plot backgrounds) with another color >(white). Here is some code that will do that (and a demo image to try it on.) --Jeff --=====================_132905595==_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: attachment; filename="ddpilext.py" #!/usr/bin/env python '''\ Some extensions to the PIL library $Id: ddpilext.py,v 1.1 2002/12/12 02:49:26 jeff Exp $ rgbColorFinder() returns a mask showing the location of a specified range of colors in a given image rgbColorReplacer() returns an image where all pixels in a given range of colors are replaced with a given color ***************************************************************** *** *** *** That portion of the software in this file written by *** *** Jeffrey J. Kunce is hereby placed in the public domain. *** *** - Jeffrey J. Kunce, 2002. *** *** *** *** !!! USE AT YOUR OWN RISK !!! *** *** !!! NO WARRANTIES WHATSOEVER !!! *** *** *** *** email: software@corrt.com *** *** *** ***************************************************************** ''' import Image, ImageChops def rgbColorFinder(rgbImg, colormin=(0,0,0), colormax=(255,255,255), allbands=1, rmode='1'): '''analyzes an RGB image, returns an image of the same size where each pixel is WHITE if the pixel in rgbImage MATCHES the color range colormin-to-colormax, or BLACK if the pixel in rgbImage DOES NOT MATCH the color range. a pixel is MATCHES the color range if allbands!=0 and if for EVERY color pixel[i], colormin[i]<=pixel[i] and pixel[i]<=colormax[i], or if allbands==0 and if for ANY color pixel[i], colormin[i]<=pixel[i] and pixel[i]<=colormax[i]. rmode determines the mode of the returned image ("1", "L" or "RGB") jjk 12/11/02''' inbands = rgbImg.split() outbands = [] for srcband, cmin, cmax in zip(inbands, colormin, colormax): outbands.append(srcband.point(lambda v1, v2=cmin, v3=cmax: v2<=v1 and v1<=v3 and 255)) if allbands==0: tband = ImageChops.lighter(ImageChops.lighter(outbands[0], outbands[1]), outbands[2]) else: tband = ImageChops.darker(ImageChops.darker(outbands[0], outbands[1]), outbands[2]) if rmode=='L': return tband elif rmode=='RGB': return Image.merge('RGB', (tband, tband, tband)) # 'RGB' else: # rmode=='1' return tband.convert('1') def rgbColorReplacer(rgbImg, colormin=(0,0,0), colormax=(32,32,32), colornew=(255,255,255), allbands=1): '''analyzes an RGB image, finds all colors in the range colormin-to-colormax (see colorFinder()), creates and returns, with all found colors replaced by colornew jjk 12/11/02''' colorMask = rgbColorFinder(rgbImg, colormin, colormax, allbands=allbands) rplImg = Image.new(rgbImg.mode, rgbImg.size, colornew) return Image.composite(rplImg, rgbImg, colorMask) def demo01(srcfile='demo_ddpilext_src01.jpg', colormin=(120,15,25), colormax=(215,35,60), colornew=(155, 255, 155)): '''just a demo of rgbColorReplacer. Insert your own values. jjk 12/11/02''' print print 'ddpilext.py demo01' dstfile1 = 'demo_ddpilext_rgbColorFinder.png' dstfile2 = 'demo_ddpilext_rgbColorReplacer.jpg' print '...opening file', srcfile im1 = Image.open(srcfile) print '...finding specified colors:', dstfile1 im2 = rgbColorFinder(im1, colormin, colormax, colornew) im2.save(dstfile1) print '...replacing specified colors:', dstfile2 im3 = rgbColorReplacer(im1, colormin, colormax, colornew) im3.save(dstfile2) print '...Done' if __name__=='__main__': import pdb demo01() --=====================_132905595==_ Content-Type: image/jpeg; name="demo_ddpilext_src01.jpg"; x-mac-type="4A504547"; x-mac-creator="4A565752" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="demo_ddpilext_src01.jpg" /9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcU FhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgo KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAD6ASYDASIA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3 ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AA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YyDmuiFvDtx5MeP90Uw28JODDHj/dFT9c/uj9l5nPPH8oZGGR+FRtHIsW9FYAdTjiun8iE dIo+mPuj0pskEPI8qPGP7oprGeQvY+Z5lrXiMabqn2ZLWG6JXL7n2kfjgj9K57VPE93INlraW9sj g8k7yPocCvStS0uwkupGksbVmBwC0Kk9B7VFHpOnKpI0+0B9RCv+FarMZpWWwLC0t2tTxKO2f7X5 oLSFslycncT/AFzW5oOky6ldCGBTGg+/Iei+xNeoLplg0qK1lalSehiXH8q6NLCzhiCRWluiAcKs YAH6VP159hzpJs8/i8N2kKhJdzORyMY/z+dbSxLGilUATGBn+grqTbQbmPkRZ/3BR9ltwvEEXT+4 KTxnl+JKo+ZyzOysSqkI2QB2AqvMqYJB3Fj7+lde9rbkDMEX/fApHtbfg+RFnHXYKX1z+7+I/Y+Z x6xvkKcjdjavrUTg42ru4JPA7V2TWtuFyIIs8fwCkFpbADFvD0P8Ap/XP7oex8zh5Sxj+RThuPu7 ePypYAQzJnG4bSSvNdubS24/0eHr/cFR/YrUk5toP+/Yo+uf3Q9j5nCuOc8jHWm3BjEG9QWkGcr0 rvPsVru/49oev/PMU37DaFubWA/WMUfXP7v4i9j5nlrXcwztt2JzjjNTCKZhlm29/lr0lrC0ww+y 2+M/88x/hTfsFnt/49bf/v2P8KPrn90PY+Z52qAjBJBx1IzmmhSM4GR046GvRRYWeT/olv8A9+1/ woFlaqDi2gH0jFP65/d/EXsfM4vQ023TbR1Q5P4iiu6srK0WXK2sAOztGKK8vFYnmqXsdNKnaJ// 2Q== --=====================_132905595==_ Content-Type: text/plain; charset="us-ascii"; format=flowed --=====================_132905595==_-- From vmilitaru@sympatico.ca Thu Dec 12 13:25:10 2002 From: vmilitaru@sympatico.ca (vio) Date: Thu, 12 Dec 2002 08:25:10 -0500 Subject: [Image-SIG] PIL and Flash Message-ID: <3DF88E36.6F12319F@sympatico.ca> Newbie just stumbled on the "writing your own file decoder" documentation page today. And it occured to me that adding a 'SWF' (as in 'Macromedia's Flash' file format) codec might be a nice addition to PIL, for generating Flash movies dynamically from python. Since I've only skimmed the mailing list archive only a couple months back, wondering if anything along those lines has been contemplated. Cheers, Vio From uwe.twelker@eyelikeit.de Tue Dec 17 05:25:10 2002 From: uwe.twelker@eyelikeit.de (Uwe Twelker) Date: Tue, 17 Dec 2002 06:25:10 +0100 Subject: [Image-SIG] Instructions to install PIL Message-ID: Hi I'm working on MacOS X now I want to use PIL and I'm looking for instructions to install PIL. Where would I find it? Thanks a lot Uwe From rs@onsitetech.com Tue Dec 17 05:39:58 2002 From: rs@onsitetech.com (Robb Shecter) Date: Mon, 16 Dec 2002 21:39:58 -0800 Subject: [Image-SIG] Fixes for PIL enhancers References: Message-ID: <3DFEB8AE.1080407@onsitetech.com> Hi all, I having seen postings on this, so I thought I'd ask: The ImageEnhance module in PIL 1.1.3 is pretty rough For example, most functions don't implement the full API (ie. being able to desaturate but not oversaturate colors in an image). So I've implemented them all. :-) Was this wasted work? Has it been fixed up yet? Thanks! Robb From logan33@email.unc.edu Tue Dec 17 05:59:21 2002 From: logan33@email.unc.edu (Thomas Logan) Date: Tue, 17 Dec 2002 00:59:21 -0500 (EST) Subject: [Image-SIG] animated gifs In-Reply-To: <3DFEB8AE.1080407@onsitetech.com> Message-ID: hello, i'm using pil 1.1.3 am trying to take a bunch of gif files and animate them in one outfile i try to use the sample script and get this fault Traceback (most recent call last): File "D:\MyProject\Main.py", line 35, in ? for s in getheader(im) + getdata(im): File "C:\Python22\lib\site-packages\PIL\GifImagePlugin.py", line 324, in getheader s.append(im.getpalette("RGB")[:maxcolor*3]) AttributeError: GifImageFile instance has no attribute 'getpalette' any ideas? the calling code looks like fp = open("out.gif", "wb") sequence = [] for i in range(1,18): im = Image.open("trickPics\\p"+str(i)+".GIF") sequence.append(im) gifmaker.makedelta(fp, sequence) fp.close() From joanca@typerware.com Tue Dec 17 11:45:02 2002 From: joanca@typerware.com (Joancarles =?iso-8859-1?Q?Casas=EDn?=) Date: Tue, 17 Dec 2002 12:45:02 +0100 Subject: [Image-SIG] Instructions to install PIL In-Reply-To: Message-ID: On 17/12/02 at 06:25, Uwe Twelker wrote: > Hi > > I'm working on MacOS X now I want to use PIL and I'm looking for > instructions to install PIL. Where would I find it? PIL 1.1.1 comes with the standard Mac distribution. See in $Python/Extensions/Imaging To use it add "$Python:Extensions:Imaging:PIL" in the "EditPythonPrefs". If you mean installing it (and compiling) to use with Mach-o-Python I can't help. No idea how to do it... Hope this helps a bit, Joancarles From kevin@cazabon.com Wed Dec 18 02:03:42 2002 From: kevin@cazabon.com (Kevin@Cazabon.com) Date: Tue, 17 Dec 2002 19:03:42 -0700 Subject: [Image-SIG] PIL and ICC: littlecms? Message-ID: <001a01c2a639$b0ae12e0$310aa8c0@duallie> Has anyone tried to tie littlecms into PIL so far? Littlecms (www.littlecms.com) is a free ICC color management module that transforms from one ICC color space to another. It's licensed under the lesser GPL, and is CROSS-PLATFORM compatible. Having ICC support for PIL would be a HUGE advantage, and from the surface it looks like it should be fairly simple. If anyone has done any work on this let me know, I'm thinking of doing some work on it, probably resulting in a Python/PIL callable DLL. Unfortuately my C skills aren't anywhere near my Python skills, so it might be a while, and ANY help would be appreciated. Thanks! Kevin Cazabon. From kevin@cazabon.com Thu Dec 19 08:05:56 2002 From: kevin@cazabon.com (Kevin@Cazabon.com) Date: Thu, 19 Dec 2002 01:05:56 -0700 Subject: [Image-SIG] PIL and ICC: littlecms? References: <001a01c2a639$b0ae12e0$310aa8c0@duallie> Message-ID: <000701c2a735$755a4270$310aa8c0@duallie> Well, I've managed to get things started, but have a couple problems related to accessing/modifying the image pixel data directly in my DLL... I don't think I'm using the right syntax... any help? Once I get this working, adding the rest of the littlecms ICC Color Management Support should be pretty simple. Thanks! Kevin. See notes in code below: ---------------------------- #include "Python.h" #include "lcms.h" #include "Imaging.h" // I'm not sure why I had to define this here... but it solved the issue typedef struct { PyObject_HEAD Imaging image; } ImagingObject; static PyObject * profileToProfile(PyObject *self, PyObject *args) { ImagingObject* im; ImagingObject* imOut; char *sInputProfile = NULL; char *sOutputProfile = NULL; char *sRenderingIntent = NULL; int imLength = 0; int i = 0; cmsHPROFILE hInProfile, hOutProfile; cmsHTRANSFORM hTransform; // parse the PyObject arguments, assign to variables accordingly // until I get ImagingNew working, we pass in TWO images... source and destination of the same size if (!PyArg_ParseTuple(args, "OOss|s", &im, &imOut, &sInputProfile, &sOutputProfile, &sRenderingIntent)) { return Py_BuildValue("i", -1); } hInProfile = cmsOpenProfileFromFile(sInputProfile, "r"); hOutProfile = cmsOpenProfileFromFile(sOutputProfile, "r"); hTransform = cmsCreateTransform(hInProfile, TYPE_BGR_8, hOutProfile, TYPE_BGR_8, INTENT_PERCEPTUAL, 0); //imOut = ImagingNew(im->image->mode, im->image->xsize, im->image->ysize); // I'm having an unresolved external error for ImagingNew here... ???? // why is ImagingNew unresolved... I'm not a C guy...??????? imLength = im->image->xsize * im->image->ysize; // THIS IS THE AREA I NEED HELP WITH // it is intended to go through the image pixel for pixel and apply the transform // I'll tweak the buffersize later once its working // cmsDoTransform uses the transform, inBuffer, outBuffer, and bufferSize. it reads bufferSize // pixels from inBuffer, processes them through the transform, and writes new values // to outBuffer for (i=0; i < imLength; i++) { cmsDoTransform(hTransform, &im->image[i], &imOut->image[i], // is this syntax correct for accessing the pixel data for read/write??? 1); } // END OF MAJOR PROBLEMS FOR NOW... cmsDeleteTransform(hTransform); cmsCloseProfile(hInProfile); cmsCloseProfile(hOutProfile); return Py_BuildValue("O", imOut); } static PyMethodDef pyCMS_methods[] = { {"profileToProfile", profileToProfile, 1, "profileToProfile() doc string"}, {NULL, NULL} }; void initpyCMS(void) { Py_InitModule("pyCMS", pyCMS_methods); } From fredrik@pythonware.com Thu Dec 19 09:13:39 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Thu, 19 Dec 2002 10:13:39 +0100 Subject: [Image-SIG] PIL and ICC: littlecms? References: <001a01c2a639$b0ae12e0$310aa8c0@duallie> <000701c2a735$755a4270$310aa8c0@duallie> Message-ID: <026001c2a73e$ee9eca30$ced241d5@hagrid> kevin wrote: > Well, I've managed to get things started excellent! > but have a couple problems related to accessing/modifying the image pixel > data directly in my DLL... I don't think I'm using the right syntax... any help? I've got no time to dig deeper into this right now, but the following note discusses the ImagingObject/ImagingNew issues: http://effbot.org/zone/pil-extending.htm (in short, use a Python wrapper). ::: > is this syntax correct for accessing the pixel data for read/write??? im->image[line] gives you a void pointer to a byte array that contains pixel data for a line (row) of pixels. for colour images (im->mode == "RGB"), the array contains four bytes per pixel: "RGBXRGBXRGBX..." assuming that the cms layer wants pointers to RGBX data, and that "1" you used is the number of pixels to process, you could just use: for (line = 0; line < im->ysize; line++) cmsDoTransform(hTransform, im->image[line], imOut->image[line], im->xsize); alternatively, to process a pixel at a time, use something like: for (line = 0; line < im->ysize; line++) { /* pick up line pointers */ char* in = im->image[line]; char* out = imOut->image[line]; for (i = 0; i < im->xsize; i++) { cmsDoTransform(hTransform, in, out, 1); in += 4; out += 4; /* four bytes per pixel */ } } hope this helps! From Jack.Jansen@oratrix.com Thu Dec 19 12:52:06 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Thu, 19 Dec 2002 13:52:06 +0100 Subject: [Image-SIG] Instructions to install PIL In-Reply-To: Message-ID: On dinsdag, dec 17, 2002, at 12:45 Europe/Amsterdam, Joancarles Casas=EDn=20= wrote: > On 17/12/02 at 06:25, Uwe Twelker wrote: > >> Hi >> >> I'm working on MacOS X now I want to use PIL and I'm looking for >> instructions to install PIL. Where would I find it? > > PIL 1.1.1 comes with the standard Mac distribution. That's true for MacPython, the version that runs on both OS9 and OSX,=20 but not for native MacOSX Python (like the one installed into /usr/bin=20= by Apple). But if you want to use PIL with Apple's Python it's fairly easy, just=20 run setup.py. Only if you want optional things, like JPEG support, you=20= will have to download the needed libraries yourself, and edit setup.py=20= so it can find your library. -- - Jack Jansen =20 http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma=20 Goldman - From David.Shemano@wpafb.af.mil Thu Dec 19 18:30:07 2002 From: David.Shemano@wpafb.af.mil (Shemano David A Contr AFRL/SNJM) Date: Thu, 19 Dec 2002 13:30:07 -0500 Subject: [Image-SIG] reading 16-bit images in the "raw" Message-ID: <67348AAF0635D511866A00508BDF0CC878A644@fszhtv11.wpafb.af.mil> hi, i am having difficulty with writing my own file decoder. the images are 16-bits per pixel straight binary with no header. i wrote a decoder following the example in the pil documentation, but it seems not to work. the images are 320x240 16-bits per pixel. the image file has the right number of bytes. here is my decoder: import Image, ImageFile class MerlinImageFile(ImageFile.ImageFile): format = "MERLIN" format_description = "Merlin camera raw little endian" def _open(self): self.size = (320, 240) self.mode = "F" self.tile = [ ("raw", self.size, 0, ("F;16", 0, 1) ) ] Image.register_open("MERLIN", MerlinImageFile) Image.register_extension("MERLIN", ".mln") in the tile attribute the "F;16" is intended to mean that 2 bytes get read in, they are interpreted as a 16-bit little endian integer and the value of that integer is stored as a floating point value in my image. (please set me straight if i have misinterpreted that) here is an idle session where i attempt to use the above: >>> import Image >>> import MerlinImageFile >>> im = Image.open("c:\\python22\\dave_projects\\test.mln") >>> print im.getextrema() Traceback (most recent call last): File "", line 1, in ? print im.getextrema() File "c:\py22\pil\Image.py", line 528, in getextrema self.load() File "c:\py22\pil\ImageFile.py", line 143, in load d.setimage(self.im, e) TypeError: argument 2 must be sequence of length 4, not 2 >>> any suggestions will be greatly appreciated. thanks in advance. dave shemano From jonathan.gilligan@vanderbilt.edu Thu Dec 19 19:21:15 2002 From: jonathan.gilligan@vanderbilt.edu (Gilligan, Jonathan M) Date: Thu, 19 Dec 2002 13:21:15 -0600 Subject: [Image-SIG] 48-bit RGB in PIL Message-ID: <74623515.1040304075@A117026.N1.Vanderbilt.Edu> I have started working a lot with 36-bit and 48-bit color images (TIFF and Nikon NEF files with 12 to 16 bits per band), and I would like to be able to use PIL on these. To make this possible, I am interested in extending PIL to handle 48-bit color. I think that it should be fairly easy to do this with a few mods to imaging.c to add a new mode. If there is any documentation of the PIL internals that would help me find the places where assumptions are made of the kinds of modes there are, it would be helpful. If others would be interested in this and if I am successful at adding this mode, I would be happy to post patches here. On the other hand, if others are working hard at this already, I would not like to reinvent the wheel. Jonathan From schutte@fel.tno.nl Fri Dec 20 07:41:03 2002 From: schutte@fel.tno.nl (K Schutte) Date: Fri, 20 Dec 2002 08:41:03 +0100 Subject: [Image-SIG] reading 16-bit images in the "raw" References: <67348AAF0635D511866A00508BDF0CC878A644@fszhtv11.wpafb.af.mil> Message-ID: <3E02C98F.DA47DF95@fel.tno.nl> This is a multi-part message in MIME format. --------------88F40F807FC4F2FEF78D2DAA Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, >From recent work reading 16 bit TIFF images (now in the PIL 1.1.4 alpha 2 release, see attached message), I think that you should set self.mode to "I;16", and also use the same mode specifier in the last line. Using "I;16" denotes that it is a 16 bit unsigned integer. "F;16" should specify 16 bit float format, and my system only supports float of length 32 and 64 bits... Good luck, Klamer Shemano David A Contr AFRL/SNJM wrote: > > hi, > i am having difficulty with writing my own file decoder. the images are 16-bits per pixel straight binary with no header. i wrote a decoder following the example in the pil documentation, but it seems not to work. the images are 320x240 16-bits per pixel. the image file has the right number of bytes. here is my decoder: > > import Image, ImageFile > > class MerlinImageFile(ImageFile.ImageFile): > > format = "MERLIN" > format_description = "Merlin camera raw little endian" > > def _open(self): > > self.size = (320, 240) > self.mode = "F" > > self.tile = [ ("raw", self.size, 0, ("F;16", 0, 1) ) ] > > Image.register_open("MERLIN", MerlinImageFile) > Image.register_extension("MERLIN", ".mln") > > in the tile attribute the "F;16" is intended to mean that 2 bytes get read in, they are interpreted as a 16-bit little endian integer and the value of that integer is stored as a floating point value in my image. (please set me straight if i have misinterpreted that) > > here is an idle session where i attempt to use the above: > > >>> import Image > >>> import MerlinImageFile > >>> im = Image.open("c:\\python22\\dave_projects\\test.mln") > >>> print im.getextrema() > Traceback (most recent call last): > File "", line 1, in ? > print im.getextrema() > File "c:\py22\pil\Image.py", line 528, in getextrema > self.load() > File "c:\py22\pil\ImageFile.py", line 143, in load > d.setimage(self.im, e) > TypeError: argument 2 must be sequence of length 4, not 2 > >>> > > any suggestions will be greatly appreciated. thanks in advance. > > dave shemano > > _______________________________________________ > 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 --------------88F40F807FC4F2FEF78D2DAA Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline Return-Path: Received: from pc1928.fel.tno.nl ([134.203.9.113]) by fs1.fel.tno.nl (Netscape Messaging Server 4.15) with SMTP id H62TPX00.FSQ for ; Sun, 24 Nov 2002 11:41:57 +0100 Received: FROM kaikoura.fel.tno.nl BY pc1928.fel.tno.nl ; Sun Nov 24 11:41:56 2002 +0100 Received: by kaikoura.fel.tno.nl; id LAA03674; Sun, 24 Nov 2002 11:41:50 +0100 (MET) Received: from nodnsquery(134.221.2.2) by kaikoura.fel.tno.nl via smap (V1.0) id xma003672; Sun, 24 Nov 02 11:41:34 +0100 Received: from mail7.messagelabs.com (mail7.messagelabs.com [194.151.197.68]) by zeus.tno.nl (8.11.6+Sun/8.10.2) with SMTP id gAOAfYO01778 for ; Sun, 24 Nov 2002 11:41:34 +0100 (MET) X-VirusChecked: Checked X-Env-Sender: image-sig-admin@python.org X-Msg-Ref: server-7.tower-7.messagelabs.com!1038134493!1134 Received: (qmail 2234 invoked from network); 24 Nov 2002 10:41:33 -0000 Received: from mail.python.org (12.155.117.29) by server-7.tower-7.messagelabs.com with SMTP; 24 Nov 2002 10:41:33 -0000 Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 4.05) id 18FuCG-0003YZ-00; Sun, 24 Nov 2002 05:41:04 -0500 Received: from [80.79.165.82] (helo=pythonware.com) by mail.python.org with esmtp (Exim 4.05) id 18FuBo-0003Xc-00 for image-sig@python.org; Sun, 24 Nov 2002 05:40:36 -0500 Received: from hagrid (brain.secret.pythonware.com [192.168.0.1]) by pythonware.com (8.11.6/8.8.5) with SMTP id gAOAWwm02532 for ; Sun, 24 Nov 2002 11:32:58 +0100 Message-ID: <007301c293a5$eb0a8fa0$ced241d5@hagrid> From: "Fredrik Lundh" To: Organization: Secret Labs AB MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Status: No, hits=0.8 required=5.0 tests=NOSPAM_INC,SPAM_PHRASE_00_01,USER_AGENT_OE Subject: [Image-SIG] ANN: PIL 1.1.4 alpha 2 Sender: image-sig-admin@python.org Errors-To: image-sig-admin@python.org X-BeenThere: image-sig@python.org X-Mailman-Version: 2.0.13 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Image Processing with Python SIG List-Unsubscribe: , List-Archive: Date: Sun, 24 Nov 2002 11:40:22 +0100 A PIL 1.1.4 alpha 2 tarball is now available from effbot.org: http://effbot.org/downloads (look for Imaging-1.1.4a2.tar.gz) A list of changes can be found here: http://effbot.org/zone/pil-changes-114.htm ...and a draft handbook can be found here: http://effbot.org/books/imagingbook/ The final release will be released by Secret Labs AB, as usual. We expect to release the final 1.1.4 version before the end of the year. Report bugs to this list or directly to me, as usual. enjoy /F _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig --------------88F40F807FC4F2FEF78D2DAA-- From edcjones@erols.com Fri Dec 20 23:46:17 2002 From: edcjones@erols.com (Edward C. Jones) Date: Fri, 20 Dec 2002 18:46:17 -0500 Subject: [Image-SIG] Computer generated docs for rawmodes Message-ID: <3E03ABC9.3080307@erols.com> Machine-Generated Documention for the Rawmodes

Rawmodes

Mode 1

rawmode 1, input bits per pixel 1
    bits (msb first, white is non-zero);
rawmode 1;I, input bits per pixel 1
    white is 0; bits (msb first, white is zero);
rawmode 1;R, input bits per pixel 1
    byte-reversed; bits (lsb first, white is non-zero);
rawmode 1;IR, input bits per pixel 1
    white is 0; byte-reversed; bits (lsb first, white is zero);

Mode L

rawmode L;2, input bits per pixel 2
    2 bits, packed; nibbles;
rawmode L;4, input bits per pixel 4
    4 bits, packed; nibbles;
rawmode L, input bits per pixel 8
    makes a copy; L, P;
rawmode L;I, input bits per pixel 8
    white is 0; negative;
rawmode L;16, input bits per pixel 16
    16 bit pixels; int16 (upper byte, little endian);
rawmode L;16B, input bits per pixel 16
    16 bit pixels; int16 (upper byte, big endian);

Mode P

rawmode P;1, input bits per pixel 1
    packed bits; bits;
rawmode P;2, input bits per pixel 2
    2 bits, packed; bit pairs;
rawmode P;2L, input bits per pixel 2
    2 bits, packed; bit layers;
rawmode P;4, input bits per pixel 4
    4 bits, packed; nibbles;
rawmode P;4L, input bits per pixel 4
    4 bits, packed; bit layers (trust the optimizer ;-);
rawmode P, input bits per pixel 8
    makes a copy; L, P;

Mode RGB

rawmode RGB, input bits per pixel 24
    padding added
rawmode RGB;L, input bits per pixel 24
    RGB, line interleaved;
rawmode RGB;16B, input bits per pixel 48
    16 bit pixels; 16-bit RGB triplets, big-endian order;
rawmode BGR, input bits per pixel 24
    RGB, reversed bytes;
rawmode BGR;5, input bits per pixel 16
    5 bits, packed; RGB, reversed bytes, 5 bits per pixel;
rawmode RGBX, input bits per pixel 32
    makes a copy; RGBA, CMYK quadruples;
rawmode RGBX;L, input bits per pixel 32
    RGBA, line interleaved;
rawmode BGRX, input bits per pixel 32
    RGB, reversed bytes with padding;
rawmode XRGB, input bits per pixel 24
    RGB, leading pad;
rawmode XBGR, input bits per pixel 32
    RGB, reversed bytes, leading pad;
rawmode YCC;P, input bits per pixel 24
    PhotoYCC triplets;
rawmode R, input bits per pixel 8
    band 0 only;
rawmode G, input bits per pixel 8
    band 1 only;
rawmode B, input bits per pixel 8
    band 2 only;

Mode RGBA

rawmode LA, input bits per pixel 16
    greyscale with alpha;
rawmode LA;16B, input bits per pixel 32
    16 bit pixels; 16-bit greyscale with alpha, big-endian;
rawmode RGBA, input bits per pixel 32
    makes a copy; RGBA, CMYK quadruples;
rawmode RGBA;I, input bits per pixel 32
    white is 0; RGBA, inverted RGB bytes (FlashPix);
rawmode RGBA;L, input bits per pixel 32
    RGBA, line interleaved;
rawmode RGBA;16B, input bits per pixel 64
    16 bit pixels; 16-bit RGBA, big-endian order;
rawmode BGRA, input bits per pixel 32
    RGBA, reversed bytes;
rawmode ARGB, input bits per pixel 32
    RGBA, leading pad;
rawmode ABGR, input bits per pixel 32
    RGBA, reversed bytes;
rawmode YCCA;P, input bits per pixel 32
    PhotoYCC triplets plus premultiplied alpha;
rawmode R, input bits per pixel 8
    band 0 only;
rawmode G, input bits per pixel 8
    band 1 only;
rawmode B, input bits per pixel 8
    band 2 only;
rawmode A, input bits per pixel 8
    band 3 only;

Mode RGBX

rawmode RGB, input bits per pixel 24
    padding added
rawmode RGB;L, input bits per pixel 24
    RGB, line interleaved;
rawmode RGB;16B, input bits per pixel 48
    16 bit pixels; 16-bit RGB triplets, big-endian order;
rawmode BGR, input bits per pixel 24
    RGB, reversed bytes;
rawmode BGR;5, input bits per pixel 16
    5 bits, packed; RGB, reversed bytes, 5 bits per pixel;
rawmode RGBX, input bits per pixel 32
    makes a copy; RGBA, CMYK quadruples;
rawmode RGBX;L, input bits per pixel 32
    RGBA, line interleaved;
rawmode BGRX, input bits per pixel 32
    RGB, reversed bytes with padding;
rawmode XRGB, input bits per pixel 24
    RGB, leading pad;
rawmode XBGR, input bits per pixel 32
    RGB, reversed bytes, leading pad;
rawmode YCC;P, input bits per pixel 24
    PhotoYCC triplets;
rawmode R, input bits per pixel 8
    band 0 only;
rawmode G, input bits per pixel 8
    band 1 only;
rawmode B, input bits per pixel 8
    band 2 only;
rawmode X, input bits per pixel 8
    band 3 only;

Mode CMYK

rawmode CMYK, input bits per pixel 32
    makes a copy; RGBA, CMYK quadruples;
rawmode CMYK;I, input bits per pixel 32
    white is 0; CMYK, inverted bytes (Photoshop 2.5);
rawmode CMYK;L, input bits per pixel 32
    RGBA, line interleaved;
rawmode C, input bits per pixel 8
    band 0 only;
rawmode M, input bits per pixel 8
    band 1 only;
rawmode Y, input bits per pixel 8
    band 2 only;
rawmode K, input bits per pixel 8
    band 3 only;
rawmode C;I, input bits per pixel 8
    white is 0; band 0 only;
rawmode M;I, input bits per pixel 8
    white is 0; band 1 only;
rawmode Y;I, input bits per pixel 8
    white is 0; band 2 only;
rawmode K;I, input bits per pixel 8
    white is 0; band 3 only;

Mode YCbCr

rawmode YCbCr, input bits per pixel 24
    padding added
rawmode YCbCr;L, input bits per pixel 24
    RGB, line interleaved;
rawmode YCbCrX, input bits per pixel 32
    makes a copy; RGBA, CMYK quadruples;
rawmode YCbCrK, input bits per pixel 32
    makes a copy; RGBA, CMYK quadruples;

Mode I

rawmode I, input bits per pixel 32
    makes a copy; RGBA, CMYK quadruples;
rawmode I;8, input bits per pixel 8
    UINT8 --> INT32;
rawmode I;8S, input bits per pixel 8
    little-endian; input signed; INT8 --> INT32;
rawmode I;16, input bits per pixel 16
    little-endian; 16 bit pixels; UINT16 --> INT32;
rawmode I;16S, input bits per pixel 16
    little-endian; input signed; 16 bit pixels; INT16 --> INT32;
rawmode I;16B, input bits per pixel 16
    big-endian; 16 bit pixels; UINT16 --> INT32;
rawmode I;16BS, input bits per pixel 16
    big-endian; input signed; 16 bit pixels; INT16 --> INT32;
rawmode I;16N, input bits per pixel 16
    native byte order; 16 bit pixels; UINT16 --> INT32;
rawmode I;16NS, input bits per pixel 16
    native byte order; input signed; 16 bit pixels; INT16 --> INT32;
rawmode I;32, input bits per pixel 32
    little-endian; UINT32 --> INT32;
rawmode I;32S, input bits per pixel 32
    little-endian; input signed; INT32 --> INT32;
rawmode I;32B, input bits per pixel 32
    big-endian; UINT32 --> INT32;
rawmode I;32BS, input bits per pixel 32
    big-endian; input signed; INT32 --> INT32;
rawmode I;32N, input bits per pixel 32
    native byte order; UINT32 --> INT32;
rawmode I;32NS, input bits per pixel 32
    native byte order; input signed; INT32 --> INT32;

Mode F

rawmode F, input bits per pixel 32
    makes a copy; RGBA, CMYK quadruples;
rawmode F;8, input bits per pixel 8
    UINT8 --> FLOAT32;
rawmode F;8S, input bits per pixel 8
    little-endian; input signed; INT8 --> FLOAT32;
rawmode F;16, input bits per pixel 16
    little-endian; 16 bit pixels; UINT16 --> FLOAT32;
rawmode F;16S, input bits per pixel 16
    little-endian; input signed; 16 bit pixels; INT16 --> FLOAT32;
rawmode F;16B, input bits per pixel 16
    big-endian; 16 bit pixels; UINT16 --> FLOAT32;
rawmode F;16BS, input bits per pixel 16
    big-endian; input signed; 16 bit pixels; INT16 --> FLOAT32;
rawmode F;16N, input bits per pixel 16
    native byte order; 16 bit pixels; UINT16 --> FLOAT32;
rawmode F;16NS, input bits per pixel 16
    native byte order; input signed; 16 bit pixels; INT16 --> FLOAT32;
rawmode F;32, input bits per pixel 32
    little-endian; UINT32 --> FLOAT32;
rawmode F;32S, input bits per pixel 32
    little-endian; input signed; INT32 --> FLOAT32;
rawmode F;32B, input bits per pixel 32
    big-endian; UINT32 --> FLOAT32;
rawmode F;32BS, input bits per pixel 32
    big-endian; input signed; INT32 --> FLOAT32;
rawmode F;32N, input bits per pixel 32
    native byte order; UINT32 --> FLOAT32;
rawmode F;32NS, input bits per pixel 32
    native byte order; input signed; INT32 --> FLOAT32;
rawmode F;32F, input bits per pixel 32
    little-endian; FLOAT32 --> FLOAT32;
rawmode F;32BF, input bits per pixel 32
    big-endian; FLOAT32 --> FLOAT32;
rawmode F;32NF, input bits per pixel 32
    native byte order; FLOAT32 --> FLOAT32;
rawmode F;64F, input bits per pixel 64
    little-endian; 4 bits, packed; FLOAT64 --> FLOAT32;
rawmode F;64BF, input bits per pixel 64
    big-endian; 4 bits, packed; FLOAT64 --> FLOAT32;
rawmode F;64NF, input bits per pixel 64
    native byte order; 4 bits, packed; FLOAT64 --> FLOAT32; From edcjones@erols.com Sun Dec 22 00:45:52 2002 From: edcjones@erols.com (Edward C. Jones) Date: Sat, 21 Dec 2002 19:45:52 -0500 Subject: [Image-SIG] Bug in convert? Message-ID: <3E050B40.6080405@erols.com> The following program gives the unexpected answer of -2147483648. The source code for "f2i" in "Convert.c" simply casts the float to an int. My copy of Harbison & Steele says that the cast is undefined in this case. I use Gentoo 1.3 on a PC. "gcc -v" gives: Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs gcc version 2.95.3 20010315 (release) -------------------------- #! /usr/bin/env python import Image im = Image.new("F", (1,1), 1.0e11) print im.convert("I").getpixel( (0,0) ) From edcjones@erols.com Wed Dec 25 15:32:53 2002 From: edcjones@erols.com (Edward C. Jones) Date: Wed, 25 Dec 2002 10:32:53 -0500 Subject: [Image-SIG] Bug in "1" mode Message-ID: <3E09CFA5.5080901@erols.com> This statement prints "255": print Image.new("1", (1,1), 255).getpixel((0,0)) In mode "1", the internal representation is bytes. Which byte values are interpreted as zero and which as one? I use PIL 1.1.3 Gentoo Linux 1.3 "gcc version 2.95.3 20010315 (release)" AMD Thunderbird 1.0G chip Ed Jones From edcjones@erols.com Wed Dec 25 16:00:09 2002 From: edcjones@erols.com (Edward C. Jones) Date: Wed, 25 Dec 2002 11:00:09 -0500 Subject: [Image-SIG] Result of testing convert Message-ID: <3E09D609.8010201@erols.com> Conversions to mode "1" are often buggy because of problems with the internal representation of mode "1". The expression Image.new("1", (1,1), 255).getpixel((0,0)) returns 255. I use Gentoo Linux 1.3 on a PC with gcc 2.95.3. mode "1", value 0 to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (0, 0, 0, 255) "YCbCr" (0, 128, 128) "I" 0 "F" 0.0 mode "1", value 1 to mode "1" 1 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" 255 "F" 255.0 -------------------------------- mode "L", value 0 to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (0, 0, 0, 255) "YCbCr" (0, 128, 128) "I" 0 "F" 0.0 mode "L", value 255 to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" 255 "F" 255.0 -------------------------------- mode "RGB", value (0, 0, 0) to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (255, 255, 255, 0) "YCbCr" (0, 128, 128) "I" 0 "F" 0.0 mode "RGB", value (255, 255, 255) to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" 255 "F" 255.0 -------------------------------- mode "RGBA", value (0, 0, 0, 0) to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 0) "RGBX" (0, 0, 0, 255) "CMYK" (255, 255, 255, 0) "YCbCr" (0, 128, 128) "I" 0 "F" 0.0 mode "RGBA", value (255, 255, 255, 255) to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" 255 "F" 255.0 -------------------------------- mode "RGBX", value (0, 0, 0, 0) to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 0) "CMYK" (255, 255, 255, 0) "YCbCr" (0, 128, 128) "I" 0 "F" 0.0 mode "RGBX", value (255, 255, 255, 255) to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" 255 "F" 255.0 -------------------------------- mode "CMYK", value (0, 0, 0, 0) to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" 255 "F" 255.0 mode "CMYK", value (255, 255, 255, 255) to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (255, 255, 255, 255) "YCbCr" (0, 128, 128) "I" 0 "F" 0.0 -------------------------------- mode "YCbCr", value (0, 0, 0, 0) to mode "1" 0 "L" 0 "RGB" (0, 135, 0) "RGBA" (0, 135, 0, 255) "RGBX" (0, 135, 0, 255) "CMYK" (255, 120, 255, 0) "YCbCr" (0, 0, 0) "I" 79 "F" 79.2450027466 mode "YCbCr", value (255, 255, 255, 255) to mode "1" 255 "L" 255 "RGB" (255, 120, 255) "RGBA" (255, 120, 255, 255) "RGBX" (255, 120, 255, 255) "CMYK" (0, 135, 0, 0) "YCbCr" (255, 255, 255) "I" 175 "F" 175.755004883 -------------------------------- mode "I", value -1024 to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (0, 0, 0, 255) "YCbCr" (0, 128, 128) "I" -1024 "F" -1024.0 mode "I", value -64 to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (0, 0, 0, 255) "YCbCr" (0, 128, 128) "I" -64 "F" -64.0 mode "I", value 0 to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (0, 0, 0, 255) "YCbCr" (0, 128, 128) "I" 0 "F" 0.0 mode "I", value 64 to mode "1" 0 "L" 64 "RGB" (64, 64, 64) "RGBA" (64, 64, 64, 255) "RGBX" (64, 64, 64, 255) "CMYK" (0, 0, 0, 191) "YCbCr" (64, 128, 128) "I" 64 "F" 64.0 mode "I", value 1024 to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" 1024 "F" 1024.0 -------------------------------- mode "F", value -1e+15 to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (0, 0, 0, 255) "YCbCr" (0, 128, 128) "I" -2147483648 "F" -9.99999986991e+14 mode "F", value -100000.0 to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (0, 0, 0, 255) "YCbCr" (0, 128, 128) "I" -100000 "F" -100000.0 mode "F", value -1024.0 to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (0, 0, 0, 255) "YCbCr" (0, 128, 128) "I" -1024 "F" -1024.0 mode "F", value -64.0 to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (0, 0, 0, 255) "YCbCr" (0, 128, 128) "I" -64 "F" -64.0 mode "F", value 0.0 to mode "1" 0 "L" 0 "RGB" (0, 0, 0) "RGBA" (0, 0, 0, 255) "RGBX" (0, 0, 0, 255) "CMYK" (0, 0, 0, 255) "YCbCr" (0, 128, 128) "I" 0 "F" 0.0 mode "F", value 64.0 to mode "1" 0 "L" 64 "RGB" (64, 64, 64) "RGBA" (64, 64, 64, 255) "RGBX" (64, 64, 64, 255) "CMYK" (0, 0, 0, 191) "YCbCr" (64, 128, 128) "I" 64 "F" 64.0 mode "F", value 1024.0 to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" 1024 "F" 1024.0 mode "F", value 100000.0 to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" 100000 "F" 100000.0 mode "F", value 1073741824.0 to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" 1073741824 "F" 1073741824.0 mode "F", value 8589934592.0 to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" -2147483648 "F" 8589934592.0 mode "F", value 1e+15 to mode "1" 255 "L" 255 "RGB" (255, 255, 255) "RGBA" (255, 255, 255, 255) "RGBX" (255, 255, 255, 255) "CMYK" (0, 0, 0, 0) "YCbCr" (255, 128, 128) "I" -2147483648 "F" 9.99999986991e+14 From edcjones@erols.com Wed Dec 25 15:57:45 2002 From: edcjones@erols.com (Edward C. Jones) Date: Wed, 25 Dec 2002 10:57:45 -0500 Subject: [Image-SIG] Code for testing "convert" Message-ID: <3E09D579.9020306@erols.com> #! /usr/bin/env python """Test "convert" for all combinations of modes""" import Image modes = ('1', 'L', 'RGB', 'RGBA', 'RGBX', 'CMYK', 'YCbCr', 'I', 'F') values = { '1' : (0, 1), 'L' : (0, 255), 'I' : (-1024, -64, 0, 64, 1024), 'F' : (-1.0e15, -100000.0, -1024.0, -64.0, 0.0, 64.0, 1024.0, 1.0e5, float(2L**30), float(2L**33), 1.0e15), 'RGB' : ((0, 0, 0), (255, 255, 255)), 'RGBA' : ((0, 0, 0, 0), (255, 255, 255, 255)), 'RGBX' : ((0, 0, 0, 0), (255, 255, 255, 255)), 'CMYK' : ((0, 0, 0, 0), (255, 255, 255, 255)), 'YCbCr' : ((0, 0, 0, 0), (255, 255, 255, 255)) } text = \ """Conversions to mode "1" are often buggy because of problems with the internal representation of mode "1". The expression Image.new("1", (1,1), 255).getpixel((0,0)) returns %i. I use Gentoo Linux 1.3 on a PC with gcc 2.95.3. """ print text % Image.new('1', (1,1), 255).getpixel((0,0)) for mode1 in modes: im = Image.new(mode1, (1,1)) for value in values[mode1]: print 'mode "%s", value %s to mode' % (mode1, str(value)) im.putpixel((0,0), value) for mode2 in modes: im2 = im.convert(mode2) v = im2.getpixel((0,0)) s = '"%s"' % mode2 print ' %-7s %s' % (s, str(v)) print print '--------------------------------' print # Ed Jones From edcjones@erols.com Wed Dec 25 16:39:58 2002 From: edcjones@erols.com (Edward C. Jones) Date: Wed, 25 Dec 2002 11:39:58 -0500 Subject: [Image-SIG] Machine generated documentation for rawmodes, text form Message-ID: <3E09DF5E.7020008@erols.com> Machine Generated Documentation for the rawmodes (no guarentees) Mode "1" rawmode "1", input bits per pixel 1 bits (msb first, white is non-zero) rawmode "1;I", input bits per pixel 1 White is 0 || bits (msb first, white is zero) rawmode "1;R", input bits per pixel 1 Byte-reversed || bits (lsb first, white is non-zero) rawmode "1;IR", input bits per pixel 1 White is 0 || Byte-reversed || bits (lsb first, white is zero) Mode "L" rawmode "L;2", input bits per pixel 2 2 bits, packed || nibbles rawmode "L;4", input bits per pixel 4 4 bits, packed || nibbles rawmode "L", input bits per pixel 8 Makes a copy || L, P rawmode "L;I", input bits per pixel 8 White is 0 || negative rawmode "L;16", input bits per pixel 16 16 bit pixels || int16 (upper byte, little endian) rawmode "L;16B", input bits per pixel 16 16 bit pixels || int16 (upper byte, big endian) Mode "P" rawmode "P;1", input bits per pixel 1 Packed bits || bits rawmode "P;2", input bits per pixel 2 2 bits, packed || bit pairs rawmode "P;2L", input bits per pixel 2 2 bits, packed || bit layers rawmode "P;4", input bits per pixel 4 4 bits, packed || nibbles rawmode "P;4L", input bits per pixel 4 4 bits, packed || bit layers (trust the optimizer ;-) rawmode "P", input bits per pixel 8 Makes a copy || L, P Mode "RGB" rawmode "RGB", input bits per pixel 24 Padding added || RGB triplets rawmode "RGB;L", input bits per pixel 24 RGB, line interleaved rawmode "RGB;16B", input bits per pixel 48 16 bit pixels || 16-bit RGB triplets, big-endian order rawmode "BGR", input bits per pixel 24 RGB, reversed bytes rawmode "BGR;5", input bits per pixel 16 5 bits, packed || RGB, reversed bytes, 5 bits per pixel rawmode "RGBX", input bits per pixel 32 Makes a copy || RGBA, CMYK quadruples rawmode "RGBX;L", input bits per pixel 32 RGBA, line interleaved rawmode "BGRX", input bits per pixel 32 RGB, reversed bytes with padding rawmode "XRGB", input bits per pixel 24 RGB, leading pad rawmode "XBGR", input bits per pixel 32 RGB, reversed bytes, leading pad rawmode "YCC;P", input bits per pixel 24 PhotoYCC triplets rawmode "R", input bits per pixel 8 band 0 only rawmode "G", input bits per pixel 8 band 1 only rawmode "B", input bits per pixel 8 band 2 only Mode "RGBA" rawmode "LA", input bits per pixel 16 greyscale with alpha rawmode "LA;16B", input bits per pixel 32 16 bit pixels || 16-bit greyscale with alpha, big-endian rawmode "RGBA", input bits per pixel 32 Makes a copy || RGBA, CMYK quadruples rawmode "RGBA;I", input bits per pixel 32 White is 0 || RGBA, inverted RGB bytes (FlashPix) rawmode "RGBA;L", input bits per pixel 32 RGBA, line interleaved rawmode "RGBA;16B", input bits per pixel 64 16 bit pixels || 16-bit RGBA, big-endian order rawmode "BGRA", input bits per pixel 32 RGBA, reversed bytes rawmode "ARGB", input bits per pixel 32 RGBA, leading pad rawmode "ABGR", input bits per pixel 32 RGBA, reversed bytes rawmode "YCCA;P", input bits per pixel 32 PhotoYCC triplets plus premultiplied alpha rawmode "R", input bits per pixel 8 band 0 only rawmode "G", input bits per pixel 8 band 1 only rawmode "B", input bits per pixel 8 band 2 only rawmode "A", input bits per pixel 8 band 3 only Mode "RGBX" rawmode "RGB", input bits per pixel 24 Padding added || RGB triplets rawmode "RGB;L", input bits per pixel 24 RGB, line interleaved rawmode "RGB;16B", input bits per pixel 48 16 bit pixels || 16-bit RGB triplets, big-endian order rawmode "BGR", input bits per pixel 24 RGB, reversed bytes rawmode "BGR;5", input bits per pixel 16 5 bits, packed || RGB, reversed bytes, 5 bits per pixel rawmode "RGBX", input bits per pixel 32 Makes a copy || RGBA, CMYK quadruples rawmode "RGBX;L", input bits per pixel 32 RGBA, line interleaved rawmode "BGRX", input bits per pixel 32 RGB, reversed bytes with padding rawmode "XRGB", input bits per pixel 24 RGB, leading pad rawmode "XBGR", input bits per pixel 32 RGB, reversed bytes, leading pad rawmode "YCC;P", input bits per pixel 24 PhotoYCC triplets rawmode "R", input bits per pixel 8 band 0 only rawmode "G", input bits per pixel 8 band 1 only rawmode "B", input bits per pixel 8 band 2 only rawmode "X", input bits per pixel 8 band 3 only Mode "CMYK" rawmode "CMYK", input bits per pixel 32 Makes a copy || RGBA, CMYK quadruples rawmode "CMYK;I", input bits per pixel 32 White is 0 || CMYK, inverted bytes (Photoshop 2.5) rawmode "CMYK;L", input bits per pixel 32 RGBA, line interleaved rawmode "C", input bits per pixel 8 band 0 only rawmode "M", input bits per pixel 8 band 1 only rawmode "Y", input bits per pixel 8 band 2 only rawmode "K", input bits per pixel 8 band 3 only rawmode "C;I", input bits per pixel 8 White is 0 || band 0 only rawmode "M;I", input bits per pixel 8 White is 0 || band 1 only rawmode "Y;I", input bits per pixel 8 White is 0 || band 2 only rawmode "K;I", input bits per pixel 8 White is 0 || band 3 only Mode "YCbCr" rawmode "YCbCr", input bits per pixel 24 Padding added || RGB triplets rawmode "YCbCr;L", input bits per pixel 24 RGB, line interleaved rawmode "YCbCrX", input bits per pixel 32 Makes a copy || RGBA, CMYK quadruples rawmode "YCbCrK", input bits per pixel 32 Makes a copy || RGBA, CMYK quadruples Mode "I" rawmode "I", input bits per pixel 32 Makes a copy || RGBA, CMYK quadruples rawmode "I;8", input bits per pixel 8 Just a C cast || UINT8 --> INT32 rawmode "I;8S", input bits per pixel 8 Little-endian || Input signed || Just a C cast || INT8 --> INT32 rawmode "I;16", input bits per pixel 16 Little-endian || Just a C cast || 16 bit pixels || UINT16 --> INT32 rawmode "I;16S", input bits per pixel 16 Little-endian || Input signed || Just a C cast || 16 bit pixels || INT16 --> INT32 rawmode "I;16B", input bits per pixel 16 Big-endian || Just a C cast || 16 bit pixels || UINT16 --> INT32 rawmode "I;16BS", input bits per pixel 16 Big-endian || Input signed || Just a C cast || 16 bit pixels || INT16 --> INT32 rawmode "I;16N", input bits per pixel 16 Native byte order || Just a C cast || 16 bit pixels || UINT16 --> INT32 rawmode "I;16NS", input bits per pixel 16 Native byte order || Input signed || Just a C cast || 16 bit pixels || INT16 --> INT32 rawmode "I;32", input bits per pixel 32 Little-endian || Just a C cast || UINT32 --> INT32 rawmode "I;32S", input bits per pixel 32 Little-endian || Input signed || Just a C cast || INT32 --> INT32 rawmode "I;32B", input bits per pixel 32 Big-endian || Just a C cast || UINT32 --> INT32 rawmode "I;32BS", input bits per pixel 32 Big-endian || Input signed || Just a C cast || INT32 --> INT32 rawmode "I;32N", input bits per pixel 32 Native byte order || Just a C cast || UINT32 --> INT32 rawmode "I;32NS", input bits per pixel 32 Native byte order || Input signed || Just a C cast || INT32 --> INT32 Mode "F" rawmode "F", input bits per pixel 32 Makes a copy || RGBA, CMYK quadruples rawmode "F;8", input bits per pixel 8 Just a C cast || UINT8 --> FLOAT32 rawmode "F;8S", input bits per pixel 8 Little-endian || Input signed || Just a C cast || INT8 --> FLOAT32 rawmode "F;16", input bits per pixel 16 Little-endian || Just a C cast || 16 bit pixels || UINT16 --> FLOAT32 rawmode "F;16S", input bits per pixel 16 Little-endian || Input signed || Just a C cast || 16 bit pixels || INT16 --> FLOAT32 rawmode "F;16B", input bits per pixel 16 Big-endian || Just a C cast || 16 bit pixels || UINT16 --> FLOAT32 rawmode "F;16BS", input bits per pixel 16 Big-endian || Input signed || Just a C cast || 16 bit pixels || INT16 --> FLOAT32 rawmode "F;16N", input bits per pixel 16 Native byte order || Just a C cast || 16 bit pixels || UINT16 --> FLOAT32 rawmode "F;16NS", input bits per pixel 16 Native byte order || Input signed || Just a C cast || 16 bit pixels || INT16 --> FLOAT32 rawmode "F;32", input bits per pixel 32 Little-endian || Just a C cast || UINT32 --> FLOAT32 rawmode "F;32S", input bits per pixel 32 Little-endian || Input signed || Just a C cast || INT32 --> FLOAT32 rawmode "F;32B", input bits per pixel 32 Big-endian || Just a C cast || UINT32 --> FLOAT32 rawmode "F;32BS", input bits per pixel 32 Big-endian || Input signed || Just a C cast || INT32 --> FLOAT32 rawmode "F;32N", input bits per pixel 32 Native byte order || Just a C cast || UINT32 --> FLOAT32 rawmode "F;32NS", input bits per pixel 32 Native byte order || Input signed || Just a C cast || INT32 --> FLOAT32 rawmode "F;32F", input bits per pixel 32 Little-endian || Just a C cast || FLOAT32 --> FLOAT32 rawmode "F;32BF", input bits per pixel 32 Big-endian || Just a C cast || FLOAT32 --> FLOAT32 rawmode "F;32NF", input bits per pixel 32 Native byte order || Just a C cast || FLOAT32 --> FLOAT32 rawmode "F;64F", input bits per pixel 64 Little-endian || Just a C cast || FLOAT64 --> FLOAT32 rawmode "F;64BF", input bits per pixel 64 Big-endian || Just a C cast || FLOAT64 --> FLOAT32 rawmode "F;64NF", input bits per pixel 64 Native byte order || Just a C cast || FLOAT64 --> FLOAT32 From kevin@cazabon.com Fri Dec 27 07:34:54 2002 From: kevin@cazabon.com (Kevin@Cazabon.com) Date: Fri, 27 Dec 2002 00:34:54 -0700 Subject: [Image-SIG] pyCMS: true ICC Color Management for PIL available! Message-ID: <000901c2ad7a$731de6b0$310aa8c0@duallie> Hey everyone; I've just posted a new module for PIL that allows you to do easy ICC color management for PIL Images. I've called it pyCMS, and it uses the littleCMS library underneath. They're both licensed under the LGPL, and are cross-platform compatible (I've only built it on Windows myself so far). It's pretty simple to use... as simple as: ################# import Image import pyCMS im = Image.open("myimage.jpg") imOut = pyCMS.profileToProfile(im, "c:\\temp\\sRGB.icm", "c:\\temp\\SWOP.icm", outputMode = "CMYK") # there's optional parameters for rendering intent, etc too imOut.save("myNewImage.jpg") ################# It's not "complete" yet, there's still a lot I want to add, but it works well for most cases already, and there's good documentation. The downloads include a pre-built windows binary (Python 2.2) and full source code. Try it out, let me know what you think. Any contributions, fixes, improvements, and suggestions are VERY welcome! I'm not an amazing C programmer, and take assistance whereever I can get it! q:] I expect to update and improve this library over the next few months, but your feedback is vital in that process, thanks! pyCMS web page: http://www.cazabon.com/pyCMS ALSO: if you build this for other platforms or other Python / PIL versions, please send me binaries so I can post them. (Thanks to Fred for some good help to get this started!) Kevin Cazabon From fredrik@pythonware.com Fri Dec 27 14:22:59 2002 From: fredrik@pythonware.com (Fredrik Lundh) Date: Fri, 27 Dec 2002 15:22:59 +0100 Subject: [Image-SIG] Bug in convert? References: <3E050B40.6080405@erols.com> Message-ID: <03b401c2adb3$778f0c90$0900a8c0@spiff> Edward C. Jones wrote: > The following program gives the unexpected answer of -2147483648. The=20 > source code for "f2i" in "Convert.c" simply casts the float to an int. = > My copy of Harbison & Steele says that the cast is undefined in this = case. PIL uses the same definition as C. From yanchaoli@shaw.ca Sun Dec 29 00:28:51 2002 From: yanchaoli@shaw.ca (yanchaoli) Date: Sat, 28 Dec 2002 16:28:51 -0800 Subject: [Image-SIG] how to get the Python.h file. Message-ID: Hello, Sir/Madam: I have downloaded your Python Imaging Library 1.1.3 Source Kit. When I compiled on the Microsoft Visual studio 6.0, then I did not fund the Python.h file, could you please let me know how to get this file? Thank you for your time. Sincerely, Yanchao Li From kevin@cazabon.com Sun Dec 29 03:58:13 2002 From: kevin@cazabon.com (Kevin@Cazabon.com) Date: Sat, 28 Dec 2002 20:58:13 -0700 Subject: [Image-SIG] how to get the Python.h file. References: Message-ID: <000b01c2aeee$82ca2310$310aa8c0@duallie> Python.h is part of the Python source code. You'll need to download the source files for the Python build you're using, and make sure that the "include" directory is set up in your compiler options. Python source code can be found easily at www.python.org for all versions. Kevin. ----- Original Message ----- From: "yanchaoli" To: Sent: Saturday, December 28, 2002 5:28 PM Subject: [Image-SIG] how to get the Python.h file. > > Hello, Sir/Madam: > > I have downloaded your Python Imaging Library 1.1.3 Source Kit. When I > compiled on the Microsoft Visual studio 6.0, then I did not fund the > Python.h file, could you please let me know how to get this file? > > Thank you for your time. > > Sincerely, > > Yanchao Li > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > From g_will@cyberus.ca Sun Dec 29 13:54:58 2002 From: g_will@cyberus.ca (Gordon Williams) Date: Sun, 29 Dec 2002 08:54:58 -0500 Subject: [Image-SIG] Changing number of colours in image Message-ID: <000901c2af41$e04d90f0$a006e640@wnt20337> Hi, I have a bunch of equations in GIF images. These are not printing properly in a pdf file format and I think it is due to the equation text not being pure black. When I take an image program and turn off the transparency and set the colour to 1 bit it then prints correctly. I would like to take these GIF images and do the same thing with PIL. After reading the documents, I couldn't figure out how this could be accomplished, but is appears like it is the kind of thing that PIL would be good at. Any hints on how this might be done would be appreciated. Regards, Gordon Williams From tony@tcapp.com Mon Dec 30 07:59:59 2002 From: tony@tcapp.com (Tony Cappellini) Date: Sun, 29 Dec 2002 23:59:59 -0800 Subject: [Image-SIG] Newbie PIL user asks about PIL features/limitations Message-ID: <5.1.0.14.0.20021229235616.0241b678@smtp.sbcglobal.net> Hello I would like to write a python program that will allow the user to resize any number of JPG images, typically from larger resolutions to smaller resolutions. I don't know what kind of knowledge about editing graphics is required to do this. I am hoping the PIL library will have a method that the user can select the new file resolution, and pass it a filename. Does PIL have these capabilities ? Would someone point me to a resource which shows an example similar to this ? thanks From jeff@corrt.com Mon Dec 30 16:34:12 2002 From: jeff@corrt.com (Jeff Kunce) Date: Mon, 30 Dec 2002 10:34:12 -0600 Subject: [Image-SIG] Newbie PIL user asks about PIL features/limitations In-Reply-To: <5.1.0.14.0.20021229235616.0241b678@smtp.sbcglobal.net> Message-ID: <5.1.0.14.0.20021230103153.00b1c128@corrt.com> >I would like to write a python program that will allow the user to resize >any number of JPG images, typically from larger resolutions to smaller >resolutions. >Does PIL have these capabilities ? >Would someone point me to a resource which shows an example similar to this ? Sure! See "Image Squeezer" at: http://starship.python.net/crew/jjkunce/ --Jeff