From d.vanderelst at tue.nl Thu Aug 2 10:42:55 2007 From: d.vanderelst at tue.nl (Dieter Vanderelst) Date: Thu, 02 Aug 2007 10:42:55 +0200 Subject: [Image-SIG] Mexican hat or difference of gaussians Message-ID: <46B1990F.6040105@tue.nl> Hi, Could somebody point me to a way in which I could apply a Mexican hat filter to an image (with a controllable width)? Does somebody know of a piece of code floating around that can do this and that is compatible with PIL? Or, in absence of this, could somebody tell me how I can do Gaussian blurring (with a controllable width). I can approximate the Mexican hat with a DOG. I found the pil_usm module. But this is not compiled for python > 2.1 (I use 2.5). Greetings, Dieter From peter.mowry at amd.com Thu Aug 2 20:57:26 2007 From: peter.mowry at amd.com (Mowry, Peter) Date: Thu, 2 Aug 2007 13:57:26 -0500 Subject: [Image-SIG] Building Windows64 (64-bit AMD64) PIL (???) In-Reply-To: <1184988378.6828.25.camel@localhost> References: <1184988378.6828.25.camel@localhost> Message-ID: <475F4CA05E4E1B46A7213674E70EFA620340F9A5@SAUSEXMB2.amd.com> I am trying to build PIL for Win64 (x64, AMD64) (I am using Vista 64-bit). Appended are my notes on how I built and tested it (and the error messages). Any information on building a python Windows x64 extension (especially PIL) would help. Thanks --------------- This is essential b/c I am using python ctypes to control a 64-bit dll (and ctypes must be 64-bit to do this, which means the python install must be 64-bit, which means the PIL install must be 64-bit). I am trying to build a binary compatible PIL with my (python for x64, on windows vista) install. http://docs.python.org/dist/module-distutils.msvccompiler.html Says that I should use the "Platform SDK" to compile Windows AMD64 extensions. So I installed "Microsoft Windows SDK", and compiled from the console x64 console. I tried both consoles (Release , default Debug): C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin\SetEnv.Cmd" C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin\SetEnv.Cmd" /x64 /Release I downloaded code for jpeg-6b, and compiled: * rename jconfig.vc to jconfig.h * nmake /f Makefile.vc I downloaded code for zlib123 (png/zip support), and compiled: * nmake /f win32/Makefile.msc These folders I put in "PIL\Imaging-1.1.6\libs_External\jpeg-6b" and "PIL\Imaging-1.1.6\libs_External\zlib123" I edited Imaging-1.1.6\setup.py: * os.environ['DISTUTILS_USE_SDK'] = "1" * os.environ['MSSdk'] = "1" * JPEG_ROOT = r"libs_External\jpeg-6b" * ZLIB_ROOT = r"libs_External\zlib123" I compiled with distutils: * setup.py clean * setup.py build_ext -i * setup.py build * setup.py install I ran "selftest.py" and I get the error: Traceback (most recent call last): File "C:\Downloads\Installs\python\PIL\Imaging-1.1.6\selftest.py", line 11, in import ImageMath File "PIL\ImageMath.py", line 19, in import _imagingmath ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed. I also tried to run python: >>> from PIL import Image >>> refImg = Image.open(r"sample.png") >>> refImg.getpixel((0,0)) Traceback (most recent call last): File "", line 1, in File "PIL\Image.py", line 922, in getpixel self.load() File "PIL\ImageFile.py", line 155, in load self.load_prepare() File "PIL\PngImagePlugin.py", line 339, in load_prepare ImageFile.ImageFile.load_prepare(self) File "PIL\ImageFile.py", line 223, in load_prepare self.im = Image.core.new(self.mode, self.size) File "PIL\Image.py", line 36, in __getattr__ raise ImportError("The _imaging C module is not installed") ImportError: The _imaging C module is not installed Neither of my dll (_imaging.pyd and _imagingmath.pyd) files are getting loaded properly by python :-( From jeffmess at gmail.com Thu Aug 2 12:18:30 2007 From: jeffmess at gmail.com (Jeff van Aswegen) Date: Thu, 2 Aug 2007 12:18:30 +0200 Subject: [Image-SIG] Converting tiff to PNG Message-ID: <3ad7a1e40708020318h45239f06o4d4f9f73ec5b956e@mail.gmail.com> Hi there I've written a script which converts around 20000 TIFF images to PNG images everyday. The PIL module takes to long and I'm therefore using Imagemagick to perform the conversion. My problem is I need to compress the tiff as much as possible. The best I can do is get a 60kb TIFF Image to around a 100kb PNG image. I can get it down an extra kb or 2 by running it through PNGCrush but this takes way too long. The best command I can come up with is convert img.tif -monochrome +matte -depth 8 -quality 100 img.png -rw-r--r-- 1 jeffreyva jeffreyva 59328 2007-08-02 12:09 img.tif jeffreyva at jeffrey:$ time convert img.tif -monochrome +matte -depth 8 -quality 100 img.png real 0m7.041s user 0m6.664s sys 0m0.160s -rw-r--r-- 1 jeffreyva jeffreyva 99340 2007-08-02 12:10 img.png Has anyone worked with any utilities or has been successful in converting a TIFF image to a PNG which is almost the same size as the original TIFF? Look forward to hearing from anyone. Thanks Jeffrey van Aswegen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070802/79077284/attachment.htm From jeffmess at gmail.com Fri Aug 3 13:19:11 2007 From: jeffmess at gmail.com (Jeff van Aswegen) Date: Fri, 3 Aug 2007 13:19:11 +0200 Subject: [Image-SIG] Image-SIG - Convert Tif to PNG Message-ID: <3ad7a1e40708030419w6e7b8302m828b8cc57165c2c0@mail.gmail.com> Hi there I've written a script which converts around 20000 TIFF images to PNG images everyday. The PIL module takes to long and I'm therefore using Imagemagick to perform the conversion. My problem is I need to compress the tiff as much as possible. The best I can do is get a 60kb TIFF Image to around a 100kb PNG image. I can get it down an extra kb or 2 by running it through PNGCrush but this takes way too long. The best command I can come up with is convert img.tif -monochrome +matte -depth 8 -quality 100 img.png -rw-r--r-- 1 jeffreyva jeffreyva 59328 2007-08-02 12:09 img.tif jeffreyva at jeffrey:$ time convert img.tif -monochrome +matte -depth 8 -quality 100 img.png real 0m7.041s user 0m6.664s sys 0m0.160s -rw-r--r-- 1 jeffreyva jeffreyva 99340 2007-08-02 12:10 img.png Has anyone worked with any utilities or has been successful in converting a TIFF image to a PNG which is almost the same size as the original TIFF? Look forward to hearing from anyone. Thanks Jeffrey van Aswegen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070803/3065dc89/attachment.htm From jeffmess at gmail.com Fri Aug 3 13:28:29 2007 From: jeffmess at gmail.com (Jeff van Aswegen) Date: Fri, 3 Aug 2007 13:28:29 +0200 Subject: [Image-SIG] - Convert Tif to PNG Message-ID: <3ad7a1e40708030428j4d30f7e5va13371ab93b9eea9@mail.gmail.com> Hi there I've written a script which converts around 20000 TIFF images to PNG images everyday. The PIL module takes to long and I'm therefore using Imagemagick to perform the conversion. My problem is I need to compress the tiff as much as possible. The best I can do is get a 60kb TIFF Image to around a 100kb PNG image. I can get it down an extra kb or 2 by running it through PNGCrush but this takes way too long. The best command I can come up with is convert img.tif -monochrome +matte -depth 8 -quality 100 img.png -rw-r--r-- 1 jeffreyva jeffreyva 59328 2007-08-02 12:09 img.tif jeffreyva at jeffrey:$ time convert img.tif -monochrome +matte -depth 8 -quality 100 img.png real 0m7.041s user 0m6.664s sys 0m0.160s -rw-r--r-- 1 jeffreyva jeffreyva 99340 2007-08-02 12:10 img.png Has anyone worked with any utilities or has been successful in converting a TIFF image to a PNG which is almost the same size as the original TIFF? Look forward to hearing from anyone. Thanks Jeffrey van Aswegen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070803/4da3d448/attachment.html From michele.petrazzo at unipex.it Sat Aug 4 10:49:24 2007 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex srl) Date: Sat, 04 Aug 2007 10:49:24 +0200 Subject: [Image-SIG] - Convert Tif to PNG In-Reply-To: <3ad7a1e40708030428j4d30f7e5va13371ab93b9eea9@mail.gmail.com> References: <3ad7a1e40708030428j4d30f7e5va13371ab93b9eea9@mail.gmail.com> Message-ID: <46B43D94.7000801@unipex.it> Jeff van Aswegen wrote: > Hi there > Hi, (why wrote 3 messages to the list?) <-cut-> At least, I think, you have to send us a tiff sample for make some test! We can't help you without a sample where work! 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/20070804/291c0af8/attachment.bin From jwt at onjapan.net Sun Aug 5 11:44:15 2007 From: jwt at onjapan.net (Jim Tittsler) Date: Sun, 5 Aug 2007 21:44:15 +1200 Subject: [Image-SIG] PIL Jpeg resizing in windows In-Reply-To: <3d7d5c150707291234t20feae14u62a782f53f2224c@mail.gmail.com> References: <3d7d5c150707291234t20feae14u62a782f53f2224c@mail.gmail.com> Message-ID: <9037C05D-20A6-42E3-A721-EACF6CDB2022@onjapan.net> On Jul 30, 2007, at 07:34, Neil Johnson wrote: > I am new to using PIL and trying to find out how to resize JPEG > images. I try to resize, and I always get a "pixel access" error > using the thumbnail, resize, or load functions. Do I need to build > the PIL from source in order to have JPEG resizing capability? No. How large is your source image? > infile = "image1.JPG" > PicMaxHeight = 128 Not related to your problem... but you probably will want to do floating point division. > im = Image.open(infile) > im.load() > file, ext = os.path.splitext(infile) > ActualSize = im.size > heightScale = ActualSize[1]/PicMaxHeight > scaleFactor = heightScale > newSize = ActualSize[0]/scaleFactor, ActualSize[1]/scaleFactor > > ## Now let's try resizing...cross your fingers! > im.resize(newSize) Note that the resize() method returns a resized *copy* of the image. It does not modify the original. it = im.resize(newSize) it.save('image1_thumb.jpg') -- Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6 Python Starship http://Starship.Python.net/crew/jwt/ Mailman IRC irc://irc.freenode.net/#mailman From ph.mignon at free.fr Sun Aug 5 09:50:39 2007 From: ph.mignon at free.fr (ph.mignon) Date: Sun, 5 Aug 2007 09:50:39 +0200 Subject: [Image-SIG] PIL cannot install on a Intel iMac OX 10.4.10 system Message-ID: <3F436A4A-20E9-452C-A1A7-57CC317EFCA5@free.fr> Hello Python Image SIG people, this is a bug report : PIL cannot install on a Intel iMac OX 10.4.10 system : nor75-19-82-244-48-119:~/Desktop/Imaging-1.1.6 $ python setup.py build_ext -irunning build_ext --- using frameworks at /Library/Frameworks building '_imagingft' extension gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.5/ _imagingft.o -L/opt/local/lib -L/usr/local/lib -L/Library/Frameworks/ Python.framework/Versions/2.5/lib -L/usr/lib -lfreetype -o PIL/ _imagingft.so /usr/bin/ld: for architecture ppc /usr/bin/ld: warning /opt/local/lib/libfreetype.dylib cputype (7, architecture i386) does not match cputype (18) for specified -arch flag: ppc (file not loaded) /usr/bin/ld: for architecture i386 /usr/bin/ld: warning can't open dynamic library: /Developer/SDKs/ MacOSX10.4u.sdk/opt/local/lib/libz.1.dylib referenced from: /opt/ local/lib/libfreetype.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2) /usr/bin/ld: Undefined symbols: _inflate referenced from libfreetype expected to be defined in /opt/ local/lib/libz.1.dylib _inflateEnd referenced from libfreetype expected to be defined in / opt/local/lib/libz.1.dylib _inflateInit2_ referenced from libfreetype expected to be defined in / opt/local/lib/libz.1.dylib _inflateReset referenced from libfreetype expected to be defined in / opt/local/lib/libz.1.dylib collect2: ld returned 1 exit status lipo: can't open input file: /var/tmp//ccDCcAX5.out (No such file or directory) error: command 'gcc' failed with exit status 1 I do not know how to deal with that problem. Thank you for helping me Philippe Mignon ph.mignon at free.fr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070805/b4b9bbe9/attachment.html From Chris.Barker at noaa.gov Mon Aug 6 21:06:27 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 06 Aug 2007 12:06:27 -0700 Subject: [Image-SIG] Converting tiff to PNG In-Reply-To: <3ad7a1e40708020318h45239f06o4d4f9f73ec5b956e@mail.gmail.com> References: <3ad7a1e40708020318h45239f06o4d4f9f73ec5b956e@mail.gmail.com> Message-ID: <46B77133.30803@noaa.gov> Jeff van Aswegen wrote: > convert img.tif -monochrome +matte -depth 8 -quality 100 img.png This looks like you've got an 8-bit monochrome tiff. From a quick glance at: http://www.w3.org/TR/REC-png-multi.html it looks like PNG should support that, but it is mostly used for 24bit RGB and 32bit RGBA. I'm guessing that perhaps you're getting an RGB PNG, which would explain why it's larger than the Tiff. It does seem like the flags you're passing into convert should be doing this right, but I'd check to see if they are. You might see what PIL gives you, making sure you use the 'L' mode (8 bit greyscale) -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 jcupitt at gmail.com Mon Aug 6 23:02:16 2007 From: jcupitt at gmail.com (jcupitt at gmail.com) Date: Mon, 6 Aug 2007 22:02:16 +0100 Subject: [Image-SIG] Converting tiff to PNG In-Reply-To: <3ad7a1e40708020318h45239f06o4d4f9f73ec5b956e@mail.gmail.com> References: <3ad7a1e40708020318h45239f06o4d4f9f73ec5b956e@mail.gmail.com> Message-ID: <522c6460708061402j751bcecpf89eda888f395161@mail.gmail.com> On 8/2/07, Jeff van Aswegen wrote: > Has anyone worked with any utilities or has been successful in converting a > TIFF image to a PNG which is almost the same size as the original TIFF? > Look forward to hearing from anyone. Hi, could you post a sample image somewhere? I could have a go for you. John From messier at indiana.edu Tue Aug 7 08:04:52 2007 From: messier at indiana.edu (Mark Messier) Date: Tue, 7 Aug 2007 02:04:52 -0400 Subject: [Image-SIG] equalize algorithm for mode I;16 Message-ID: <670BA002-D4AE-448C-B833-13BC6535DB9C@indiana.edu> Hi All, Does anyone have an implementation of the equalize algorithm for 16- bit black-and-white images? The ImageOp.equalize() function does not support I;16 (at least I've not made it work using PIL 1.1.6) and my attempts to implement the algorithm have all failed when I try to to put the equalized pixel data back to the image. The failures are all sort of interesting: some fill only the left half of the image, some ignore every other row. These failures make me think that this is something to do with errors in mapping pixel to memory location for 8- bit vs. 16-bit images. I've tried im.putdata(...), Image.frombuffer (...), Image.fromstring(...), im.point(...), and pix = im.load(); pix [i,j] = h[pix[i,j]] and all produce one of the behaviors I mention above. BTW, I've been able to confirm that my algorithm works by printing the pixel data to a file and using a separate plotting program to construct the image from the text data. So, I'm confident that its just the last packing stage where my problem lies. Any help would be greatly appreciated. Cheers, Mark ======================================================================== Mark Messier messier at indiana.edu Department of Physics http://www.physics.indiana.edu/~messier Indiana University Phone: (812) 855-0236 Bloomington, IN 47405 Fax: (812) 855-0440 From vamurthy at cisco.com Tue Aug 7 08:33:34 2007 From: vamurthy at cisco.com (Varun Murthy (vamurthy)) Date: Tue, 7 Aug 2007 12:03:34 +0530 Subject: [Image-SIG] ld error with Imaging 1.1.6 Message-ID: <14F212591546FF4AB98EBFB4D189F061035B5745@xmb-blr-411.apac.cisco.com> Hi, Im trying to install the Imaging Library for Python (Imaging-1.1.6) on Solaris 5.9.When i run the python setup.py install command the installation procedure ends with the following error. ld: fatal: relocations remain against allocatable but non-writable sections collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 Is this happening because SUN ld is being used rather than GNU ld? I installed the binutils 1.7.11 package which contains GNU ld.Is installing this package sufficient to make gcc use GNU ld rather than SUN ld? Any help regarding this would be appreciated. The details of the packages installed are a)python 2.4.3 b)gcc 3.2 c)jpeg 6b d)zlib 1.2.3 I want Imaging 1.1.6 to be installed to be used with Plone 2.5. Thanks, Varun -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070807/2389e70c/attachment.htm From vamurthy at cisco.com Tue Aug 7 09:18:11 2007 From: vamurthy at cisco.com (Varun Murthy (vamurthy)) Date: Tue, 7 Aug 2007 12:48:11 +0530 Subject: [Image-SIG] ld error with Imaging 1.1.6 on Solaris 5.9 Message-ID: <14F212591546FF4AB98EBFB4D189F061035B5773@xmb-blr-411.apac.cisco.com> Hi, Im trying to install the Imaging Library for Python (Imaging-1.1.6) on Solaris 5.9.When i run the python setup.py install command the installation procedure ends with the following error. ld: fatal: relocations remain against allocatable but non-writable sections collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 Is this happening because SUN ld is being used rather than GNU ld? I installed the binutils 1.7.11 package which contains GNU ld.Is installing this package sufficient to make gcc use GNU ld rather than SUN ld? Any help regarding this would be appreciated. The details of the packages installed are a)python 2.4.3 b)gcc 3.2 c)jpeg 6b d)zlib 1.2.3 I want Imaging 1.1.6 to be installed to be used with Plone 2.5. Thanks, Varun -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070807/1a580de4/attachment.html From cja at gmx.net Sun Aug 12 14:18:54 2007 From: cja at gmx.net (Jonas Aaberg) Date: Sun, 12 Aug 2007 14:18:54 +0200 Subject: [Image-SIG] PATCH: Palette fix for FLI/FLC animations. Message-ID: Hi everyone, PIL assumes that the palette is always the first frame in FLI/FLC animations. However, this is not always the case. (For example, trying to load a FLC animations from Civlization III results in the usage of the PIL default grayscale palette.) After having a look at some FLI/FLC documentation I did some small changes to FliImagePlugin.py and managed to get the palette correctly loaded. Please see the attached patch. Best regards, Jonas ?berg -------------- next part -------------- A non-text attachment was scrubbed... Name: FliImagePlugin.py.patch Type: application/octet-stream Size: 1268 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20070812/a57ac17c/attachment.obj From cardona at ucla.edu Tue Aug 14 01:06:00 2007 From: cardona at ucla.edu (Albert Cardona) Date: Mon, 13 Aug 2007 19:06:00 -0400 Subject: [Image-SIG] creating multiframe images Message-ID: <46C0E3D8.6050501@ucla.edu> Is there anyway to create mutliframe images? I have no problem in reading multitif with seek() and so on, but how to create them? merge() is only for multiband images, not multiframe. Thanks for any help. Albert -- Albert Cardona http://www.mcdb.ucla.edu/Research/Hartenstein/acardona From d.vanderelst at tue.nl Tue Aug 14 16:23:00 2007 From: d.vanderelst at tue.nl (Dieter Vanderelst) Date: Tue, 14 Aug 2007 16:23:00 +0200 Subject: [Image-SIG] pil_usm for python 2.5? Message-ID: <46C1BAC4.6010802@tue.nl> Hi list, Does anybody have a version of pil_usm (module for gaussian blurring) that is compiled for Python 2.5? Regards, Dieter -- Dieter Vanderelst d.vanderelst at tue.nl Department of Industrial Design Designed Intelligence From jzshao1 at gmail.com Tue Aug 14 04:08:56 2007 From: jzshao1 at gmail.com (Jonathan Shao) Date: Mon, 13 Aug 2007 22:08:56 -0400 Subject: [Image-SIG] Newbie question on color detection and tracking Message-ID: I'm a relative newbie when it comes to image processing, so please bear with me... What I want to do is to set up a static camera such that it can track the motion of a person wearing a particular color marker walking around in an interior room (no windows). The "color marker" can be something like a t-shirt with a unique color distinctly different from the background, and I think I'll need to take periodic snap-shots of the room to simulate real-time tracking as closely as possible. In effect, it's a simplified scenario for person tracking. For now, I'm just trying to get the color detection part of my project working. I think I should be to just do a simple background subtraction between a snapshot by the camera and a reference image of the background, and that should be able to give me good color detection. The issues I'm concerned with: a) Do I need to worry about different hues/illuminations of the same color? b) Is this a realistic method to implement with the PIL, or would I have to deal with issues of speed while trying to track the marker? -- "Perhaps we all give the best of our hearts uncritically, to those who hardly think about us in return." ~ T.H.White -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070813/8db4dc2e/attachment.html From newz at bearfruit.org Wed Aug 15 21:41:32 2007 From: newz at bearfruit.org (Matthew Nuzum) Date: Wed, 15 Aug 2007 14:41:32 -0500 Subject: [Image-SIG] Newbie question on color detection and tracking In-Reply-To: References: Message-ID: Some people on this list will undoubtably have really awesome ideas for you on how you can use python to do this. Here are some ideas I've had in exploring this concept in the past (I created a dual camera 3d vision system a while ago)... One idea, and probably the best of the bunch, is to use a physical filter to limit the number of colors you receive. (Maybe you could do this in software as well, my cameras had a software controllable hue adjustment that allowed me to apply the filter without needing to use a physical filter or pre-process the image to apply the filter) Once you've got a range of values from black to whatever your filter color is, you can then find the largest section of the frame whose colors are far from black. As a possibility, you may find it easier to process the image one axis at a time. For example, assuming your image was only 8 pixels wide by 8 pixels high, [ [0,0,0,0,0,0,0,0], [0,0,0,2,2,0,0,0], [0,0,2,7,7,2,0,0], [0,2,5,9,9,4,2,0], [0,0,2,7,7,2,0,0], [0,0,0,2,2,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0] ] You could then average each column to find the x position which gives you 0, 0.25, 1.13, 3.38, 3.38, 1, 0.25, 0 meaning the colored item is at location (zero based) 3 or 4 (or 3.5). Then average each row to find the y axis which is 0, 0.5, 2.25, 3.88, 2.25, 0.5, 0, 0 meaning the colored item is at location 3, giving you a coordinate of x=3.5, y=3. I'll admit that going into my project I knew very little about Python, so I probably could now do it much better. The biggest problem with my system was that my camera, which could normally do 12 to 15 frames per second could only process the stereo images at 1.5 - 2.5 frames per second. I say "camera could only process..." but I mean the software/camera combination. I ended up spending a lot more time trying to make the motion fluid from a 2 fps image stream. It ended up working very well though. :-) It was a big learning curve project for me, since my cameras could only work together in Linux (In Windows, the camera driver had a bug allowing only one at a time), so I had to learn some kernel driver hacking in order to enable the hue adjustment, then video4linux, then image processing, then the graphics toolkit to display the images. On 8/13/07, Jonathan Shao wrote: > I'm a relative newbie when it comes to image processing, so please bear with > me... > > What I want to do is to set up a static camera such that it can track the > motion of a person wearing a particular color marker walking around in an > interior room (no windows). The "color marker" can be something like a > t-shirt with a unique color distinctly different from the background, and I > think I'll need to take periodic snap-shots of the room to simulate > real-time tracking as closely as possible. In effect, it's a simplified > scenario for person tracking. > > For now, I'm just trying to get the color detection part of my project > working. I think I should be to just do a simple background subtraction > between a snapshot by the camera and a reference image of the background, > and that should be able to give me good color detection. The issues I'm > concerned with: > > a) Do I need to worry about different hues/illuminations of the same color? > > b) Is this a realistic method to implement with the PIL, or would I have to > deal with issues of speed while trying to track the marker? > > -- > "Perhaps we all give the best of our hearts uncritically, to those who > hardly think about us in return." > ~ T.H.White > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > -- Matthew Nuzum newz2000 on freenode From adam.naples at yale.edu Wed Aug 15 21:16:58 2007 From: adam.naples at yale.edu (adam naples) Date: Wed, 15 Aug 2007 15:16:58 -0400 Subject: [Image-SIG] Newbie question on color detection and tracking In-Reply-To: References: Message-ID: a) yes, a lot, b) I don't think PIL is the way to go, use openCV, you can use it with python. http://sourceforge.net/projects/opencvlibrary/ c) computer vision is hard, but it sounds like you're talking about a very basic optitrack (maybe? I have no idea). I've not used them but remember to think about what will happen if the user occludes the color or t-shirt. Another reason this is hard is that the shadows and illumination will change a lot from frame to frame, so a background substitution will be hard even if the person is in a grey room with no furniture or wall decorations, they'll still cast shadows. My suggestion, that may make your life a lot easier is to install open cv and run the python lucas-kanade demo. it will capture frames from a camera, and you click the feature that you want it to track, if the conditions are good, it tracks it, and can do a pretty good job; even with multiple features. http://www.naturalpoint.com/optitrack/ hope this helps -a On Aug 13, 2007, at 10:08 PM, Jonathan Shao wrote: > I'm a relative newbie when it comes to image processing, so please > bear with me... > > What I want to do is to set up a static camera such that it can > track the motion of a person wearing a particular color marker > walking around in an interior room (no windows). The "color marker" > can be something like a t-shirt with a unique color distinctly > different from the background, and I think I'll need to take > periodic snap-shots of the room to simulate real-time tracking as > closely as possible. In effect, it's a simplified scenario for > person tracking. > > For now, I'm just trying to get the color detection part of my > project working. I think I should be to just do a simple background > subtraction between a snapshot by the camera and a reference image > of the background, and that should be able to give me good color > detection. The issues I'm concerned with: > > a) Do I need to worry about different hues/illuminations of the > same color? > > b) Is this a realistic method to implement with the PIL, or would I > have to deal with issues of speed while trying to track the marker? > > -- > "Perhaps we all give the best of our hearts uncritically, to those > who hardly think about us in return." > ~ T.H.White > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig The information contained in this message may be privileged and confidential. If you are NOT the intended recipient, please notify the sender immediately with a copy to hipaa.security at yale.edu and destroy this message. Please be aware that email communication can be intercepted in transmission or misdirected. Your use of email to communicate protected health information to us indicates that you acknowledge and accept the possible risks associated with such communication. Please consider communicating any sensitive information by telephone, fax or mail. If you do not wish to have your information sent by email, please contact the sender immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070815/60183990/attachment.html From dblank at brynmawr.edu Sat Aug 18 05:56:54 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Fri, 17 Aug 2007 23:56:54 -0400 (EDT) Subject: [Image-SIG] Moving from Image to Tkinter.PhotoImage Message-ID: <13486.71.59.123.159.1187409414.squirrel@webmail.brynmawr.edu> image-sig, I have an image that I have constructed from an array, and need to end up as a Tkinter.PhotoImage and I am a little confused as to how I get there. I have this working: self.array = array([0] * (height * width * 3), 'B') image = Image.frombuffer("RGB", (self.width, self.height), self.array, "raw", "RGB", 0, 1) but I need to end up with something equivalent to this kind of object: pim = Tkinter.PhotoImage(file=filename) I've tried ImageTk.PhotoImage(image) and other conversions, but I don't get an object with fields and methods like 'blank', 'cget', 'config', 'configure', 'copy', 'get', 'height', 'name', 'put', 'subsample', 'tk', 'type', 'width', 'write', and 'zoom'. What will turn image into a pim? Any hints appreciated, -Doug -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 From bbaxter at wadsworth.org Mon Aug 20 14:15:24 2007 From: bbaxter at wadsworth.org (William Baxter) Date: Mon, 20 Aug 2007 08:15:24 -0400 Subject: [Image-SIG] SGI format Message-ID: <46C985DC.F393DA00@wadsworth.org> Does anyone have any experience with the SGI RGB format? The PIL documentation says SGI images are 'read only'. Image does open them, but then it seems you can't get at the data. Any convert, copy, getpixel commands give an error: raise IOError("decoder %s not available" % decoder_name) IOError: decoder sgi_rle not available Thanks, Bill B -- William T. Baxter, Ph.D. Wadsworth Center Empire State Plaza, PO Box 509 Albany, NY 12201-0509 IMPORTANT NOTICE: This e-mail and any attachments may contain confidential or sensitive information which is, or may be, legally privileged or otherwise protected by law from further disclosure. It is intended only for the addressee. If you received this in error or from someone who was not authorized to send it to you, please do not distribute, copy or use it or any attachments. Please notify the sender immediately by reply e-mail and delete this from your system. Thank you for your cooperation. From connellybarnes at yahoo.com Mon Aug 20 23:24:46 2007 From: connellybarnes at yahoo.com (Connelly Barnes) Date: Mon, 20 Aug 2007 14:24:46 -0700 (PDT) Subject: [Image-SIG] Confirmation of bug compiling PIL and request that GIF patch be applied Message-ID: <85052.72320.qm@web54304.mail.re2.yahoo.com> Hi, 1. Confirming a bug in PIL compilation with Mingw on Windows I tried to compile PIL on Windows XP with Mingw. Compiling with the Python 2.5.1 binary obtained from the python.org site (which is compiled via Visual Studio .NET 2003) I obtained the same error that Michael Gross obtained: http://mail.python.org/pipermail/image-sig/2006-April/003854.html Following Fredrik Lundh's suggestion that this may be caused by a conflict in the runtime library that is linked against I installed an unofficial Mingw variant that allows several different "Microsoft Visual Studio" runtimes to be linked against, and linked against the runtime library that my Python binary was linked against (MSVCR71.DLL). This did not resolve the problem; the same error that Michael Gross reported was again obtained. Has anyone had success building PIL 1.1.6 on Windows with Mingw? 2. Requesting that GIF reading patch be applied Please apply the patch: http://www.nabble.com/Patch:-Animated-GIF-loading-t4088311.html This fixes the animated GIF reading support in PIL. After applying the patch, a GIF animation can be viewed by: for x in ImageSequence.Iterator(Image.open('x.gif')): x.show() Before applying the patch, it is not at all clear how to obtain the frames of the GIF animation; several hours of experimenting with the ImageSequence iterator and its various disposal and transparency fields availed me naught until I applied the patch. Thanks, Connelly Barnes connellybarnes.com ____________________________________________________________________________________ Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC From chicorbleak at gmail.com Tue Aug 21 06:34:09 2007 From: chicorbleak at gmail.com (Chic or Bleak) Date: Mon, 20 Aug 2007 21:34:09 -0700 Subject: [Image-SIG] Partial blur Message-ID: <6d2cfbd40708202134q644e0ba8j3801e548ce3ce90@mail.gmail.com> Hello, How would I go about blurring an oval-shaped part of my picture, instead of the whole thing? I couldn't find a way to do this using the tools I see in the API. Thanks CB From dblank at brynmawr.edu Wed Aug 22 02:15:14 2007 From: dblank at brynmawr.edu (Douglas S. Blank) Date: Tue, 21 Aug 2007 20:15:14 -0400 Subject: [Image-SIG] Moving from Image to Tkinter.PhotoImage In-Reply-To: <13486.71.59.123.159.1187409414.squirrel@webmail.brynmawr.edu> References: <13486.71.59.123.159.1187409414.squirrel@webmail.brynmawr.edu> Message-ID: <46CB8012.2020707@brynmawr.edu> Never mind. It looks like the problem I was having was based on some code running with one Tk() interpreter, and some other code running in another. This can happen fairly easily and cause problems in IDLE when run with subprocesses. The solution was to make sure that objects created (whether in the shell or in code) use the same root. -Doug Douglas S. Blank wrote: > image-sig, > > I have an image that I have constructed from an array, and need to end up > as a Tkinter.PhotoImage and I am a little confused as to how I get there. > > I have this working: > > self.array = array([0] * (height * width * 3), 'B') > image = Image.frombuffer("RGB", (self.width, self.height), self.array, > "raw", "RGB", 0, 1) > > but I need to end up with something equivalent to this kind of object: > > pim = Tkinter.PhotoImage(file=filename) > > I've tried ImageTk.PhotoImage(image) and other conversions, but I don't > get an object with fields and methods like 'blank', 'cget', 'config', > 'configure', 'copy', 'get', 'height', 'name', 'put', 'subsample', 'tk', > 'type', 'width', 'write', and 'zoom'. > > What will turn image into a pim? > > Any hints appreciated, > > -Doug > From peter.mowry at amd.com Fri Aug 24 00:13:59 2007 From: peter.mowry at amd.com (Mowry, Peter) Date: Thu, 23 Aug 2007 17:13:59 -0500 Subject: [Image-SIG] Build PIL (python imaging library) in Debug mode (win64, AMD64) In-Reply-To: <46CB8012.2020707@brynmawr.edu> References: <13486.71.59.123.159.1187409414.squirrel@webmail.brynmawr.edu> <46CB8012.2020707@brynmawr.edu> Message-ID: I want to - Build PIL (python imaging library) in Debug mode (win64, AMD64) I built python2.5.1 using visual studios (for win64, AMD64) (python_d.exe, etc). For other extension modules, such as ctypes, I just ran "python_d.exe setup.py", and setup.py automatically chose to build ctypes_d.pyd (in debug mode). But for PIL, I ran "python_d.exe setup.py", and it still tries to build _imgaging.pyd (not _imaging_d.pyd - debug). It looks for python25.lib (instead of python25_d.lib). How can I tell PIL to build me a python debug extension (using my custom build of python2.5.1 debug python_d.exe) instead of a python release extension? Thanks ----------- 4) build Python Imaging Library (for "import PIL") * our source has unmodified zlib123 (zlib 1.2.3) (from http://www.zlib.net/) source (for zip / png support) * our source has unmodified ijg jpeg library (for jpeg support) (from http://www.ijg.org/files/jpegsrc.v6b.tar.gz) a) Edit setup.py: # see http://docs.python.org/dist/module-distutils.msvccompiler.html os.environ['DISTUTILS_USE_SDK'] = "1" os.environ['MSSdk'] = "1" # see http://www.wiredfool.com/2005/10/29/how-to-build-the-python-imaging-libr ary-for-windows/ FREETYPE_ROOT = None JPEG_ROOT = "jpeg-6b" TIFF_ROOT = None ZLIB_ROOT = "zlib-1.2.3" TCL_ROOT = None # ignore tkinter support since it wasn't working and I just want png support # this step was not necessary for my build, but may be for some scenarios #import _tkinter import _tkinter_I_am_not_really_Importing_it b) open "Visual Studio 2005 x64 Win64 Command Prompt" c) build jpeg dependency: cd Imaging-1.1.6\jpeg-6b copy jconfig.vc jconfig.h nmake /f makefile.vc d) build zlib dependency cd Imaging-1.1.6\zlib-1.2.3 nmake /f win32/Makefile.msc e) build PIL cd Imaging-1.1.6\ ..\Build_Win64\python.exe setup.py build TODO: - paths??? Again, getting setup.py to build was messy b/c I wasn't sure how to tell setup.py where to look for the missing files (python .h files and python25.lib), so I copied them to local folders in the PIL build - to hack the build to work * copied headers (Python-2.5.1\Include\*.h) (Python-2.5.1\PC\pyconfig.h) to (Imaging1.1.6\libImaging) * copied python25.lib to Imaging1.1.6\ From martin at v.loewis.de Sat Aug 25 06:16:35 2007 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat, 25 Aug 2007 06:16:35 +0200 Subject: [Image-SIG] [Python-Help] Build PIL (python imaging library) in Debug mode (win64, AMD64) In-Reply-To: References: <13486.71.59.123.159.1187409414.squirrel@webmail.brynmawr.edu> <46CB8012.2020707@brynmawr.edu> Message-ID: <46CFAD23.7090903@v.loewis.de> > How can I tell PIL to build me a python debug extension (using my custom > build of python2.5.1 debug python_d.exe) instead of a python release > extension? You will have to edit PIL's setup.py to support that case. Check whether self.debug is set inside build_extension; if it is not, trace through the code how it got lost. Check whether get_ext_filename gets invoked; if so, trace through the code why it fails to append _d.pyd, if not, check whether get_outputs gets invoked. Regards, Martin From izakmarais at yahoo.com Thu Aug 23 11:24:49 2007 From: izakmarais at yahoo.com (izak marais) Date: Thu, 23 Aug 2007 02:24:49 -0700 (PDT) Subject: [Image-SIG] Down-sampling: ANTIALIAS implementation details? Message-ID: <724907.58164.qm@web50901.mail.re2.yahoo.com> Hi Does anyone know what sort of averaging happens when down-sampling an iamge with .thumbnail(, Image.ANTIALIAS). Is it a Gaussian average of ot a block average? Thanks in advance! Izak Marais --------------------------------- Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070823/acf73c2c/attachment.htm From izakmarais at yahoo.com Thu Aug 23 11:35:24 2007 From: izakmarais at yahoo.com (izak marais) Date: Thu, 23 Aug 2007 02:35:24 -0700 (PDT) Subject: [Image-SIG] Down-sampling: ANTIALIAS implementation details? Message-ID: <17269.68244.qm@web50909.mail.re2.yahoo.com> Sorry, I see the documentation is quite sufficient. --------------------------------- Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070823/67775e70/attachment.htm From David.L.Goldsmith at noaa.gov Sat Aug 25 22:17:11 2007 From: David.L.Goldsmith at noaa.gov (David Goldsmith) Date: Sat, 25 Aug 2007 13:17:11 -0700 Subject: [Image-SIG] [Mac 10.4.10, Python 2.5] PIL Newbie Message-ID: <46D08E47.1000906@noaa.gov> Hi! Just getting started w/ PIL. Using the tutorial, I successfully got as far as opening up a png file; when I tried to "show" it, however, I got the following final error: File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/Image.py", line 391, in _getencoder raise IOError("encoder %s not available" % encoder_name) IOError: encoder jpeg not available Please help! Thanks! DG -- ERD/ORR/NOS/NOAA From jwt at onjapan.net Sun Aug 26 00:42:30 2007 From: jwt at onjapan.net (Jim Tittsler) Date: Sun, 26 Aug 2007 10:42:30 +1200 Subject: [Image-SIG] [Mac 10.4.10, Python 2.5] PIL Newbie In-Reply-To: <46D08E47.1000906@noaa.gov> References: <46D08E47.1000906@noaa.gov> Message-ID: <1F3AFB66-9CBB-4CB2-8D9D-C64B02889E97@onjapan.net> On Aug 26, 2007, at 08:17, David Goldsmith wrote: > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > site-packages/PIL/Image.py", > line 391, in _getencoder > raise IOError("encoder %s not available" % encoder_name) > IOError: encoder jpeg not available > > Please help! Thanks! It looks like you built PIL without the JPEG libraries, and so don't have JPEG support. Did you try using one of the prebuilt binaries from http://pythonmac.org/packages/ -- Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6 Python Starship http://Starship.Python.net/crew/jwt/ Mailman IRC irc://irc.freenode.net/#mailman From David.L.Goldsmith at noaa.gov Sun Aug 26 05:57:50 2007 From: David.L.Goldsmith at noaa.gov (David Goldsmith) Date: Sat, 25 Aug 2007 20:57:50 -0700 Subject: [Image-SIG] [Mac 10.4.10, Python 2.5] PIL Newbie Message-ID: <46D0FA3E.9050703@noaa.gov> > On Aug 26, 2007, at 08:17, David Goldsmith wrote: >>/ File />>/ "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ />>/ site-packages/PIL/Image.py", />>/ line 391, in _getencoder />>/ raise IOError("encoder %s not available" % encoder_name) />>/ IOError: encoder jpeg not available />>/ />>/ Please help! Thanks! /> > It looks like you built PIL without the JPEG libraries, and so don't > have JPEG support. Did you try using one of the prebuilt binaries > from http://pythonmac.org/packages/ Not yet, 'cause I didn't know they existed - http://www.pythonware.com/products/pil/ (which is what Google led me to) makes no mention of them; I built from source 'cause I thought I had to. Thanks! DG -- ERD/ORR/NOS/NOAA From archsheep at yahoo.com.br Sat Aug 25 22:08:04 2007 From: archsheep at yahoo.com.br (Alex Torquato S. Carneiro) Date: Sat, 25 Aug 2007 13:08:04 -0700 (PDT) Subject: [Image-SIG] Wavelets Message-ID: <483587.88580.qm@web63409.mail.re1.yahoo.com> I everyone. Anyone studies wavelets? I'm doing a project and don't find anything about Mexican Hat, Meyer and Morlet wavelets. I can use Python, Scilab or C/C++ (prefer for 2 firsts). Thanks, Alex. Flickr agora em portugu?s. Voc? clica, todo mundo v?. http://www.flickr.com.br/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070825/ffda4b90/attachment.htm From bldrake at adaptcs.com Sun Aug 26 22:45:57 2007 From: bldrake at adaptcs.com (B. L. Drake) Date: Sun, 26 Aug 2007 13:45:57 -0700 (PDT) Subject: [Image-SIG] Wavelets In-Reply-To: <483587.88580.qm@web63409.mail.re1.yahoo.com> Message-ID: <102667.63428.qm@web412.biz.mail.mud.yahoo.com> Alex, I wrote a wavelet package for LabVIEW a number of years ago. The code I based it on was from the Stanford Statistics dept. They have a software package (free download at the time) written in Matlab that can be easily translated to other languages. I had to dig around for the wavelet coefficients, which might be easier these days (perhaps automatic generation). Here is the link to this software: http://www-stat.stanford.edu/software/wavelab/ Hope this helps. Barry Drake "Alex Torquato S. Carneiro" wrote: I everyone. Anyone studies wavelets? I'm doing a project and don't find anything about Mexican Hat, Meyer and Morlet wavelets. I can use Python, Scilab or C/C++ (prefer for 2 firsts). Thanks, Alex. Flickr agora em portugu?s. Voc? clica, todo mundo v?. Saiba mais. _______________________________________________ Image-SIG maillist - Image-SIG at python.org http://mail.python.org/mailman/listinfo/image-sig -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070826/5ba762de/attachment.htm From stefan at sun.ac.za Tue Aug 28 17:22:15 2007 From: stefan at sun.ac.za (Stefan van der Walt) Date: Tue, 28 Aug 2007 17:22:15 +0200 Subject: [Image-SIG] PIL.Image.fromarray broken for RGBA images Message-ID: <20070828152215.GE14395@mentat.za.net> Hi all, The attached patch restructures Image.fromarray and fixes it for RGBA images. I hope this is the right place to post it (if not, I'd appreciate it if you could point me in the right direction). Regards St?fan -------------- next part -------------- A non-text attachment was scrubbed... Name: PIL.Image.patch Type: text/x-diff Size: 2093 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20070828/f424e709/attachment.patch From fei.xu at rutgers.edu Wed Aug 29 15:33:09 2007 From: fei.xu at rutgers.edu (Fei Xu) Date: Wed, 29 Aug 2007 09:33:09 -0400 Subject: [Image-SIG] how to draw a subscript in text Message-ID: Hi! Is there any module in PIL, which draws a subscript such as G0 (here 0 is a subscript) in text? If we cannot draw a subscript letter or number automatically, I have to change the font size and calculate the locations of the subscript letters thoroughly. Or if there is no subscript module, could you tell me any clever way to write a subscript? Thanks! Best, Fei From connellybarnes at yahoo.com Thu Aug 30 02:39:28 2007 From: connellybarnes at yahoo.com (Connelly Barnes) Date: Wed, 29 Aug 2007 17:39:28 -0700 (PDT) Subject: [Image-SIG] Confirmation of bug compiling PIL and request that GIF patch be applied Message-ID: <858306.86443.qm@web54304.mail.re2.yahoo.com> > Please apply the patch: > > http://www.nabble.com/Patch:-Animated-GIF-loading-t4088311.html > > This fixes the animated GIF reading support in PIL. Here's a binary for Python 2.5 on Win32 with the GIF reading patch applied: http://www.connellybarnes.com/code/python/pil-1.1.6-gif-patched-py2.5-win32.zip It includes JPG and PNG support, but not Freetype nor Tk support. Take care, Connelly ____________________________________________________________________________________ Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/ From cardona at ucla.edu Thu Aug 30 17:47:34 2007 From: cardona at ucla.edu (Albert Cardona) Date: Thu, 30 Aug 2007 08:47:34 -0700 Subject: [Image-SIG] multitiff / multiframe images In-Reply-To: <46C0E3D8.6050501@ucla.edu> References: <46C0E3D8.6050501@ucla.edu> Message-ID: <46D6E696.4070902@ucla.edu> Noone is using multitiff images at all? I am surprised then that such functionality is kind of in PIL. If anyone has any information related to multitiff / multiframe images, I'd appreciate if he'd share it. Albert > Is there anyway to create mutliframe images? I have no problem in > reading multitif with seek() and so on, but how to create them? > merge() is only for multiband images, not multiframe. > -- Albert Cardona http://www.mcdb.ucla.edu/Research/Hartenstein/acardona From rajib.d.4u at gmail.com Fri Aug 31 07:00:57 2007 From: rajib.d.4u at gmail.com (Rajib Das) Date: Fri, 31 Aug 2007 10:30:57 +0530 Subject: [Image-SIG] SAP mm & pm module Message-ID: <78f81b760708302200i726bcfd2jdcb6ff099e93a1b1@mail.gmail.com> pl. send mail subject to SAP preferably pm & mm module. -- Thanx & Regards Rajib Das From nickg at modp.com Wed Aug 29 06:22:45 2007 From: nickg at modp.com (Nick Galbreath) Date: Wed, 29 Aug 2007 00:22:45 -0400 Subject: [Image-SIG] PNG metadata, patches, etc Message-ID: <4c95589d0708282122hc5ddd98jf60c571868c58cba@mail.gmail.com> Hi all, While not well advertised, PIL 1.1.6 supports reading __and writing__ of PNG metadata. This means, you can "tag" your images with the creation data, the editor, the original source file, copyright information, anything. I know, exciting stuff. The catch is that you can't use Image.save directly, but have to copy metadata into a "secret" object (well _I_ didn't find it documented, maybe I missed it) and pass that to Image.save. (if you use Image.save directly, all metadata is lost). http://blog.modp.com/2007/08/python-pil-and-png-metadata-take-2.html # # wrapper around PIL 1.1.6 Image.save to preserve PNG metadata # # public domain, Nick Galbreath # http://blog.modp.com/2007/08/python-pil-and-png-metadata-take-2.html # def pngsave(im, file): # these can be automatically added to Image.info dict # they are not user-added metadata reserved = ('interlace', 'gamma', 'dpi', 'transparency', 'aspect') # undocumented class from PIL import PngImagePlugin meta = PngImagePlugin.PngInfo() # copy from Image.info to new dict for k,v in im.info.iteritems(): if k in reserved: continue meta.add_text(k, v, 0) # and save im.save(file, "PNG", pnginfo=meta) Ideally, i'd love to "fix" PngImagePlugin.py to write out metadata, and/or be able to read the zTXt chunks (especially since there is code to write zTXt chunks). I'm happy to work on an "official patch" -- there is more than one way to do it and since this issue has come up a few times (see below), I'm wondering what the right protocol is, or if it's already been done in mainline? thanks, --nickg http://mail.python.org/pipermail/image-sig/2007-February/004343.html http://mail.python.org/pipermail/image-sig/1999-May/000737.html http://mail.python.org/pipermail/image-sig/1998-July/000529.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070829/ac973201/attachment.htm