From djmuhlestein at gmail.com Tue Jan 2 21:42:39 2007 From: djmuhlestein at gmail.com (Dennis Muhlestein) Date: Tue, 2 Jan 2007 13:42:39 -0700 Subject: [Image-SIG] PNG Support with Parsed images. Message-ID: If I load a png file with Image.open, I can manipulate it, save it etc. If I however use ImageFile.Parser(), I can read the size, format and any info, but I can't show or manipulate the image in any way. I get this exception on any of the requested methods: Here is what I'm typing: >>> import ImageFile >>> f=open('somefile.png') >>> p=ImageFile.Parser() >>> p.feed(f.read()) >>> i=p.close() >>> i.show() Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/PIL/Image.py", line 1449, in show _showxv(self, title, command) File "/usr/lib/python2.4/site-packages/PIL/Image.py", line 2082, in _showxv file = image._dump(format=format) File "/usr/lib/python2.4/site-packages/PIL/Image.py", line 476, in _dump self.load() File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 189, in load s = read(self.decodermaxblock) File "/usr/lib/python2.4/site-packages/PIL/PngImagePlugin.py", line 365, in load_read return self.fp.read(bytes) File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 300, in read data = self.data[pos:pos+bytes] TypeError: unsubscriptable object This is with version 1.1.6. I double checked 1.1.5 and got the same thing. This works fine with a JPEG image. The PNG support appears to have a bug to me, but perhaps I'm missing something. Thanks Dennis From marshallpenguin at gmail.com Tue Jan 2 22:02:09 2007 From: marshallpenguin at gmail.com (Joey Marshall) Date: Tue, 2 Jan 2007 18:02:09 -0300 Subject: [Image-SIG] Colorize an image Message-ID: <73cf534f0701021302o18b3cb44m80a507825d09b983@mail.gmail.com> Hello, I am having a difficulty with developing my game. I would like to colorize the outfits on my penguins (http://joey101.net/projects/snowballz/). I have them separated out to make it easier to colorize... but I haven't been able to figure out how to. I already have PIL as a dependency for snowballz so I would like to use it, but there is nothing in PIL to do this easily. Does anyone know how to colorize an image? (all images are (RGBA) in red and I would like to be able to use a color like: (0,0,255) to colorize it to) Any help would be awesome. Thanks! Joey -- http://joey101.net - my blog on web development From tinodb at gmail.com Tue Jan 2 22:16:00 2007 From: tinodb at gmail.com (TiNo) Date: Tue, 2 Jan 2007 16:16:00 -0500 Subject: [Image-SIG] Compiling PIL with JPEG support does not work at all In-Reply-To: <435b46e50612271018hb77475eoe1a118ed59777f7f@mail.gmail.com> References: <435b46e50612271018hb77475eoe1a118ed59777f7f@mail.gmail.com> Message-ID: <435b46e50701021316y61932e2fv2f7d5f04352f4a0c@mail.gmail.com> Nobody any idea? 2006/12/27, TiNo : > Hi, > > I know there are many people experiencing the same problem, and there > are different solutions around, but I am still unable to compile PIL > with JPEG support. > > I am on a shared webhost (bluehost) and have build python 2.5. I am > now trying to build PIL. > > I have build jpeg-6b from http://www.ijg.org/ in > /home/spafenet/lib/lib/jpeg (that now contains bin/ and man/) > > My setup.py looks like this (relevant part:): > --------------------------------------------------------------------- > # -------------------------------------------------------------------- > # Library pointers. > # > # Use None to look for the libraries in well-known library locations. > # Use a string to specify a single directory, for both the library and > # the include files. Use a tuple to specify separate directories: > # (libpath, includepath). Examples: > # > # JPEG_ROOT = "/home/libraries/jpeg-6b" > # TIFF_ROOT = "/opt/tiff/lib", "/opt/tiff/include" > # > # If you have "lib" and "include" directories under a common parent, > # you can use the "libinclude" helper: > # > # TIFF_ROOT = libinclude("/opt/tiff") > > FREETYPE_ROOT = None > JPEG_ROOT = "/home/spafenet/lib/lib/jpeg/bin" > TIFF_ROOT = None > ZLIB_ROOT = "/home/spafenet/lib/lib/zlib/lib","/home/spafenet/lib/lib/zlib/include" > TCL_ROOT = None > > ------------------------------------------------------------------------------------ > > I have also tried JPEG_ROOT = "/home/spafenet/lib/lib/jpeg/" but that > doesn't work either. > > Building report (for both options): > > -------------------------------------------------------------------- > PIL 1.1.6 BUILD SUMMARY > -------------------------------------------------------------------- > version 1.1.6 > platform linux2 2.5 (r25:51908, Dec 18 2006, 13:56:40) > [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] > -------------------------------------------------------------------- > *** TKINTER support not available > *** JPEG support not available > --- ZLIB (PNG/ZIP) support ok > *** FREETYPE2 support not available > -------------------------------------------------------------------- > To add a missing option, make sure you have the required > library, and set the corresponding ROOT variable in the > setup.py script. > > To check the build, run the selftest.py script. > > ---------------------------------------------------------------------------- > > It works with the ZLIB though. As it takes my 1.2.3 version over the > preinstalled 1.2.1.2 version. (got a warning previously). But it > refuses to accept the JPEG. > > Any suggestions? > From fredrik at pythonware.com Wed Jan 3 10:02:58 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 3 Jan 2007 10:02:58 +0100 Subject: [Image-SIG] Compiling PIL with JPEG support does not work at all References: <435b46e50612271018hb77475eoe1a118ed59777f7f@mail.gmail.com> Message-ID: "TiNo" wrote: > I know there are many people experiencing the same problem, and there > are different solutions around, but I am still unable to compile PIL > with JPEG support. > > I am on a shared webhost (bluehost) and have build python 2.5. I am > now trying to build PIL. > > I have build jpeg-6b from http://www.ijg.org/ in > /home/spafenet/lib/lib/jpeg (that now contains bin/ and man/) PIL needs the library and include files (*.a/*.so and *.h), not the binaries. From newz at bearfruit.org Wed Jan 3 00:52:01 2007 From: newz at bearfruit.org (Matthew Nuzum) Date: Tue, 2 Jan 2007 17:52:01 -0600 Subject: [Image-SIG] Colorize an image In-Reply-To: <73cf534f0701021302o18b3cb44m80a507825d09b983@mail.gmail.com> References: <73cf534f0701021302o18b3cb44m80a507825d09b983@mail.gmail.com> Message-ID: On 1/2/07, Joey Marshall wrote: > > Hello, > I am having a difficulty with developing my game. I would like to > colorize the outfits on my penguins > (http://joey101.net/projects/snowballz/). I have them separated out to > make it easier to colorize... but I haven't been able to figure out > how to. > > I already have PIL as a dependency for snowballz so I would like to > use it, but there is nothing in PIL to do this easily. Does anyone > know how to colorize an image? (all images are (RGBA) in red and I > would like to be able to use a color like: (0,0,255) to colorize it > to) > > You will likely get much better answers from others on the list, but I've done it once. I experimented with a few different techniques and I did it simply as an experiment. I took my images in photoshop, made them black and white (er, actually, black and transparent) by grabbing the channel that had the appearance and deleting all the other channels. I then saved it out as a png with alpha transparency. That's a quick overview of how I got my png, use whatever technique works for you. Once I had my image, I loaded it into PIL and figured out the dimensions. I then created a new image and set its color to red or orange or whatever I wanted. Then I overlaid my image with alpha transparency onto the new image. I can't remember exactly what I did and I'm looking for the source and can't find it easily. However, the concept is pretty simple and you likely already know how to do all of that stuff anyway. -- Matthew Nuzum www.bearfruit.org newz2000 on freenode -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070102/6b0b8ebc/attachment.htm From fredrik at pythonware.com Thu Jan 4 20:41:22 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 04 Jan 2007 20:41:22 +0100 Subject: [Image-SIG] Error with last version PIL Image (AttributeError: pixel_access) In-Reply-To: References: Message-ID: barchia wrote: > Today I update the PIL, because I will try the new version for > check if a problem with the font are solved, instead i found a > new problem as i write in object... > > this is the trace of error: > > >>> import Image, ImageDraw > >>> im = Image.new("RGB",(30,30),'white') > >>> draw = ImageDraw.Draw(im) > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\Lib\site-packages > \PIL\ImageDraw.py", line 294, in Draw > return ImageDraw(im, mode) > File "C:\Python24\Lib\site-packages\PIL\ImageDraw.py", line 59, in > __init__ > im.load() > File "C:\Python24\Lib\site-packages\PIL\Image.py", line 599, in load > return self.im.pixel_access(self.readonly) > AttributeError: pixel_access if you installed PIL 1.1.6 over an earlier version, make sure that it's not picking an outdated _imaging.pyd file. type >>> import Image >>> Image.core to see what pyd file it's using. From david.giesen at kodak.com Thu Jan 4 22:00:00 2007 From: david.giesen at kodak.com (david.giesen at kodak.com) Date: Thu, 4 Jan 2007 16:00:00 -0500 Subject: [Image-SIG] Capturing the Tkinter Canvas to the Windows Clipboard Message-ID: Hi - I've searched all over and I can't figure out how to transfer an image of the Tkinter Canvas to the Windows clipboard (or any clipboard, for that matter). I've use the PIL to capture and display an image of the Canvas, but I can't figure out how to put that image into the clipboard directly. Yes, I can capture it, display it automatically using Windows Paint and use "copy" in that program to put it in the clipboard, but that seems, well, clunky. Do you have any suggestions how I might do this? I've spent a considerable amount of time googling this to no avail, so I'm sorry if this is an FAQ that I should know. Thanks in advance for any help! Dave Giesen From Chris.Barker at noaa.gov Thu Jan 4 21:16:44 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 04 Jan 2007 12:16:44 -0800 Subject: [Image-SIG] Fw: Python - WEIRD Code needed (help with) In-Reply-To: <028701c72659$bc02bf70$0a03010a@mail2world.com> References: <028701c72659$bc02bf70$0a03010a@mail2world.com> Message-ID: <459D60AC.6040802@noaa.gov> You'll need to be a little more clear about what you're asking: 1) how to call a python program from VB -- I have no idea, try comp.lang.python, or a PyWin32 mailing list if there is one. Although calling a python program as a command line program from VB should be trivial -- but why use Python for that? Why not go all the way? 2) How to do this all in Python -- If you want a GUI, you need to choose a toolkit first -- I recommend wxPython, but TkInter, PYGTK, PyQT, etc are good options, too. 3) How to do the image generation/manipulation -- then PIL (and this list) may be the best place, but you could also just do it straight with the GUI toolkit (wxPython anyway). You might also want to use the "numpy" package -- it's a good way to manipulate arrays of numbers. 4) If you want the equivalent of video feedback, but without actual images, just numbers, then numpy is definitely a good way to go. If I wanted to write a program that demonstrated video feedback, I'd probably do the number crunching with numpy, and make a GUI to display and manipulate the results in wxPython. I'm not sure where VB would fit into this. -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From fredrik at pythonware.com Fri Jan 5 08:06:32 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 05 Jan 2007 08:06:32 +0100 Subject: [Image-SIG] Capturing the Tkinter Canvas to the Windows Clipboard In-Reply-To: References: Message-ID: david.giesen at kodak.com wrote: > I've searched all over and I can't figure out how to transfer an image of > the Tkinter Canvas to the Windows clipboard (or any clipboard, for that > matter). I've use the PIL to capture and display an image of the Canvas, > but I can't figure out how to put that image into the clipboard directly. > Yes, I can capture it, display it automatically using Windows Paint and > use "copy" in that program to put it in the clipboard, but that seems, > well, clunky. PIL can copy from the clipboard, but not to it. here's the relevant issue tracker item: http://effbot.python-hosting.com/ticket/23 contributions are welcome! (a ctypes-based implementation would be good start, I think). From colin.barnette at gmail.com Fri Jan 5 09:44:49 2007 From: colin.barnette at gmail.com (Colin Barnette) Date: Fri, 5 Jan 2007 03:44:49 -0500 Subject: [Image-SIG] Image.load() issues. Message-ID: I'm having some really odd trouble with PIL. As shown on in the Handbook I have: import Image print Image.VERSION img = Image.load("sushi.jpg") And the output I get is this: 1.1.6 Traceback (most recent call last): File "pichtml.py", line 5, in ? img = Image.load("sushi.jpg") AttributeError: 'module' object has no attribute 'load' So I tried: img = Image.Image.load("sushi.jpg") Traceback (most recent call last): File "pichtml.py", line 3, in ? img = Image.Image.load("sushi.jpg") TypeError: unbound method load() must be called with Image instance as first argument (got str instance instead) And finally: img = Image.Image() img.load("sushi.jpg") Traceback (most recent call last): File "D:\pichtml.py", line 4, in ? img.load("sushi.jpg") TypeError: load() takes exactly 1 argument (2 given) What am I doing wrong? Any help or ideas would be appreciated. From fredrik at pythonware.com Fri Jan 5 13:27:37 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 5 Jan 2007 13:27:37 +0100 Subject: [Image-SIG] Image.load() issues. References: Message-ID: Colin Barnette wrote: > I'm having some really odd trouble with PIL. As shown on in the Handbook I have: what handbook is this? > import Image > > print Image.VERSION > img = Image.load("sushi.jpg") if you want to open an image file, use "open": img = Image.open("sushi.jpg") From david.giesen at kodak.com Fri Jan 5 14:06:59 2007 From: david.giesen at kodak.com (david.giesen at kodak.com) Date: Fri, 5 Jan 2007 08:06:59 -0500 Subject: [Image-SIG] Capturing the Tkinter Canvas to the Windows Clipboard Message-ID: OK, thanks for the info. Unfortunately, programming such a thing is far beyond my skills, so I won't be able to contribute much. I take it there is probably no non-PIL-based solution either? Thanks again - Dave Giesen From sittner at lkb.ens.fr Fri Jan 5 15:24:00 2007 From: sittner at lkb.ens.fr (sittner at lkb.ens.fr) Date: Fri, 5 Jan 2007 15:24:00 +0100 (CET) Subject: [Image-SIG] installation problem for imaging 1.1.6 on ubuntu 6.06 In-Reply-To: References: Message-ID: <55228.129.199.118.95.1168007040.squirrel@mailgate.phys.ens.fr> Hello everyone and happy new year, i am trying to install imaging 1.1.5 on my ubuntu 6.06 machine, and i get this message: r:/usr/lib/python2.4/site-packages/Imaging-1.1.5$ python setup.py install running install running build running build_py running build_ext building '_imaging' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/include -I/usr/local/include -I/usr/include/python2.4 -c _imaging.c -o build/temp.linux-i686-2.4/_imaging.o In file included from /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h:7, from /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:11, from /usr/include/python2.4/Python.h:18, from _imaging.c:74: /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:122:61: error: limits.h: No such file or directory In file included from _imaging.c:74: /usr/include/python2.4/Python.h:32:19: error: stdio.h: No such file or directory /usr/include/python2.4/Python.h:34:5: error: #error "Python.h requires that stdio.h define NULL." /usr/include/python2.4/Python.h:37:20: error: string.h: No such file or directory /usr/include/python2.4/Python.h:38:19: error: errno.h: No such file or directory . . . . /usr/include/python2.4/pyport.h:73: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?Py_uintptr_t? /usr/include/python2.4/pyport.h:74: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?Py_intptr_t? /usr/include/python2.4/pyport.h:94:76: error: math.h: No such file or directory /usr/include/python2.4/pyport.h:101:22: error: sys/time.h: No such file or directory /usr/include/python2.4/pyport.h:102:18: error: time.h: No such file or directory /usr/include/python2.4/pyport.h:120:24: error: sys/select.h: No such file or directory /usr/include/python2.4/pyport.h:159:22: error: sys/stat.h: No such file or directory . . . . _imaging.c: In function ?_getcodecstatus?: _imaging.c:2574: warning: return from incompatible pointer type _imaging.c: In function ?_save_ppm?: _imaging.c:2608: warning: return from incompatible pointer type _imaging.c:2611: warning: return from incompatible pointer type _imaging.c: At top level: _imaging.c:2709: error: initializer element is not constant _imaging.c:2709: error: (near initialization for ?methods[53].ml_name?) _imaging.c:2709: error: initializer element is not constant _imaging.c:2709: error: (near initialization for ?methods[53].ml_meth?) _imaging.c: In function ?_getattr?: _imaging.c:2733: warning: passing argument 3 of ?PyCObject_FromVoidPtrAndDesc? from incompatible pointer type _imaging.c:2735: warning: return from incompatible pointer type _imaging.c: At top level: _imaging.c:2778: error: initializer element is not constant _imaging.c:2778: error: (near initialization for ?Imaging_Type.ob_type?) _imaging.c:2799: error: initializer element is not constant _imaging.c:2799: error: (near initialization for ?ImagingFont_Type.ob_type?) _imaging.c:2811: error: initializer element is not constant _imaging.c:2811: error: (near initialization for ?ImagingDraw_Type.ob_type?) _imaging.c:2966: error: initializer element is not constant _imaging.c:2966: error: (near initialization for ?functions[37].ml_name?) _imaging.c:2966: error: initializer element is not constant _imaging.c:2966: error: (near initialization for ?functions[37].ml_meth?) error: command 'gcc' failed with exit status 1 what's the problem here? From michele.petrazzo at unipex.it Fri Jan 5 17:28:09 2007 From: michele.petrazzo at unipex.it (Michele Petrazzo) Date: Fri, 05 Jan 2007 17:28:09 +0100 Subject: [Image-SIG] installation problem for imaging 1.1.6 on ubuntu 6.06 In-Reply-To: <55228.129.199.118.95.1168007040.squirrel@mailgate.phys.ens.fr> References: <55228.129.199.118.95.1168007040.squirrel@mailgate.phys.ens.fr> Message-ID: <459E7C99.1020101@unipex.it> sittner at lkb.ens.fr wrote: > Hello everyone and happy new year, Also to you :) > i am trying to install imaging 1.1.5 on my ubuntu 6.06 machine, and i > get this message: > A couple of questions: - why the 1.1.5? There is the 1.1.6 - why by sources? ubuntu hasn't the pil package from its repository? on Debian: michele:~$ apt-cache search python imaging <-cut-> python-imaging - have you installed the libc6 (I think, or libc5) -dev package? always on debian: michele:~$ dpkg -L libc6-dev | grep limits /usr/include/limits.h michele:~$ So, reading your error, I see a lot of "No such file or directory", so install the python-dev, libc6-dev and so on... Or (better solution), apt-get install python-imaging! Bye, Michele -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3273 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/image-sig/attachments/20070105/b30e97d9/attachment.bin From Chris.Barker at noaa.gov Fri Jan 5 22:41:15 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 05 Jan 2007 13:41:15 -0800 Subject: [Image-SIG] Capturing the Tkinter Canvas to the Windows Clipboard In-Reply-To: References: Message-ID: <459EC5FB.4000704@noaa.gov> david.giesen at kodak.com wrote: > I take it there is probably no non-PIL-based solution either? wxPython can take a PIL image, and can put images on the Clipboard (I'm pretty sure -- I've never done it) . Maybe tk can too. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From marshallpenguin at gmail.com Sat Jan 6 16:25:21 2007 From: marshallpenguin at gmail.com (Joey Marshall) Date: Sat, 6 Jan 2007 12:25:21 -0300 Subject: [Image-SIG] Colorize an image In-Reply-To: References: <73cf534f0701021302o18b3cb44m80a507825d09b983@mail.gmail.com> Message-ID: <73cf534f0701060725v58e930e0h3d38e2f7d3909a04@mail.gmail.com> On 1/2/07, Matthew Nuzum wrote: > On 1/2/07, Joey Marshall wrote: > > Hello, > > I am having a difficulty with developing my game. I would like to > > colorize the outfits on my penguins > > (http://joey101.net/projects/snowballz/). I have them > separated out to > > make it easier to colorize... but I haven't been able to figure out > > how to. > > > > I already have PIL as a dependency for snowballz so I would like to > > use it, but there is nothing in PIL to do this easily. Does anyone > > know how to colorize an image? (all images are (RGBA) in red and I > > would like to be able to use a color like: (0,0,255) to colorize it > > to) > > > > > > You will likely get much better answers from others on the list, but I've > done it once. I experimented with a few different techniques and I did it > simply as an experiment. I took my images in photoshop, made them black and > white (er, actually, black and transparent) by grabbing the channel that had > the appearance and deleting all the other channels. I then saved it out as a > png with alpha transparency. That's a quick overview of how I got my png, > use whatever technique works for you. > > Once I had my image, I loaded it into PIL and figured out the dimensions. I > then created a new image and set its color to red or orange or whatever I > wanted. Then I overlaid my image with alpha transparency onto the new image. > > I can't remember exactly what I did and I'm looking for the source and can't > find it easily. However, the concept is pretty simple and you likely already > know how to do all of that stuff anyway. > -- > Matthew Nuzum > www.bearfruit.org > newz2000 on freenode That would be cool if you could find the source. I must admit that I'm very new to PIL and image manipulation itself. Thanks Matthew. If anyone else has help on this please do tell! :) -- http://joey101.net - my blog on web development From fredrik at pythonware.com Sat Jan 6 16:33:18 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat, 06 Jan 2007 16:33:18 +0100 Subject: [Image-SIG] installation problem for imaging 1.1.6 on ubuntu 6.06 In-Reply-To: <55228.129.199.118.95.1168007040.squirrel@mailgate.phys.ens.fr> References: <55228.129.199.118.95.1168007040.squirrel@mailgate.phys.ens.fr> Message-ID: sittner at lkb.ens.fr wrote: > i am trying to install imaging 1.1.5 on my ubuntu 6.06 machine, and i get > this message: > /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:122:61: error: > limits.h: No such file or directory your C compiler installation is not complete. $ sudo apt-get install build-essential should do the trick. From nicolas at famillepinault.fr Tue Jan 9 22:09:01 2007 From: nicolas at famillepinault.fr (Nicolas Pinault) Date: Tue, 09 Jan 2007 22:09:01 +0100 Subject: [Image-SIG] RGBA to P problem Message-ID: <45A4046D.9040505@famillepinault.fr> Hi, I have an application where I need to convert RGBA images(png) to P images (gif or png). I use im.convert("P") to do the conversion. The problem comes with alpha channel. The resulting P mode image does not contain any tranparency information. Transparency is set to none and transparent pixels are set to black (in my test). I tried to add an alpha channel after the conversion with im.putalpha(alpha). This converts the image back to RGBA mode. Is there a smart way to do the convertion ? Nicolas Pinault From ned at nedbatchelder.com Tue Jan 9 22:40:53 2007 From: ned at nedbatchelder.com (Ned Batchelder) Date: Tue, 09 Jan 2007 16:40:53 -0500 Subject: [Image-SIG] Clipped text, still. Message-ID: <45A40BE5.7010904@nedbatchelder.com> I tried installing 1.1.6, mostly to see the improvements in clipped text. PIL 1.1.5 would clip pieces of text that extended beyond the character width, and would wrap those pixels around to the other side of the image. So "joe" might lose part of the bulb of the j and display it below the e. But 1.1.6 still clips the bulb. It no longer transports the lost pixels to the other end of the string, but the clipping still happens. Is there some new calling technique that I don't know about to get all of the text displayed? I also see low descenders still being clipped (like the bottoms of g's). I'm running on Windows, Python 2.4, PIL 1.1.6 installed from binaries, using Georgia font. --Ned. -- Ned Batchelder, http://nedbatchelder.com From Scott.Daniels at Acm.Org Wed Jan 10 07:09:25 2007 From: Scott.Daniels at Acm.Org (Scott David Daniels) Date: Tue, 09 Jan 2007 22:09:25 -0800 Subject: [Image-SIG] Clipped text, still. In-Reply-To: <45A40BE5.7010904@nedbatchelder.com> References: <45A40BE5.7010904@nedbatchelder.com> Message-ID: Ned Batchelder wrote: > I tried installing 1.1.6, mostly to see the improvements in clipped > text. PIL 1.1.5 would clip pieces of text that extended beyond the > character width, and would wrap those pixels around to the other side of > the image. So "joe" might lose part of the bulb of the j and display it > below the e. > > But 1.1.6 still clips the bulb. It no longer transports the lost pixels > to the other end of the string, but the clipping still happens. Is > there some new calling technique that I don't know about to get all of > the text displayed? I also see low descenders still being clipped (like > the bottoms of g's). Sounds like you are running into the edge of the writing area, but expect PIL to ignore the clipping boundary for letters that are partially inside the clipped area. -- Scott David Daniels Scott.Daniels at Acm.Org From lab_monkey at mail2world.com Sat Jan 6 06:39:29 2007 From: lab_monkey at mail2world.com (Ior Bock) Date: Fri, 5 Jan 2007 21:39:29 -0800 Subject: [Image-SIG] Video Feedback Emulation Message-ID: <2f5a601c73155$08e56120$70cb010a@mail2world.com> Thanks Chris, That helps steer me in the right direction for tool selection. What Im specifically stuck on however, is a basic idea on how to do emulate video feedback..... <-----Original Message-----> From: Christopher Barker [Chris.Barker at noaa.gov] Sent: 1/4/2007 12:16:44 PM To: Ior Bock; image-sig at python.org Subject: Re: [Image-SIG] Fw: Python - WEIRD Code needed (help with) You'll need to be a little more clear about what you're asking: 1) how to call a python program from VB -- I have no idea, try comp.lang.python, or a PyWin32 mailing list if there is one. Although calling a python program as a command line program from VB should be trivial -- but why use Python for that? Why not go all the way? 2) How to do this all in Python -- If you want a GUI, you need to choose a toolkit first -- I recommend wxPython, but TkInter, PYGTK, PyQT, etc are good options, too. 3) How to do the image generation/manipulation -- then PIL (and this list) may be the best place, but you could also just do it straight with the GUI toolkit (wxPython anyway). You might also want to use the "numpy" package -- it's a good way to manipulate arrays of numbers. 4) If you want the equivalent of video feedback, but without actual images, just numbers, then numpy is definitely a good way to go. If I wanted to write a program that demonstrated video feedback, I'd probably do the number crunching with numpy, and make a GUI to display and manipulate the results in wxPython. I'm not sure where VB would fit into this. -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov . Click to consolidate your debt and lower your monthly expenses

_______________________________________________________________
Get the Free email that has everyone talking at http://www.mail2world.com
Unlimited Email Storage – POP3 – Calendar – SMS – Translator – Much More!
-------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070105/e3d2c9bf/attachment.htm From dshimer at gmail.com Thu Jan 11 10:42:23 2007 From: dshimer at gmail.com (Dennis Shimer) Date: Thu, 11 Jan 2007 04:42:23 -0500 Subject: [Image-SIG] Tiff not reading dpi Message-ID: <99ea8b7b0701110142g5e59ffa0t687eaaf71051b844@mail.gmail.com> I have a tif image that at least 3 different programs can see the correct dpi information in (Irfanview, Gimp, Alchemy) but when I read the image using pil 1.6 print im.info - shows only {'compression': 'raw'} dpix,dpiy=im.info['dpi'] - gives an exception and if I set it explicitely then using im.save(filename,dpi=(dpix,dpiy)) Irfanview sees the new dpi. Gimp complains that "resoultion units are meaningless" and Alchemy sees no DPI info at all but doesn't complain. Is there any reason that there is so much inconsistancy in results, or a way to write dpi with pil that would be universally recognized? From dshimer at gmail.com Thu Jan 11 12:42:03 2007 From: dshimer at gmail.com (Dennis Shimer) Date: Thu, 11 Jan 2007 06:42:03 -0500 Subject: [Image-SIG] Copying Tiff tags to new image Message-ID: <99ea8b7b0701110342w14e2c7bdx5a256e79071f8c83@mail.gmail.com> I am doing some basic modification to existing TIFF files using PIL (1.6 in python 2.5). When I open the image there is quite a bit of info in the tags dict that I would like to save with the new image. Apparently (based on other forums I've seen) once you process the image all the TIFF specific data gets lost. I can copy the info but can't find an example of how to copy or re-assign it to the new image. For example import Image,TiffImagePlugin im=Image.open('oldname.tif','r') tags=im.tag.tags im.rotate(90,0).save('newname.tif') will open an image named oldname.tif, save the tags, then save a new image that has been rotated by 90. How can I assign those tags back to the new image? Or what important concepts am I just totally missing? From Travis.Cochran at analog.com Thu Jan 11 15:53:30 2007 From: Travis.Cochran at analog.com (Cochran, Travis) Date: Thu, 11 Jan 2007 09:53:30 -0500 Subject: [Image-SIG] PIL 1.1.6 eval function Message-ID: <4F19D8A3D7B26247A4481AE28348A848049FE0C3@gboexm2.ad.analog.com> I'm trying to use the Image.eval function on a JPEG image. I can't seem to find the right syntax for entering the function and it gives me errors for the variables I try to use, "R,G,B". Any idea what I'm doing wrong? -Travis Cochran From dshimer at gmail.com Thu Jan 11 16:44:00 2007 From: dshimer at gmail.com (Dennis Shimer) Date: Thu, 11 Jan 2007 10:44:00 -0500 Subject: [Image-SIG] PIL 1.1.6 eval function In-Reply-To: <99ea8b7b0701110743l744bfb4cyf086bf313a1b8cee@mail.gmail.com> References: <4F19D8A3D7B26247A4481AE28348A848049FE0C3@gboexm2.ad.analog.com> <99ea8b7b0701110743l744bfb4cyf086bf313a1b8cee@mail.gmail.com> Message-ID: <99ea8b7b0701110744l2e881938nd74fda2f27b93b5b@mail.gmail.com> This worked for me. open an image object, I'll call im Write a function that you would like applied to each pixel of im, here is a dumb one that will just double the value this making the new image very very bright. def function(pixel): return pixel*2 Then eval the image based on the function Image.eval(im2,function).show() or save it to a new image which you can save newimage=Image.eval(im2,function) Dennis Shimer On 1/11/07, Cochran, Travis wrote: > I'm trying to use the Image.eval function on a JPEG image. I can't seem > to find the right syntax for entering the function and it gives me > errors for the variables I try to use, "R,G,B". Any idea what I'm doing > wrong? > -Travis Cochran > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From robin at squiredeck.com.au Sat Jan 13 11:52:39 2007 From: robin at squiredeck.com.au (Robin Whitlock) Date: Sat, 13 Jan 2007 18:52:39 +0800 Subject: [Image-SIG] Plone Imaging User Message-ID: <20070113104735.M38521@squiredeck.com.au> Hi, I felt I would ilke to comment on why it was so hard to get PIL installed into my Plone 2.5 environment on an X86_64 FC3 box. This is not a winge, but more like it would be nice to have a 64 bit howto in the docs somewhere so the less priveliged may find the install easier. As it happens I needed to go back to 1.1.4 so that I could edit the Make file, is this still not an option with the later versions (to change compiler options). Hope this can lead to helping others, thanks for your time. -- Robin Whitlock Director - Squiredeck C/- Open WebMail Project (http://openwebmail.org) From dshimer at gmail.com Thu Jan 11 17:12:53 2007 From: dshimer at gmail.com (Dennis Shimer) Date: Thu, 11 Jan 2007 11:12:53 -0500 Subject: [Image-SIG] PIL 1.1.6 eval function In-Reply-To: <4F19D8A3D7B26247A4481AE28348A848049FE1ED@gboexm2.ad.analog.com> References: <4F19D8A3D7B26247A4481AE28348A848049FE1ED@gboexm2.ad.analog.com> Message-ID: <99ea8b7b0701110812n594dbc34i30e2bda7e1d5bdf5@mail.gmail.com> How about if you im=Image.open('red.jpg','r') which will give you open jpeg object then Image.eval(im,function).show() or if you want to do it all on one line Image.eval(Image.open('red.jpg','r'),function).show() Dennis On 1/11/07, Cochran, Travis wrote: > I tried that and got this error. > > > Traceback (most recent call last): > File "C:\Documents and Settings\tcochra\My Documents\test", line 6, in > -toplevel- > Image.eval("red.jpg",function).show() > File "C:\Python24\Lib\site-packages\PIL\Image.py", line 1979, in eval > return image.point(args[0]) > AttributeError: 'str' object has no attribute 'point' > > > > Could it be a problem with the IJG JEPG library? I reinstalled PIL and > still get the error. Thanks for you help. > > -Travis Cochran > > -----Original Message----- > From: Dennis Shimer [mailto:dshimer at gmail.com] > Sent: Thursday, January 11, 2007 10:43 AM > To: Cochran, Travis > Subject: Re: [Image-SIG] PIL 1.1.6 eval function > > This worked for me. > > open an image object, I'll call im > > Write a function that you would like applied to each pixel of im, here > is a dumb one that will just double the value this making the new image > very very bright. > > def function(pixel): > return pixel*2 > > Then eval the image based on the function > > Image.eval(im2,function).show() > > or save it to a new image which you can save > > newimage=Image.eval(im2,function) > > Dennis Shimer > > > On 1/11/07, Cochran, Travis wrote: > > I'm trying to use the Image.eval function on a JPEG image. I can't > > seem to find the right syntax for entering the function and it gives > > me errors for the variables I try to use, "R,G,B". Any idea what I'm > > doing wrong? > > -Travis Cochran > > _______________________________________________ > > Image-SIG maillist - Image-SIG at python.org > > http://mail.python.org/mailman/listinfo/image-sig > > > From ned at nedbatchelder.com Wed Jan 10 19:12:19 2007 From: ned at nedbatchelder.com (Ned Batchelder) Date: Wed, 10 Jan 2007 13:12:19 -0500 Subject: [Image-SIG] Clipped text, still. In-Reply-To: References: <45A40BE5.7010904@nedbatchelder.com> Message-ID: <45A52C83.2070102@nedbatchelder.com> In this case, there is no clipping boundary, and there are plenty of pixels to accommodate the extremeties of the letters. The wrapping has been fixed, but the clipping still occurs. Is this true or not? --Ned. Scott David Daniels wrote: > Ned Batchelder wrote: > >> I tried installing 1.1.6, mostly to see the improvements in clipped >> text. PIL 1.1.5 would clip pieces of text that extended beyond the >> character width, and would wrap those pixels around to the other side of >> the image. So "joe" might lose part of the bulb of the j and display it >> below the e. >> >> But 1.1.6 still clips the bulb. It no longer transports the lost pixels >> to the other end of the string, but the clipping still happens. Is >> there some new calling technique that I don't know about to get all of >> the text displayed? I also see low descenders still being clipped (like >> the bottoms of g's). >> > > Sounds like you are running into the edge of the writing area, > but expect PIL to ignore the clipping boundary for letters that > are partially inside the clipped area. > > -- Scott David Daniels > Scott.Daniels at Acm.Org > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > > > -- Ned Batchelder, http://nedbatchelder.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070110/16c157ef/attachment.htm From ned at nedbatchelder.com Thu Jan 11 18:07:03 2007 From: ned at nedbatchelder.com (Ned Batchelder) Date: Thu, 11 Jan 2007 12:07:03 -0500 Subject: [Image-SIG] PIL 1.1.6 eval function In-Reply-To: <99ea8b7b0701110744l2e881938nd74fda2f27b93b5b@mail.gmail.com> References: <4F19D8A3D7B26247A4481AE28348A848049FE0C3@gboexm2.ad.analog.com> <99ea8b7b0701110743l744bfb4cyf086bf313a1b8cee@mail.gmail.com> <99ea8b7b0701110744l2e881938nd74fda2f27b93b5b@mail.gmail.com> Message-ID: <45A66EB7.3030903@nedbatchelder.com> The important thing to remember about eval() is that it does not operate on the entire pixel: the function is for a single color channel at a time, and behaves the same on all channels in the image. So your function takes a single argument, and returns a single value. Then the function is used to adjust the values of pixels one channel at a time. Also, the function isn't actually evaluated for each pixel: it is used to build a lookup table, then the table is used to remap values. --Ned. Dennis Shimer wrote: > This worked for me. > > open an image object, I'll call im > > Write a function that you would like applied to each pixel of im, here > is a dumb one that will just double the value this making the new > image very very bright. > > def function(pixel): > return pixel*2 > > Then eval the image based on the function > > Image.eval(im2,function).show() > > or save it to a new image which you can save > > newimage=Image.eval(im2,function) > > Dennis Shimer > > > On 1/11/07, Cochran, Travis wrote: > >> I'm trying to use the Image.eval function on a JPEG image. I can't seem >> to find the right syntax for entering the function and it gives me >> errors for the variables I try to use, "R,G,B". Any idea what I'm doing >> wrong? >> -Travis Cochran >> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> >> > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > > > -- Ned Batchelder, http://nedbatchelder.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070111/968f6ff0/attachment.html From Scott.Daniels at Acm.Org Tue Jan 16 05:06:25 2007 From: Scott.Daniels at Acm.Org (Scott David Daniels) Date: Mon, 15 Jan 2007 20:06:25 -0800 Subject: [Image-SIG] Clipped text, still. In-Reply-To: <45A52C83.2070102@nedbatchelder.com> References: <45A40BE5.7010904@nedbatchelder.com> <45A52C83.2070102@nedbatchelder.com> Message-ID: Ned Batchelder wrote: >>> I tried installing 1.1.6, mostly to see the improvements in clipped >>> text. PIL 1.1.5 would clip pieces of text ... and wrap those pixels.... >>> So "joe" might lose part of the bulb of the j and display it below the e. >>> >>> But 1.1.6 still clips the bulb. It no longer transports the lost >>> pixels to the other end of the string.... > Scott David Daniels wrote: >> Sounds like you are running into the edge of the writing area, >> but expect PIL to ignore the clipping boundary for letters that >> are partially inside the clipped area. > In this case, there is no clipping boundary, and there are plenty of > pixels to accommodate the extremeties of the letters. The wrapping has > been fixed, but the clipping still occurs. Is this true or not? Well, it sounds to me like you need to provide code, not simply describe what might be going on. There's no reason to debug a description if you can make a simple small example (and that example will be needed for a regression test in any case). -- Scott David Daniels Scott.Daniels at Acm.Org From kemmerling at gmx.at Tue Jan 16 06:57:32 2007 From: kemmerling at gmx.at (Markus Kemmerling) Date: Tue, 16 Jan 2007 06:57:32 +0100 Subject: [Image-SIG] Tiff not reading dpi In-Reply-To: <99ea8b7b0701110142g5e59ffa0t687eaaf71051b844@mail.gmail.com> References: <99ea8b7b0701110142g5e59ffa0t687eaaf71051b844@mail.gmail.com> Message-ID: <1B5C2AE3-FEAD-440F-8139-A10E62A76E70@gmx.at> The Tiff image plugin handles the RESOLUTION_UNIT field incorrectly, see http://mail.python.org/pipermail/image-sig/2006-July/004011.html. Markus Kemmerling Medical University Vienna Am 11.01.2007 um 10:42 schrieb Dennis Shimer: > I have a tif image that at least 3 different programs can see the > correct dpi information in > (Irfanview, Gimp, Alchemy) but when I read the image using pil 1.6 > > print im.info - shows only {'compression': 'raw'} > dpix,dpiy=im.info['dpi'] - gives an exception > > and if I set it explicitely then using > im.save(filename,dpi=(dpix,dpiy)) > > Irfanview sees the new dpi. > Gimp complains that "resoultion units are meaningless" > and Alchemy sees no DPI info at all but doesn't complain. > > Is there any reason that there is so much inconsistancy in results, or > a way to write dpi with pil that would be universally recognized? > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From dshimer at gmail.com Tue Jan 16 12:20:22 2007 From: dshimer at gmail.com (Dennis Shimer) Date: Tue, 16 Jan 2007 06:20:22 -0500 Subject: [Image-SIG] Tiff not reading dpi In-Reply-To: <1B5C2AE3-FEAD-440F-8139-A10E62A76E70@gmx.at> References: <99ea8b7b0701110142g5e59ffa0t687eaaf71051b844@mail.gmail.com> <1B5C2AE3-FEAD-440F-8139-A10E62A76E70@gmx.at> Message-ID: <99ea8b7b0701160320t60d8189bs89739d766238e96@mail.gmail.com> Fantastic, thanks so much, that is exactly the fix I needed. On 1/16/07, Markus Kemmerling wrote: > The Tiff image plugin handles the RESOLUTION_UNIT field incorrectly, > see http://mail.python.org/pipermail/image-sig/2006-July/004011.html. > > Markus Kemmerling > Medical University Vienna > > Am 11.01.2007 um 10:42 schrieb Dennis Shimer: > > > I have a tif image that at least 3 different programs can see the > > correct dpi information in > > (Irfanview, Gimp, Alchemy) but when I read the image using pil 1.6 > > > > print im.info - shows only {'compression': 'raw'} > > dpix,dpiy=im.info['dpi'] - gives an exception > > > > and if I set it explicitely then using > > im.save(filename,dpi=(dpix,dpiy)) > > > > Irfanview sees the new dpi. > > Gimp complains that "resoultion units are meaningless" > > and Alchemy sees no DPI info at all but doesn't complain. > > > > Is there any reason that there is so much inconsistancy in results, or > > a way to write dpi with pil that would be universally recognized? > > _______________________________________________ > > Image-SIG maillist - Image-SIG at python.org > > http://mail.python.org/mailman/listinfo/image-sig > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From ned at nedbatchelder.com Tue Jan 16 13:10:02 2007 From: ned at nedbatchelder.com (Ned Batchelder) Date: Tue, 16 Jan 2007 07:10:02 -0500 Subject: [Image-SIG] Clipped text, still. In-Reply-To: References: <45A40BE5.7010904@nedbatchelder.com> <45A52C83.2070102@nedbatchelder.com> Message-ID: <45ACC09A.9040404@nedbatchelder.com> OK, here's some code, and some output. (My emails seem to be consistently held for moderation; I apologize for the apparent delays in responding). This code (in a Django view function): im = Image.new("RGB", (300, 300), '#ffffc0') draw = ImageDraw.Draw(im) font = ImageFont.truetype('timesbi.ttf', 50) draw.text((100, 100), "jigf", font=font, fill='black') response = HttpResponse(mimetype='image/png') im.save(response, 'PNG') return response produces two different results, attached. One is with PIL 1.1.5, the other with 1.1.6. 1.1.5 produces the text in the proper place, but with the bulbs of the j and f wrapped around to the other end of the text. 1.1.6 doesn't wrap the bulbs, but has clipped the j severely, and has mis-positioned the text so as to keep the entire f in the drawing. Is this not something other people are seeing? --Ned. Scott David Daniels wrote: > Ned Batchelder wrote: > >>>> I tried installing 1.1.6, mostly to see the improvements in clipped >>>> text. PIL 1.1.5 would clip pieces of text ... and wrap those pixels.... >>>> So "joe" might lose part of the bulb of the j and display it below the e. >>>> >>>> But 1.1.6 still clips the bulb. It no longer transports the lost >>>> pixels to the other end of the string.... >>>> > > Scott David Daniels wrote: > >> Sounds like you are running into the edge of the writing area, > >> but expect PIL to ignore the clipping boundary for letters that > >> are partially inside the clipped area. > > >> In this case, there is no clipping boundary, and there are plenty of >> pixels to accommodate the extremeties of the letters. The wrapping has >> been fixed, but the clipping still occurs. Is this true or not? >> > > Well, it sounds to me like you need to provide code, not simply > describe what might be going on. There's no reason to debug a > description if you can make a simple small example (and that > example will be needed for a regression test in any case). > > -- Scott David Daniels > Scott.Daniels at Acm.Org > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > > > -- Ned Batchelder, http://nedbatchelder.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070116/ed6c3a28/attachment-0001.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: jigf_116.png Type: image/png Size: 6947 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20070116/ed6c3a28/attachment-0002.png -------------- next part -------------- A non-text attachment was scrubbed... Name: jigf_115.png Type: image/png Size: 7270 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20070116/ed6c3a28/attachment-0003.png From Scott.Daniels at Acm.Org Tue Jan 16 16:47:57 2007 From: Scott.Daniels at Acm.Org (Scott David Daniels) Date: Tue, 16 Jan 2007 07:47:57 -0800 Subject: [Image-SIG] Interesting Bounding box calculation In-Reply-To: <45ACC09A.9040404@nedbatchelder.com> References: <45A40BE5.7010904@nedbatchelder.com> <45A52C83.2070102@nedbatchelder.com> <45ACC09A.9040404@nedbatchelder.com> Message-ID: Ned Batchelder wrote: > OK, here's some code, and some output.... After looking, and doing a bit of experimenting, here is a surprising drawing: import Image, ImageDraw, ImageFont def paints(fontname='timesbi.ttf', fontsize=50, canvas=(500, 700), position=(100, 100)): im = Image.new("RGB", canvas, '#ffffc0') draw = ImageDraw.Draw(im) font = ImageFont.truetype(fontname, fontsize) fh, fx = font.getmetrics() x, y = position for text in ['j_0_|igf', ' j_1_|igf', ' j_2_|igf', 'young']: width, height = font.getsize(text) # w,h draw.rectangle((x, y, x+width, y+height), fill='lightgrey', outline='lightgreen') draw.rectangle((x-fx, y, x, y+fh), fill='lightgrey', outline='red') draw.text((x, y), text, font=font, fill='black') y += 100 return im paints().show() -- Scott David Daniels Scott.Daniels at Acm.Org From rowen at cesmail.net Tue Jan 16 22:32:55 2007 From: rowen at cesmail.net (Russell E Owen) Date: Tue, 16 Jan 2007 13:32:55 -0800 Subject: [Image-SIG] PIL 1.1.6 gotcha; Image.frombuffer Message-ID: My python code started generating warnings when used with PIL 1.1.6 in Image.frombuffer. The warning says to specify all arguments, to avoid problems when a default will change. But either the warning is wrong or I misread it because I thought it said: Image.frombuffer(mode, shape, data, "raw", mode, 0, 1) But when I did this my images were upside down. The final 1 should be -1 if you want the old default behavior. In other words: Image.frombuffer(mode, size, data) should be changed to: Image.frombuffer(mode, size, data, "raw", mode, 0, -1) -- Russell P.S. it would be a big help if the manual were explicit about what the old default orientation was for frombuffer (beyond just warning that it may change). From ned at nedbatchelder.com Tue Jan 16 19:27:05 2007 From: ned at nedbatchelder.com (Ned Batchelder) Date: Tue, 16 Jan 2007 13:27:05 -0500 Subject: [Image-SIG] Interesting Bounding box calculation In-Reply-To: References: <45A40BE5.7010904@nedbatchelder.com> <45A52C83.2070102@nedbatchelder.com> <45ACC09A.9040404@nedbatchelder.com> Message-ID: <45AD18F9.50406@nedbatchelder.com> I'm not sure exactly what you are showing me here. Perhaps you could describe what you see (or even post the images). Prefixing the string with spaces will of course prevent the problem, but introduces problems of its own (how to accurately position the text, how to avoid the spaces clobbering other text, etc). You're using font.getmetrics() here, which is an undocumented function. Reading the code, it seems to return the ascent and descent of the font, so using either dimension for an x value seems wrong to me, and I'm not sure why you are using it in the first place. I want to understand. Can you explain? --Ned. Scott David Daniels wrote: > Ned Batchelder wrote: > >> OK, here's some code, and some output.... >> > > After looking, and doing a bit of experimenting, here is a > surprising drawing: > > import Image, ImageDraw, ImageFont > def paints(fontname='timesbi.ttf', fontsize=50, > canvas=(500, 700), position=(100, 100)): > im = Image.new("RGB", canvas, '#ffffc0') > draw = ImageDraw.Draw(im) > font = ImageFont.truetype(fontname, fontsize) > fh, fx = font.getmetrics() > x, y = position > for text in ['j_0_|igf', ' j_1_|igf', ' j_2_|igf', 'young']: > width, height = font.getsize(text) # w,h > draw.rectangle((x, y, x+width, y+height), > fill='lightgrey', outline='lightgreen') > draw.rectangle((x-fx, y, x, y+fh), > fill='lightgrey', outline='red') > draw.text((x, y), text, font=font, fill='black') > y += 100 > return im > paints().show() > > -- Scott David Daniels > Scott.Daniels at Acm.Org > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > > > -- Ned Batchelder, http://nedbatchelder.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070116/a7206c7e/attachment.htm From wrybread at gmail.com Thu Jan 18 01:50:06 2007 From: wrybread at gmail.com (Alec Bennett) Date: Wed, 17 Jan 2007 16:50:06 -0800 Subject: [Image-SIG] rotate image with transparent background? Message-ID: I'm trying to rotate an image and have the expanded background be transparent. For example: im = Image.open("pic1.jpg") im2 = im.rotate(32, expand = 1) im2.show() In the above, im2 is a copy of pic1.jpg that has been rotated 32 degrees. The problem is that the background over where it was rotated is a black box. Is there a way to make that background transparent? I'll be pasting the image onto another image, and don't want a bunch of black shapes. Thanks for any help. From douglas at paradise.net.nz Thu Jan 18 02:55:08 2007 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Thu, 18 Jan 2007 14:55:08 +1300 Subject: [Image-SIG] rotate image with transparent background? In-Reply-To: References: Message-ID: <45AED37C.5020306@paradise.net.nz> hi Alec, > I'm trying to rotate an image and have the expanded background be transparent. The image you get from opening a JPG won't have an alpha channel. You need to add it yourself with the .convert() method. This ought to work: im = Image.open("pic1.jpg").convert('RGBA') im2 = im.rotate(32, expand = 1) im2.show() Douglas Bagnall From wrybread at gmail.com Thu Jan 18 04:55:33 2007 From: wrybread at gmail.com (Alec Bennett) Date: Wed, 17 Jan 2007 19:55:33 -0800 Subject: [Image-SIG] rotate image with transparent background? In-Reply-To: <45AED37C.5020306@paradise.net.nz> References: <45AED37C.5020306@paradise.net.nz> Message-ID: Hmm, still getting a black box. The code as it stands now in case anything jumps out at you: from PIL import Image collage = Image.open("collage.jpg") # open the pic and give it an alpha channel so it's transparent im1 = Image.open("pic1.jpg") im1.convert('RGBA') # rotate it and expand it's canvass so the corners don't get cut off: im2 = im1.rotate(32, expand = 1) collage.paste(im2, (30, 30) ) collage.save("collage.jpg") collage.show() On 1/17/07, Douglas Bagnall wrote: > hi Alec, > > > I'm trying to rotate an image and have the expanded background be transparent. > > The image you get from opening a JPG won't have an alpha channel. You > need to add it yourself with the .convert() method. > > This ought to work: > > im = Image.open("pic1.jpg").convert('RGBA') > im2 = im.rotate(32, expand = 1) > im2.show() > > > > Douglas Bagnall > From douglas at paradise.net.nz Thu Jan 18 05:13:15 2007 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Thu, 18 Jan 2007 17:13:15 +1300 Subject: [Image-SIG] rotate image with transparent background? In-Reply-To: References: <45AED37C.5020306@paradise.net.nz> Message-ID: <45AEF3DB.207@paradise.net.nz> Alec Bennett wrote: > Hmm, still getting a black box. The code as it stands now in case > anything jumps out at you: > # open the pic and give it an alpha channel so it's transparent > im1 = Image.open("pic1.jpg") > im1.convert('RGBA') That should be im1 = Image.open("pic1.jpg") im1 = im1.convert('RGBA') ^^^^^ or more concisely im1 = Image.open("pic1.jpg").convert('RGBA') Like most PIL methods, convert() returns the modified image, leaving the original one as is. douglas From douglas at paradise.net.nz Thu Jan 18 05:56:06 2007 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Thu, 18 Jan 2007 17:56:06 +1300 Subject: [Image-SIG] rotate image with transparent background? In-Reply-To: References: <45AED37C.5020306@paradise.net.nz> <45AEF3DB.207@paradise.net.nz> Message-ID: <45AEFDE6.7030701@paradise.net.nz> Alec Bennett wrote: > collage.paste(im2, (30, 30) ) >From http://effbot.org/imagingbook/image.htm#Image.paste : im.paste(image, box, mask) Same as above, but updates only the regions indicated by the mask. You can use either "1", "L" or "RGBA" images (in the latter case, the alpha band is used as mask). Where the mask is 255, the given image is copied as is. Where the mask is 0, the current value is preserved. Intermediate values can be used for transparency effects. Note that if you paste an "RGBA" image, the alpha band is ignored. You can work around this by using the same image as both source image and mask. so you want collage.paste(im2, (30, 30), im2) douglas From wrybread at gmail.com Thu Jan 18 06:19:21 2007 From: wrybread at gmail.com (Alec Bennett) Date: Wed, 17 Jan 2007 21:19:21 -0800 Subject: [Image-SIG] rotate image with transparent background? In-Reply-To: <45AED37C.5020306@paradise.net.nz> References: <45AED37C.5020306@paradise.net.nz> Message-ID: Douglas helped me off list, wanted to post the complete code in case anyone else comes looking. So here's the code to rotate an image and paste it onto another image without creating a black bounding box: from PIL import Image collage = Image.open("cheese.jpg") # open the pic and give it an alpha channel so it's transparent im1 = Image.open("pic1.jpg").convert('RGBA') # rotate it and expand it's canvas so the corners don't get cut off: im2 = im1.rotate(32, expand = 1) # note the second appearance of im2, that's necessary to paste without a bg collage.paste(im2, (30, 30), im2 ) collage.save("new.jpg") collage.show() From mypassion_13 at yahoo.co.in Thu Jan 18 15:18:31 2007 From: mypassion_13 at yahoo.co.in (sanket jalan) Date: Thu, 18 Jan 2007 14:18:31 +0000 (GMT) Subject: [Image-SIG] Image matching Message-ID: <20070118141831.50479.qmail@web8915.mail.in.yahoo.com> Hi there !! Actually I am new to the field of Digital Image processing and I have to make a project in which I have to compare any input images with those in the database and give results according to the degree of similarity. The images can be any geographical maps, faces etc. but a grayscale only at this stage. Can you help me to know what series of techniques I must use for the purpose. As I was thinking to apply edge detection then thresholding and after that comparison of this image. but I am not sure. Is this the best possible way? Thanx in advace Warm Regards Sanket Jalan --------------------------------- Here?s a new way to find what you're looking for - Yahoo! Answers -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070118/f055b7b2/attachment.htm From rsenra at acm.org Sat Jan 20 17:12:55 2007 From: rsenra at acm.org (Rodrigo Senra) Date: Sat, 20 Jan 2007 14:12:55 -0200 Subject: [Image-SIG] Image matching In-Reply-To: <20070118141831.50479.qmail@web8915.mail.in.yahoo.com> References: <20070118141831.50479.qmail@web8915.mail.in.yahoo.com> Message-ID: <6C496C4E-DA6E-4D93-9F5B-BD197B049FB7@acm.org> On 18Jan 2007, at 12:18 PM, sanket jalan wrote: > Hi there !! > > Actually I am new to the field of Digital Image processing and I > have to make a project in which I have to compare any input images > with those in the database and give results according to the degree > of similarity. Color similarity, shape similarity, semantics ? Try studying these python-based projects: - ImgSeek [1] """imgSeek is a photo collection manager and viewer with content-based search and many other features.""" - SOM [2, 3] For a broader view, check the Wikipedia [4]. [1] http://www.imgseek.net/ [2] http://rtshiva.wordpress.com/2006/08/27/som-content-based-image- retrieval/ [3] http://generation5.org/content/2004/aiSomPic.asp [4] http://en.wikipedia.org/wiki/CBIR > As I was thinking to apply edge detection then thresholding and > after that comparison of this image. but I am not sure. Is this the > best possible way? Even though DIP is not my field, I beleive content-based image retrieval is still an open problem. HTH, Senra Rodrigo Senra ______________ rsenra @ acm.org http://rodrigo.senra.nom.br From Travis.Cochran at analog.com Mon Jan 22 14:40:44 2007 From: Travis.Cochran at analog.com (Cochran, Travis) Date: Mon, 22 Jan 2007 08:40:44 -0500 Subject: [Image-SIG] Creating a grayscale ramp Message-ID: <4F19D8A3D7B26247A4481AE28348A84804A87DDB@gboexm2.ad.analog.com> I'm trying to use the PIL to create a grayscale ramp, dark to light. I am able to generate an image but it is solid black. Am I using frombuffer wrong? Here is my code. from PIL import Image #Creates the list of codes from 0 to 255 data = range(256) #Creates an image out of those codes im = Image.frombuffer("L", (256, 1), str(data), "raw", "L", 0, 1) #Resizes the image to make it easy to view im = im.resize((256, 768)).show() From export at hope.cz Mon Jan 22 15:11:38 2007 From: export at hope.cz (export at hope.cz) Date: Mon, 22 Jan 2007 15:11:38 +0100 Subject: [Image-SIG] How to write a text to an image Message-ID: <45B4D42A.25963.165AF45A@export.hope.cz> Is it possible to write a text , by using PIL, to a bottom corner of an image? Is there any doc/tutorial for that? Thank you Lad. From rsenra at acm.org Mon Jan 22 16:01:42 2007 From: rsenra at acm.org (Rodrigo Senra) Date: Mon, 22 Jan 2007 13:01:42 -0200 Subject: [Image-SIG] How to write a text to an image In-Reply-To: <45B4D42A.25963.165AF45A@export.hope.cz> References: <45B4D42A.25963.165AF45A@export.hope.cz> Message-ID: <709BBB76-CBC7-4A6A-81C0-5F93F90C896D@acm.org> On 22Jan 2007, at 12:11 PM, export at hope.cz wrote: > Is it possible to write a text , by using PIL, to a bottom corner > of an image? > Is there any doc/tutorial for that? I have created this recipe [1] some time ago, I guess this it is what (or something very close to what) you are looking for. There are other useful recipes there. [1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/483756 best regards, Senra Rodrigo Senra ______________ rsenra @ acm.org http://rodrigo.senra.nom.br From douglas at paradise.net.nz Mon Jan 22 20:57:10 2007 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Tue, 23 Jan 2007 08:57:10 +1300 Subject: [Image-SIG] Creating a grayscale ramp In-Reply-To: <4F19D8A3D7B26247A4481AE28348A84804A87DDB@gboexm2.ad.analog.com> References: <4F19D8A3D7B26247A4481AE28348A84804A87DDB@gboexm2.ad.analog.com> Message-ID: <45B51716.3080407@paradise.net.nz> Cochran, Travis wrote: > I'm trying to use the PIL to create a grayscale ramp, dark to light. I > am able to generate an image but it is solid black. Am I using > frombuffer wrong? Here is my code. > > from PIL import Image > > #Creates the list of codes from 0 to 255 > data = range(256) > #Creates an image out of those codes > im = Image.frombuffer("L", (256, 1), str(data), "raw", "L", 0, 1) ^^^^^^^^^ str(data) turns the list into a 1170 byte string representation of the list, beginning "[0, 1, 2,". Translated back to byte values, this is [91, 48, 44, 32, 49, 44, 32, 50, 44, 32], not [0, 1, 2]. Your "solid black" is actually a dappled dark grey. What you want is a 256 byte string of ascending values, which would begin (in python's string notation) "\x00\x01\x02". One way to get this would be: # you can leave out the square brackets for python 2.4 + data = ''.join([chr(x) for x in range(256)]) im = Image.frombuffer("L", (256, 1), data, "raw", "L", 0, 1) Note, here: > #Resizes the image to make it easy to view > im = im.resize((256, 768)).show() you are setting im to None, because that is what .show() returns. You probably don't mean this, and would be better using two lines: im = im.resize((256, 768)) im.show() douglas From carroll at tjc.com Wed Jan 24 07:10:32 2007 From: carroll at tjc.com (Terry Carroll) Date: Tue, 23 Jan 2007 22:10:32 -0800 (PST) Subject: [Image-SIG] How to write a text to an image In-Reply-To: <45B4D42A.25963.165AF45A@export.hope.cz> Message-ID: On Mon, 22 Jan 2007 export at hope.cz wrote: > Is it possible to write a text , by using PIL, to a bottom corner of an > image? Is there any doc/tutorial for that? I use this routine (in a little app I wrote to extract the date a photo was taken from its EXIF data, and add it to the bottom corner) def Imprint(im, inputtext, font=None, color=None, opacity=.6, margin=(30,30)): """ imprints a PIL image with the indicated text in lower-right corner """ if im.mode != "RGBA": im = im.convert("RGBA") textlayer = Image.new("RGBA", im.size, (0,0,0,0)) textdraw = ImageDraw.Draw(textlayer) textsize = textdraw.textsize(inputtext, font=font) textpos = [im.size[i]-textsize[i]-margin[i] for i in [0,1]] textdraw.text(textpos, inputtext, font=font, fill=color) if opacity != 1: textlayer = ReduceOpacity(textlayer,opacity) return Image.composite(textlayer, im, textlayer) The ReduceOpacity method is the one from this recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362879 Which inspired my app in the first place From jwhiteillustration at cox.net Wed Jan 24 16:37:31 2007 From: jwhiteillustration at cox.net (Janie White) Date: Wed, 24 Jan 2007 08:37:31 -0700 Subject: [Image-SIG] leptoprin scam zantrex scam strivectin scam anorex scam Message-ID: <5246DCEF-DAD2-4BCA-A6B0-E84A23BD7CE2@cox.net> Hello, Who are you and how do I know that your information is accurate? My mother is taken in by the "Better than Botox?" ad- I thought that I'd do some research- What you have posted sounds on target, but how do I verify your information? Thanks, Janie From ken at seehart.com Wed Jan 24 20:51:46 2007 From: ken at seehart.com (Ken Seehart) Date: Wed, 24 Jan 2007 11:51:46 -0800 Subject: [Image-SIG] video capture Message-ID: <45B7B8D2.4020500@seehart.com> Anyone know what is the closest to the following? I am looking for video capture functionality. I am developing a multi platform application written in wxPython. The feature I need to add is video conferencing and streaming. Specifically, I need to create a window class that can receive video from our server or from a peer. I also need video capture and the ability to output a video stream to one or more peers. I think maybe Kamelia could do the pipelining, but they don't seem to have much video capture capability built in. Unless Twisted is better... opinions? In any case, I need video capture, which I probably can wrap into Kamelia. The only interesting hits I have found so far are: PXC-200 Frame Grabber Module - http://www.mems-exchange.org/software/pxc200/ libfg -- Frame Grabber library for Linux - http://antonym.org/libfg These are all either camera hardware specific or platform specific or both. Isn't there an open source multi-platform library for this kind of thing? If such a thing exists in C++, perhaps it could be swigificated. BTW, there is probably a short term contract available for anyone with the ability to develop this functionality, and I might be able to arrange for the resulting module to be open source (subject to approval). Contact me off line if you are interested in that. - Ken From dshimer at gmail.com Wed Jan 24 21:10:03 2007 From: dshimer at gmail.com (Dennis Shimer) Date: Wed, 24 Jan 2007 15:10:03 -0500 Subject: [Image-SIG] video capture In-Reply-To: <45B7B8D2.4020500@seehart.com> References: <45B7B8D2.4020500@seehart.com> Message-ID: <99ea8b7b0701241210k29fd390fy10ff7f3907b84dc2@mail.gmail.com> Have you looked at what makes virtualdub tick? I have used it as a capture app for quite some time and am amazed at the function and efficiency of it. If memory serves it is C++ and open source. From ken at seehart.com Wed Jan 24 21:44:53 2007 From: ken at seehart.com (Ken Seehart) Date: Wed, 24 Jan 2007 12:44:53 -0800 Subject: [Image-SIG] video capture In-Reply-To: <99ea8b7b0701241210k29fd390fy10ff7f3907b84dc2@mail.gmail.com> References: <45B7B8D2.4020500@seehart.com> <99ea8b7b0701241210k29fd390fy10ff7f3907b84dc2@mail.gmail.com> Message-ID: <45B7C545.1010609@seehart.com> Dennis Shimer wrote: > Have you looked at what makes virtualdub tick? I have used it as a > capture app for quite some time and am amazed at the function and > efficiency of it. If memory serves it is C++ and open source. > > Thanks, that looks nice. I might dig into it more if I can't find a better match, but virtualdib is Windows only, and not packaged as a library. - Ken From seb.haase at gmx.net Wed Jan 24 22:48:03 2007 From: seb.haase at gmx.net (Sebastian Haase) Date: Wed, 24 Jan 2007 13:48:03 -0800 Subject: [Image-SIG] video capture In-Reply-To: <45B7C545.1010609@seehart.com> References: <45B7B8D2.4020500@seehart.com> <99ea8b7b0701241210k29fd390fy10ff7f3907b84dc2@mail.gmail.com> <45B7C545.1010609@seehart.com> Message-ID: Do you know about VideoCapture A Win32 Python Extension for Accessing Video Devices (e.g. a USB WebCam, a TV-Card, ...) by Markus Gritsch (gritsch at iue.tuwien.ac.at) -Sebastian Haase On 1/24/07, Ken Seehart wrote: > Dennis Shimer wrote: > > Have you looked at what makes virtualdub tick? I have used it as a > > capture app for quite some time and am amazed at the function and > > efficiency of it. If memory serves it is C++ and open source. > > > > > Thanks, that looks nice. I might dig into it more if I can't find a > better match, but virtualdib is Windows only, and not packaged as a library. > > - Ken > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From nicolas at famillepinault.fr Thu Jan 25 07:43:50 2007 From: nicolas at famillepinault.fr (Nicolas Pinault) Date: Thu, 25 Jan 2007 07:43:50 +0100 Subject: [Image-SIG] video capture In-Reply-To: References: <45B7B8D2.4020500@seehart.com> <99ea8b7b0701241210k29fd390fy10ff7f3907b84dc2@mail.gmail.com> <45B7C545.1010609@seehart.com> Message-ID: <45B851A6.8050706@famillepinault.fr> Sebastian Haase a ?crit : > Do you know about > VideoCapture > A Win32 Python Extension for Accessing Video Devices (e.g. a USB > WebCam, a TV-Card, ...) > by Markus Gritsch (gritsch at iue.tuwien.ac.at) > > -Sebastian Haase > Video capture does not capture streams. Videocapture only grabs single frames. It is usefull for webcam for example where the app grabs a picture every minute or every second or whatever you want. You can also grabs picture at a higher rate than the video stream, doubling or tripling source frames. Nicolas From p.lists at partylemon.com Thu Jan 25 08:27:02 2007 From: p.lists at partylemon.com (Philip Quinn) Date: Thu, 25 Jan 2007 20:27:02 +1300 Subject: [Image-SIG] PIL stripping colour profile Message-ID: Hi, I've noticed that if I load an image with an embedded colour profile with PIL and then save it out again, then colour profile is lost. Is it possible to either stop PIL from doing this, or re-attach the profile to the image? Thanks, Phil From PMF at kingswood.bath.sch.uk Thu Jan 25 11:52:18 2007 From: PMF at kingswood.bath.sch.uk (Paul) Date: Thu, 25 Jan 2007 10:52:18 -0000 Subject: [Image-SIG] Newb help... can't install the PIL extension libraries Message-ID: <06C7A71EB82A7E4F8FBB65E016C15D07072A3B@kws-exc-01.kingswood.internal> Hi, I'm very new to linux (2 days!) but have been using Python on windows for a few weeks now. I would like to install PIL on my linux (ubuntu) machine but am having all sorts of trouble following the readme, I get a ton of errors when trying to run the build.py. Mostly cannot find directory errors, but there are others thrown in for good measure. This is my first attempt at importing a library within linux. I unzipped the tar file into my user space... /home/paul/Python/ExtensionLibraries which I created myself. This is where I'm going wrong I presume. The readme said that I could create my own directory, so I'm confused. Should I unzip it & build it somewhere else? Any help greatly appreciated, many thanks. PMF -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070125/f73d9994/attachment.html From Chris.Barker at noaa.gov Thu Jan 25 20:41:38 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 25 Jan 2007 11:41:38 -0800 Subject: [Image-SIG] Newb help... can't install the PIL extension libraries In-Reply-To: <06C7A71EB82A7E4F8FBB65E016C15D07072A3B@kws-exc-01.kingswood.internal> References: <06C7A71EB82A7E4F8FBB65E016C15D07072A3B@kws-exc-01.kingswood.internal> Message-ID: <45B907F2.7010104@noaa.gov> Paul wrote: > I?m very new to linux (2 days!) but have been using Python on windows > for a few weeks now. I would like to install PIL on my linux (ubuntu) > machine but am having all sorts of trouble following the readme, I get a > ton of errors when trying to run the build.py. Mostly cannot find > directory errors, but there are others thrown in for good measure. post a few here -- particularly the first few you get. > I unzipped the tar file into my user space? > /home/paul/Python/ExtensionLibraries > which I created myself. This is where I?m going wrong I presume. The > readme said that I could create my own directory, so I?m confused. > Should I unzip it & build it somewhere else? no, that's not it, you can built it anywhere. I'm guessing that you're missing some libraries -- you need the ones that PIL needs (libjpeg, freetype2, zlib). These are probably already on your system, but you may not have the "devel" versions, which you need as PIL is building against them. Sorry I'm not familiar with Ubuntu, but look for things like: python-devel jpeg-devel zlib-devel etc... oh, and are you sure there is not an existing Ubuntu package for PIL? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From ced at bernispa.com Fri Jan 26 13:41:47 2007 From: ced at bernispa.com (Cesare Leonardi) Date: Fri, 26 Jan 2007 13:41:47 +0100 Subject: [Image-SIG] Problem with JPEG and CMYK color space In-Reply-To: <443A217C.1050405@bernispa.com> References: <443A217C.1050405@bernispa.com> Message-ID: <45B9F70B.1050806@bernispa.com> Berni CED ha scritto: > So i think there is a bug in the code related to JPEG CYMK or there are > some JPEG unsupported feature. What do you think? Some advice? Now PIL 1.1.6 includes a solution to that problem. Since some days ago i was using PIL 1.1.4 with the patch from Kevin Cazabon and for my experiments everything was fine. Some days ago i've tryed to install python 2.5 along with PIL 1.1.6 (under Windows) and so i've tryed to test some of the JPEG CMYK files that was problematic with official PIL 1.1.4 and i noted that some images now are threated good but other still looks bad. Substituting "JpegImagePlugin.py" with the one patched by Kevin, everything is fine. So seems that the file that comes with 1.1.6 is not functional equivalent to the one patched by Kevin. I've posted some examples in the following site (see PART 5 at the end): http://www.bernispa.com/pil/index.html I've also attached to this message the diff between the "JpegImagePlugin.py" as found in PIL 1.1.6 and the same file patched by Kevin (it was written for 1.1.4 but seems that the original file as not changed meanwhile) What do you think? Cesare. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: diff.txt Url: http://mail.python.org/pipermail/image-sig/attachments/20070126/3c75ea3b/attachment.txt From ken at seehart.com Thu Jan 25 22:55:10 2007 From: ken at seehart.com (Ken Seehart) Date: Thu, 25 Jan 2007 13:55:10 -0800 Subject: [Image-SIG] video capture In-Reply-To: <45B851A6.8050706@famillepinault.fr> References: <45B7B8D2.4020500@seehart.com> <99ea8b7b0701241210k29fd390fy10ff7f3907b84dc2@mail.gmail.com> <45B7C545.1010609@seehart.com> <45B851A6.8050706@famillepinault.fr> Message-ID: <45B9273E.8010006@seehart.com> Nicolas Pinault wrote: > Sebastian Haase a ?crit : > >> Do you know about >> VideoCapture >> A Win32 Python Extension for Accessing Video Devices (e.g. a USB >> WebCam, a TV-Card, ...) >> by Markus Gritsch (gritsch at iue.tuwien.ac.at) >> >> -Sebastian Haase >> >> > Video capture does not capture streams. Videocapture only grabs single > frames. It is usefull for webcam for example where the app grabs a > picture every minute or every second or whatever you want. You can also > grabs picture at a higher rate than the video stream, doubling or > tripling source frames. > > Nicolas > I'm not sure I understand the distinction. For example, if I pipeline a series of camera images at the desired frame rate into a component that converts a sequences of frames into a video stream, then I achieve the desired result right? I imagine that the video streaming component would surely be very portable, but the video capture would tend to be O/S and hardware specific. Maybe what the world needs is a set of webcam drivers wrapped up into a single platform- independent PIL compatible python module, that could then be wrapped into a Kamelia component. Anyone else interested in such a project? I can't believe such a thing doesn't already exist. - Ken -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070125/dab11b54/attachment.htm From jason at smileproject.com Thu Jan 25 23:17:48 2007 From: jason at smileproject.com (Jason Van Anden) Date: Thu, 25 Jan 2007 17:17:48 -0500 Subject: [Image-SIG] Splitting Color Stacked TIFFs Problem Message-ID: <8eadd6950701251417r44baf177u54a35ee3aa110810@mail.gmail.com> Hello List, A project I am developing in PIL splits stacked Tiffs (among other things). It works super on B&W Tiffs, but chokes on color. The error is "cannot identify image file". My question is ... is this a limitation of PIL (Color Tiffs) or could something be screwy about my files? I am using the same program to capture the images - just two different cameras. Thank You, Jason Van Anden http://www.smileproject.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070125/4cf5dc91/attachment.html From waldemar.osuch at gmail.com Fri Jan 26 16:57:01 2007 From: waldemar.osuch at gmail.com (Waldemar Osuch) Date: Fri, 26 Jan 2007 08:57:01 -0700 Subject: [Image-SIG] Newb help... can't install the PIL extension libraries In-Reply-To: <06C7A71EB82A7E4F8FBB65E016C15D07072A3B@kws-exc-01.kingswood.internal> References: <06C7A71EB82A7E4F8FBB65E016C15D07072A3B@kws-exc-01.kingswood.internal> Message-ID: <6fae95540701260757hd95bb58rfc62e5a04857c8f3@mail.gmail.com> On 1/25/07, Paul wrote: > > > > > Hi, > > > > I'm very new to linux (2 days!) but have been using Python on windows for a > few weeks now. I would like to install PIL on my linux (ubuntu) machine but > am having all sorts of trouble following the readme, I get a ton of errors > when trying to run the build.py. Mostly cannot find directory errors, but > there are others thrown in for good measure. Use prepackaged version of PIL if you can. apt-get is your friend Or for command line challenged, Synaptic. The general instruction on installing: https://help.ubuntu.com/6.10/ubuntu/desktopguide/C/add-applications.html Waldemar From fredrik at pythonware.com Fri Jan 26 18:15:01 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 26 Jan 2007 18:15:01 +0100 Subject: [Image-SIG] Newb help... can't install the PIL extension libraries In-Reply-To: <45B907F2.7010104@noaa.gov> References: <06C7A71EB82A7E4F8FBB65E016C15D07072A3B@kws-exc-01.kingswood.internal> <45B907F2.7010104@noaa.gov> Message-ID: Christopher Barker wrote: > oh, and are you sure there is not an existing Ubuntu package for PIL? $ sudo apt-get install python-imaging iirc, ubuntu-desktop uses it, so it's installed by default on most Ubuntu systems. From wolfgangfellger at web.de Sun Jan 28 21:24:04 2007 From: wolfgangfellger at web.de (Wolfgang Fellger) Date: Sun, 28 Jan 2007 21:24:04 +0100 Subject: [Image-SIG] [BUG] PNG writer using 'bits' stores palette too big Message-ID: <000001c7431a$4826c6e0$0509d452@wolff> Sorry if this has been reported before, I was too lazy looking through all the archives. When using the PNG writer with e.g. bits=4 it still stores a palette with full 256 entries into the resulting file. This is not only a waste of space, it also makes e.g. GIMP silently convert it to a 8-bit palette image (and store it as such on save). Solution: PNG writer should clip the palette as appropriate. Keep up the good work! -- Wolfgang Fellger From robotissues at gmail.com Fri Jan 26 16:43:13 2007 From: robotissues at gmail.com (Jason Van Anden) Date: Fri, 26 Jan 2007 10:43:13 -0500 Subject: [Image-SIG] Splitting Color Stacked TIFFs Problem In-Reply-To: <8eadd6950701251417r44baf177u54a35ee3aa110810@mail.gmail.com> References: <8eadd6950701251417r44baf177u54a35ee3aa110810@mail.gmail.com> Message-ID: <8eadd6950701260743o8ba0c64q601920960d842b15@mail.gmail.com> Hello List, A project I am developing in PIL splits stacked Tiffs (among other things). It works super on B&W Tiffs, but chokes on color. The error is "cannot identify image file". My question is ... is this a limitation of PIL (Color Tiffs) or could something be screwy about my files? I am using the same program to capture the images - just two different cameras. Thank You, Jason Van Anden http://www.smileproject.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070126/0643a6e8/attachment.htm From fredrik at pythonware.com Mon Jan 29 13:52:40 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 29 Jan 2007 13:52:40 +0100 Subject: [Image-SIG] Splitting Color Stacked TIFFs Problem References: <8eadd6950701251417r44baf177u54a35ee3aa110810@mail.gmail.com> Message-ID: Jason Van Anden wrote: > A project I am developing in PIL splits stacked Tiffs (among other things). > It works super on B&W Tiffs, but chokes on color. > > The error is "cannot identify image file". > > My question is ... is this a limitation of PIL (Color Tiffs) or could > something be screwy about my files? I am using the same program > to capture the images - just two different cameras. PIL's TIFF parser is pretty picky, so it's probably a bug or limitation in PIL. Can you perhaps post a sample file somewhere, and mail me the URL ? From boesi.josi at gmx.net Mon Jan 29 19:44:24 2007 From: boesi.josi at gmx.net (Alexander 'boesi' =?ISO-8859-1?Q?B=F6secke?=) Date: Mon, 29 Jan 2007 19:44:24 +0100 Subject: [Image-SIG] video capture In-Reply-To: <45B9273E.8010006@seehart.com> References: <45B851A6.8050706@famillepinault.fr> <45B9273E.8010006@seehart.com> Message-ID: Hi Am 25.01.2007 22:55:10 schrieb Ken Seehart: > Maybe what the world needs is a set of webcam drivers wrapped up into > a single platform- independent PIL compatible python module, that > could then be wrapped into a Kamelia component. Anyone else > interested in such a project? I can't believe such a thing doesn't > already exist. Oh yeah I'm really interested in such a thing. At the moment I'm using pyVideo [1], but this is a bit unstable and it doesn't offer a method to set the resolution directly. Video Capture instead doesn't have an useable preview. So I was thinking of coding a new "Video Capture Module", that can be extended by drivers for different cameras and capture boards - I think especially about the products from [2]. But I can only start the work, if I get paid for it. Well and at the moment there is less money for the related projects. But when the money flows again, I will truly start such a module and release it as open source. And if somebody else will start something, I would contribute to it ... cu boesi [1] http://www.geocities.com/rtrocca/python/ [2] http://www.ids-imaging.de/?&changeLang=e -- ...schlafen ist sowieso ungesund... .-==Police Academy I==-. From djmuhlestein at gmail.com Wed Jan 31 19:20:28 2007 From: djmuhlestein at gmail.com (Dennis Muhlestein) Date: Wed, 31 Jan 2007 11:20:28 -0700 Subject: [Image-SIG] PIL potential bug In-Reply-To: <1170267230.24405.4.camel@esteban> References: <1170267230.24405.4.camel@esteban> Message-ID: Nope, for the time being, I'm simply not allowing PNG images. I wish I heard back from somebody about a bugfix or workaround, but nobody responded. I didn't have time to work on it then. -Dennis On 1/31/07, Florian Boucault wrote: > Hello Dennis, > > I came accross the same problem as you with PIL that you described on > the mailing list: > http://www.mail-archive.com/image-sig at python.org/msg01153.html > > Did you manage to get it to work or did you use a workaround ? > > Thank you for your time, > > Florian Boucault > > -- You can see what's happening at http://muhlesteins.com From jason at smileproject.com Wed Jan 31 18:41:42 2007 From: jason at smileproject.com (Jason Van Anden) Date: Wed, 31 Jan 2007 12:41:42 -0500 Subject: [Image-SIG] Removing an Alpha Channel Message-ID: <8eadd6950701310941l375e51dfj85d955b9d0ef01d8@mail.gmail.com> I have written an app using PIL that uses alpha channels during processing, but does not require them once the image is complete. Is there an easy way to remove existing alpha channels? I suspect there is but the docs don't make this obvious. Thank You, Jason Van Anden www.smileproject.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070131/e7ecb296/attachment.htm