From bram at smartelectronix.com Fri Jun 1 19:24:42 2007 From: bram at smartelectronix.com (Bram - Smartelectronix) Date: Fri, 01 Jun 2007 19:24:42 +0200 Subject: [Image-SIG] PIL + animated gifs + example + problems Message-ID: <4660565A.3090702@smartelectronix.com> Hello Everyone, this is my first post here... After looking around on the web and not finding any conclusive examples on how to *process* animated GIF's with PIL, I decided to write a small example (of course based on gifmaker.py). This script takes an input file, explodes it, resizes every frame and them implodes it again into an animated GIF. The script is included at the bottom of this email. However, there's some problems: 1. the file written in a LOT larger than the original file (when no resize is being done). From a 1MB animated GIF I get a 3MB one. I tried the gifmaker trick of writing only the changed pixels, but this completely warped the image. 2. the animation speed of the end-result isn't controlable (as far as I know). Is there a hack/workaround for this problem? thanks a lot, - bram ---------------------------------------------------------------------- # here's the example script import Image from GifImagePlugin import getheader, getdata # my two local examples... input_filename = "FlrSer.gif" output_filename = "out.gif" im = Image.open(input_filename) im.load() # get all the frames into a big array frame = 0 frames = [] while 1: try: im.seek(frame) frames.append(im.copy()) frame += 1 except EOFError: break outfile = file(output_filename, "wb") for (index, image) in enumerate(frames): # process image here... # this is just an example new_size = image.size[0]/2, image.size[1]/2 image = image.resize( new_size ) # only write the header at the start if index == 0: for s in getheader(image): outfile.write(s) for s in getdata(image): outfile.write(s) outfile.write(';') outfile.close() # sadly enough we are now left with # 1. an image that is larger than the original (??) # 2. frames that run at a different speed than the original From franciscojseva at gmail.com Sat Jun 2 17:59:13 2007 From: franciscojseva at gmail.com (=?ISO-8859-1?Q?Francisco_Jos=E9_Seva_Mora?=) Date: Sat, 2 Jun 2007 17:59:13 +0200 Subject: [Image-SIG] ImagePalette class problem Message-ID: <85f8c5780706020859p798a227dq4cff4229495a7863@mail.gmail.com> Hello!! I'm trying to use the ImagePalette class from PIL ( python image library ) to load a dicom image that I have decoded. I read the official documentation and many other articles from blogs and webs but many of them are copies of the official documentation. I'm trying to use this class to set the right palette to the image because I think the default palette don't have the necesary scale to represent the image. To load the image I use this code : imagen=Image.frombuffer( "P", (self.__width,self.__height), self.__data, "raw", "P", 0, 1) and the code to treat the bytes of the image is : for i in range(self.__width*self._ _height): self.__data.insert(i,(0xff & img[(2*i)+1]<<8 )| 0xff & img[(2*i)] ) I supose that it is a 16 bits monocrome image. Someone knows how to set a palette?? or a link to read something about it?? Thanks Francisco J. Seva -- blog: www.lacoctelera.com/nupi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070602/5f94ca09/attachment.html From bblais at bryant.edu Tue Jun 5 12:34:01 2007 From: bblais at bryant.edu (Brian Blais) Date: Tue, 05 Jun 2007 06:34:01 -0400 Subject: [Image-SIG] Image to matrix In-Reply-To: <346753.73947.qm@web63404.mail.re1.yahoo.com> References: <346753.73947.qm@web63404.mail.re1.yahoo.com> Message-ID: <46653C19.6050301@bryant.edu> Alex Torquato S. Carneiro wrote: > I'm doing a project in Python. It's a capture and process a image, I'm > using PIL for images and scipy (together numpy) for processing, about > fft, filter, etc.. > I'm needing to convert a image in a matrix type, can anyone help me? > > Thanks. > Alex. > This is what I've used. I started with: http://effbot.org/zone/pil-numpy.htm which uses the old numeric package, and modified it slightly for numpy, so it looks like: import numpy, Image def image2array(im): if im.mode not in ("L", "F"): raise ValueError, "can only convert single-layer images" if im.mode == "L": a = numpy.fromstring(im.tostring(), numpy.UInt8) else: a = numpy.fromstring(im.tostring(), numpy.Float32) a.shape = im.size[1], im.size[0] return a def array2image(a): if a.dtype.name == 'uint8': mode = "L" elif a.dtype.name == 'float32': mode = "F" elif a.dtype.name == 'float64': a=a.astype('float32') mode = "F" else: raise ValueError, "unsupported image mode %s" % a.dtype.name return Image.fromstring(mode, (a.shape[1], a.shape[0]), a.tostring()) seems to work! bb -- ----------------- bblais at bryant.edu http://web.bryant.edu/~bblais From lubin_fayolle at yahoo.fr Tue Jun 5 18:36:50 2007 From: lubin_fayolle at yahoo.fr (Lubin Fayolle) Date: Tue, 05 Jun 2007 18:36:50 +0200 Subject: [Image-SIG] ImagePalette class problem In-Reply-To: <85f8c5780706020859p798a227dq4cff4229495a7863@mail.gmail.com> References: <85f8c5780706020859p798a227dq4cff4229495a7863@mail.gmail.com> Message-ID: <46659122.3090606@yahoo.fr> Hello, In scipy.misc you can find the fromimage function, which returns an array, the type of which depends on your image (if your image is RGB it will be 3-dimensional). You can then convert it into a matrix. Lubin --- "Alex Torquato S. Carneiro" a ?crit : > > I'm doing a project in Python. It's a capture and > > process a image, I'm using PIL for images and scipy > > (together numpy) for processing, about fft, filter, > > etc.. > > I'm needing to convert a image in a matrix type, can > > anyone help me? > > > > Thanks. > > Alex. > > > > > > > > > > __________________________________________________ > > Fale com seus amigos de gra?a com o novo Yahoo! > > Messenger > > http://br.messenger.yahoo.com/ > > _______________________________________________ > > Image-SIG maillist - Image-SIG at python.org > > http://mail.python.org/mailman/listinfo/image-sig > > > From Chris.Barker at noaa.gov Wed Jun 6 07:16:21 2007 From: Chris.Barker at noaa.gov (Chris.Barker at noaa.gov) Date: Tue, 05 Jun 2007 22:16:21 -0700 Subject: [Image-SIG] Image to matrix Message-ID: <117dc811c014.11c014117dc8@noaa.gov> Alex Torquato S. Carneiro wrote: > I'm doing a project in Python. It's a capture and process a image, I'm > using PIL for images and scipy (together numpy) > I'm needing to convert a image in a matrix type, can anyone help me? The latest version of PIL supports this directly, you can do: M = numpy.asarray(PIL_Image) http://effbot.org/zone/pil-changes-116.htm -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 fredrik at pythonware.com Wed Jun 6 11:17:20 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 06 Jun 2007 11:17:20 +0200 Subject: [Image-SIG] window level and width In-Reply-To: <259a47240705281458o17d66e23n8d389c7fb6703465@mail.gmail.com> References: <259a47240705281458o17d66e23n8d389c7fb6703465@mail.gmail.com> Message-ID: Dr.Ashoka G K wrote: > Many DICOM related softwares have a feature to alter window level and > window width of the images. Is this the same as changing the > brightness and contrast of the image? my guess is that the "window" is the range of levels in the source image that's being mapped to the 256 levels supported by most displays. if "image" is an "L" or "I" image, you can use the "point" method to do linear windowing: scale = 256.0 / window_width offset = -window_level * scale out = image.point(lambda i: i * scale + offset, "L") to implement non-linear transforms, use a lookup table instead (see the "point" documentation for details). hope this helps! From fredrik at pythonware.com Wed Jun 6 11:19:37 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 06 Jun 2007 11:19:37 +0200 Subject: [Image-SIG] ImagePalette class problem In-Reply-To: <85f8c5780706020859p798a227dq4cff4229495a7863@mail.gmail.com> References: <85f8c5780706020859p798a227dq4cff4229495a7863@mail.gmail.com> Message-ID: Francisco Jos? Seva Mora wrote: > Hello!! I'm trying to use the ImagePalette class from PIL ( python > image library ) to load a dicom image that I have decoded. I read the > official documentation and many other articles from blogs and webs but > many of them are copies of the official documentation. > > I'm trying to use this class to set the right palette to the image > because I think the default palette don't have the necesary scale > to represent the image. the easiest way to add a palette to an image is to create a mode "L" image, and then use the "putpalette" method: im = ... im.putpalette([r0, g0, b0, r1, b1, g1, ..., r255, g255, b255]) (you can use a 768-byte string as well). hope this helps. From bronto at pobox.com Thu Jun 7 07:25:48 2007 From: bronto at pobox.com (Anton Sherwood) Date: Wed, 06 Jun 2007 22:25:48 -0700 Subject: [Image-SIG] PIL newbie Message-ID: <466796DC.2010700@pobox.com> Hi, I'm attempting to use PIL for the first time, and getting all kinds of type errors. Latest version: File "d1.py", line 50, in im.putdata(zz, 1.0, 0.0) ## zz is a list of RGB tuples File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/Image.py", line 1120, in putdata self.im.putdata(data, scale, offset) SystemError: new style getargs format but argument is not a tuple -- Anton Sherwood, http://www.ogre.nu/ "How'd ya like to climb this high *without* no mountain?" --Porky Pine From fredrik at pythonware.com Thu Jun 7 19:35:57 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 07 Jun 2007 19:35:57 +0200 Subject: [Image-SIG] PIL newbie In-Reply-To: <466796DC.2010700@pobox.com> References: <466796DC.2010700@pobox.com> Message-ID: Anton Sherwood wrote: > Hi, I'm attempting to use PIL for the first time, > and getting all kinds of type errors. Latest version: > > File "d1.py", line 50, in > im.putdata(zz, 1.0, 0.0) ## zz is a list of RGB tuples what's im.mode ? what's zz[:10] (the first ten entries in the list) can you reproduce the error with a minimal test program? e.g. something like im = Image.new(..., (2, 2)) im.putdata([...], 1.0, 0.0) where ... is a mode and data that matches what you're using when you got that error? From bronto at pobox.com Tue Jun 12 10:59:50 2007 From: bronto at pobox.com (Anton Sherwood) Date: Tue, 12 Jun 2007 01:59:50 -0700 Subject: [Image-SIG] PIL newbie In-Reply-To: <466796DC.2010700@pobox.com> References: <466796DC.2010700@pobox.com> Message-ID: <466E6086.4060304@pobox.com> I wrote (June 6): > Hi, I'm attempting to use PIL for the first time, > and getting all kinds of type errors. Latest version: > > File "d1.py", line 50, in > im.putdata(zz, 1.0, 0.0) ## zz is a list of RGB tuples > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL/Image.py", > line 1120, in putdata > self.im.putdata(data, scale, offset) > SystemError: new style getargs format but argument is not a tuple I eventually found all my bugs. First of all, zz was a list of lists, not tuples, *and* it wasn't fully populated (some entries were None). For the result of my efforts, see http://www.ogre.nu/wp/?p=1984 -- Anton Sherwood, http://www.ogre.nu/ "How'd ya like to climb this high *without* no mountain?" --Porky Pine From tom.heathcote at petris.com Tue Jun 12 20:59:10 2007 From: tom.heathcote at petris.com (Tom Heathcote) Date: Tue, 12 Jun 2007 19:59:10 +0100 Subject: [Image-SIG] Fixes to PIL for handling XPM files. Message-ID: <466EECFE.2020201@petris.com> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070612/a8bce014/attachment.htm -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: changes.diff Url: http://mail.python.org/pipermail/image-sig/attachments/20070612/a8bce014/attachment-0001.diff From mark.wendell at gmail.com Thu Jun 14 05:36:42 2007 From: mark.wendell at gmail.com (Mark Wendell) Date: Wed, 13 Jun 2007 20:36:42 -0700 Subject: [Image-SIG] memory flush? Message-ID: I'm working on some code that computes weighted averages of a series of images. I do this by loading a subset of the large image list (maybe a dozen images at a time), computing their average, and then saving the result image to disk. Once I'm done with that subset, I load a new batch and repeat. The problem is that over time, I start swapping and eventually get memory-related overflow problems. Here's the output of a typical memory crash: Error in sys.excepthook: Traceback (most recent call last): File "/var/lib/python-support/python2.5/apport_python_hook.py", line 30, in apport_excepthook import apport.report, apport.fileutils File "/var/lib/python-support/python2.5/apport/__init__.py", line 1, in from apport.report import Report File "/var/lib/python-support/python2.5/apport/report.py", line 20, in from problem_report import ProblemReport File "/var/lib/python-support/python2.5/problem_report.py", line 17, in from email.MIMEMultipart import MIMEMultipart File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 79, in __getattr__ File "email/mime/multipart.py", line 9, in File "email/mime/base.py", line 9, in ValueError: bad marshal data Original exception was: Traceback (most recent call last): File "/home/mark/sandbox/im_retimer/retimer_tester.py", line 24, in imstacklist[i].computeBlendImg() File "/home/mark/sandbox/im_retimer/im_retimer.py", line 80, in computeBlendImg self.tmpImg = Image.blend(self.blackImg, self.imObjStack[i], self.imWeights[i]) File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1944, in blend return im1._new(core.blend(im1.im, im2.im, alpha)) MemoryError The thing is that I have plenty of memory for any given batch. The problem seems to be that PIL or python is not doing a good job of automatically flushing memory of image objects that I don't use anymore. So my question is: is there a way to force the flushing from memory of image objects I no longer need? Any other ideas for managing this kind of overflow? Over time, my program may try to load hundreds of images, but I only need to run computations on a few at a time. thanks mark -- -- Mark Wendell From ktenney at gmail.com Sat Jun 16 16:01:57 2007 From: ktenney at gmail.com (Kent Tenney) Date: Sat, 16 Jun 2007 09:01:57 -0500 Subject: [Image-SIG] Question about transform(size, PERSPECTIVE, data) Message-ID: Howdy, Starting with a 100 x 20 image, I want to produce a trapezoid with corners at top left = 20,0 top right = 80,0 bottom left = 0,20 bottom right = 100,20 the image now has a 45 degree bevel at the ends. I've found that the data param to transform PERSPECTIVE, a,b,c,d,e,f,g,h represents:: (a x + b y + c)/(g x + h y + 1), (d x + e y + f)/(g x + h y + 1) I don't have the math skills to solve for the result I need. Any help is greatly appreciated. Thanks, Kent PS Why? I want to place an image within a larger image, with the smaller in a frame which blends between the two. This seamless embedding is quite a nice effect. The perspective effect is to miter the edges of the frame. At one time I implemented a crude version which just cropped the blended elements to 45 degree, now I want to revisit doing a proper transform. From noahspurrier at gmail.com Mon Jun 18 17:43:13 2007 From: noahspurrier at gmail.com (Noah.org) Date: Mon, 18 Jun 2007 08:43:13 -0700 Subject: [Image-SIG] threshold cutoff Message-ID: How can I set the absolute white or black level of an image? I want all pixels above or below a certain value clipped. For example, I want all pixels brighter than 200 to be set to 255 (assuming an 8-bit gray-scale image). It seems like ImageOps.autocontrast(image, cutoff=0) is close to what I want, but I was frustrated in my attempts to use cutoff. It didn't seem to do what I expected. If I set an extreme cutoff=50 I ended up with a pale, gray washed-out image. That is not totally surprising since I am basically throwing away large parts of the image, but what seemed odd is that I did not end up with any blacks. The docs say that after applying the histogram cutoff that the darkest remaining pixel becomes black, but I didn't get any blacks. im1 = Image.open("image1.jpg") im1.draft('L',(320,240)) im1.load() im1 = ImageOps.autocontrast(im1, cutoff=50) Yours, Noah From douglas at paradise.net.nz Thu Jun 21 09:42:27 2007 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Thu, 21 Jun 2007 19:42:27 +1200 Subject: [Image-SIG] threshold cutoff In-Reply-To: References: Message-ID: <467A2BE3.4070008@paradise.net.nz> Noah.org wrote: > How can I set the absolute white or black level of an image? > I want all pixels above or below a certain value clipped. > For example, I want all pixels brighter than 200 to be set to 255 > (assuming an 8-bit gray-scale image). It sounds to me like you want the image point method. http://effbot.org/imagingbook/image.htm#Image.point Something like this will expand the middle range of an image and clip the extremes: t = [min(255, max(0, x + x/4 - 32)) for x in range(256)] im_clipped = im.point(t) douglas From acheng at scripps.edu Fri Jun 22 01:10:48 2007 From: acheng at scripps.edu (Anchi Cheng) Date: Thu, 21 Jun 2007 16:10:48 -0700 Subject: [Image-SIG] png read/save error on x86_64 Message-ID: <467B0578.4080202@scripps.edu> Hi, there, I can't read or save PNG files from image on x86_64 machines running Linux with either PIL 1.1.5 or 1.1.6. No problem on x86_32. For saving, got encoder error -8. For loading, got IOError: bad configuration when reading image file. Please help! Anchi From mark.wendell at gmail.com Fri Jun 22 17:03:00 2007 From: mark.wendell at gmail.com (Mark Wendell) Date: Fri, 22 Jun 2007 08:03:00 -0700 Subject: [Image-SIG] writing 16-bit rgb images? Message-ID: I'm using PIL to do some color image processing that requires more precision than the default 8bit rgb provides. To that end, I've been able to convert images to numpy arrays and do the math in long ints. The problem is that the Image.fromarray method seems to require that I convert back to 8-bits. This introduces quantization artifacts I'm trying to avoid. Any way to write out a 16-bit RGB tiff (for example) from a numpy array? thanks Mark -- -- Mark Wendell From snaury at gmail.com Fri Jun 22 20:35:35 2007 From: snaury at gmail.com (Alexey Borzenkov) Date: Fri, 22 Jun 2007 22:35:35 +0400 Subject: [Image-SIG] Support for writing tga images of different orientations Message-ID: Hi everyone, Another patch (against my tga saving patch) that I'm not sure anyone needs or appreciates: Index: PIL/TgaImagePlugin.py =================================================================== --- PIL/TgaImagePlugin.py (revision 284) +++ PIL/TgaImagePlugin.py (revision 331) @@ -100,6 +100,8 @@ else: raise SyntaxError, "unknown TGA orientation" + self.info["orientation"] = orientation + if imagetype & 8: self.info["compression"] = "tga_rle" @@ -163,6 +165,15 @@ else: colormapfirst, colormaplength, colormapentry = 0, 0, 0 + if im.mode == "RGBA": + flags = 8 + else: + flags = 0 + + orientation = im.info.get("orientation", -1) + if orientation > 0: + flags = flags | 0x20 + fp.write("\000" + chr(colormaptype) + chr(imagetype) + @@ -174,12 +185,12 @@ o16(im.size[0]) + o16(im.size[1]) + chr(bits) + - chr(0x20)) + chr(flags)) if colormaptype: fp.write(im.im.getpalette("RGB", "BGR")) - ImageFile._save(im, fp, [("raw", (0,0)+im.size, 0, (rawmode, 0, 1))]) + ImageFile._save(im, fp, [("raw", (0,0)+im.size, 0, (rawmode, 0, orientation))]) # # -------------------------------------------------------------------- From mariano.difelice at gmail.com Mon Jun 25 16:10:23 2007 From: mariano.difelice at gmail.com (Mariano Di Felice) Date: Mon, 25 Jun 2007 16:10:23 +0200 Subject: [Image-SIG] red-eye script In-Reply-To: References: <467B0D0A.1090000@ulmcnett.com> Message-ID: <467FCCCF.7080302@gmail.com> Hi, I was finding a script/tool written in Python which can help me to delete red-eye effect from images. Do you know something about it? open o commercial?? I have found that GIMP utilise a redeye.c script, but I don't know how to utilize it. thanks From renier at morales-rodriguez.net Wed Jun 27 08:59:49 2007 From: renier at morales-rodriguez.net (Renier Morales =?ISO-8859-1?Q?Rodr=EDguez?=) Date: Wed, 27 Jun 2007 02:59:49 -0400 Subject: [Image-SIG] Fw: Patch: TIFF Group 3/4 decoder support for PIL 1.1.6 Message-ID: <20070627025949.39215240@sirius.homelinux.net> Resending. First email was over 40KB because of attachment and got held up. Attachment can be found here: http://www.pastebin.ca/raw/591452 Begin forwarded message: Date: Wed, 27 Jun 2007 02:38:50 -0400 From: Renier Morales Rodr?guez To: image-sig at python.org, tiff at lists.maptools.org Subject: Patch: TIFF Group 3/4 decoder support for PIL 1.1.6 Hello, Attached is a patch to add TIFF Group 3/4, TIFF CCITT, and TIFF RAW_16 decoding to PIL 1.1.6. The lack of this in PIL is something people have complained/asked about off and on for years (from looking at mailing lists and forums on google). However, this is not a new patch. It is completley based on a patch by Vladimir Pastukhov posted to the image-sig mailing list in the year of 2003 (http://mail.python.org/pipermail/image-sig/2003-July/002354.html). All I have done is adapted it so that it applies to PIL 1.1.6. I tested it against libtiff 3.8.2. One problem with the patch, and I suppose the reason why it never catched on, is that it requires libtiff header files that are not installed as per the current libtiff's installation process. These are tiffiop.h, tif_dir.h, and tif_config.h. Thus, I am also cc'ing the libtiff mailing list here. I solve the problem by adding the needed files to the PIL patch from the libtiff configured source. I assume this is not a problem license-wise as both libraries are under the BSD. Is this correct? I know this is far from ideal. There is a libtiff bug report from the year 2004 (http://bugzilla.remotesensing.org/show_bug.cgi?id=688) explaning the need for tiffiop.h and tif_dir.h to be installed (tiffiop.h didn't use tiff_config.h back then). There is also the explanation of why they are not installed (they contain private structures and functions) along with the intention, but without promises, of creating some separate interface for this kind of access. I'm adding my vote to that request, but couldn't the header files in question just be installed in the meantime? Given that there is no timeline for such special interface and all. The other problem is that, besides needing other eyes to revise the patch, I don't know how to test this on Win32 or if more work is required for that. Would need other interested people to take a shot. I hope the libtiff developers won't see a problem with adding the requested headers to the installation for now. It could be made to be like a deprecated interface by using #warnings or something similar. Then the problem of breaking applications when an interface to this finally comes wouldn't be so bad as you could say everyone was warned. Doing this simple change now, rather than just waiting for a formalized solution later, would help people improve TIFF support (multi-page, etc.) in PIL and others. Thoughts? --Renier From peter.mowry at amd.com Thu Jun 28 19:58:48 2007 From: peter.mowry at amd.com (Mowry, Peter) Date: Thu, 28 Jun 2007 12:58:48 -0500 Subject: [Image-SIG] PIL-1.1.6.win64-py2.5.exe Message-ID: <475F4CA05E4E1B46A7213674E70EFA6202CB1F8B@SAUSEXMB2.amd.com> PIL-1.1.6.win64-py2.5.exe - does it exist? There seems to only be PIL for windows 32-bit :-( Any response appreciated... Thanks From peter.mowry at amd.com Thu Jun 28 23:18:31 2007 From: peter.mowry at amd.com (Mowry, Peter) Date: Thu, 28 Jun 2007 16:18:31 -0500 Subject: [Image-SIG] PIL win64 (AMD64), or something else? getpixel/putpixel png/etc? Message-ID: <475F4CA05E4E1B46A7213674E70EFA6202CB2166@SAUSEXMB2.amd.com> I want to be able to load a png, getpixel(x, y) on a Linux64 and Win64 (Windows x64, AMD64) systems (in python2.5 for AMD64 windows and linux). I've tried PIL (Python Imaging Library), and it works great for 32-bit...? But there does not seem to be a win64 binary install for PIL, just "PIL-1.1.6.win32-py2.5.exe" (where is the "PIL-1.1.6.win64-py2.5.exe"). Do I have other options to load/save and getpixel/putpixel with a png image?? It doesn't have to be PIL. Or can PIL be compiled for AMD64 somehow? Any help appreciated, Thanks... From thanhn.tran at amd.com Fri Jun 29 03:18:05 2007 From: thanhn.tran at amd.com (Thanh N. Tran) Date: Thu, 28 Jun 2007 18:18:05 -0700 Subject: [Image-SIG] help with PIL version 1.1.6 Message-ID: <46845DCD.1000405@cmdmail.amd.com> Hi: I try to build PIL version 1.1.6 with python version 2.5, gcc version 4.1.1 My build system is RHEL 3, 64-bit My build was ok but when I ran the selftest, I got the following error message. Can you tell me what is wrong? Thanks, -Thanh python2.5 selftest.py ***************************************************************** Failure in example: im = Image.new("1", (128, 128)) # monochrome from line #3 of selftest.testimage Exception raised: Traceback (most recent call last): File "./doctest.py", line 499, in _run_examples_inner exec compile(source, "", "single") in globs File "", line 1, in File "PIL/Image.py", line 1710, in new return Image()._new(core.fill(mode, size, color)) File "PIL/Image.py", line 451, in _new new.mode = im.mode AttributeError: 'ImagingCore' object has no attribute 'mode' Segmentation fault -- Email: thanhn.tran at amd.com Watt: (800) 538-8450 X45467 Phone: (408) 749 5467 Thanh Nhat Tran - MPDCA - AMD From nadavh at visionsense.com Fri Jun 29 11:15:10 2007 From: nadavh at visionsense.com (Nadav Horesh) Date: Fri, 29 Jun 2007 12:15:10 +0300 Subject: [Image-SIG] [Numpy-discussion] Python equivalent of bwboundaries, bwlabel Message-ID: <07C6A61102C94148B8104D42DE95F7E8C8F2B1@exchange2k.envision.co.il> There are several image processing function (including labeling) in numpy.numarray.nd_image package. You can find nd_image documentation in numarray-1.5.pdf (http://downloads.sourceforge.net/numpy/numarray-1.5.pdf?modtime=1133880381&big_mirror=0) Nadav. -----Original Message----- From: numpy-discussion-bounces at scipy.org on behalf of Cameron Walsh Sent: Fri 29-Jun-07 09:47 To: numpy-discussion at scipy.org; image-sig at python.org Cc: Subject: [Numpy-discussion] Python equivalent of bwboundaries, bwlabel Hi all, I'm trying to do object segmentation from image slices, and have found the matlab functions bwlabel and bwboundaries. I haven't been able to find a python equivalent in the pylab, scipy, numpy, or Image modules, nor has google been fruitful. Could somebody point me in the right direction to find equivalent functions if they exist? Cameron. From asbach at ient.rwth-aachen.de Fri Jun 29 12:05:05 2007 From: asbach at ient.rwth-aachen.de (Mark Asbach) Date: Fri, 29 Jun 2007 12:05:05 +0200 Subject: [Image-SIG] [Numpy-discussion] Python equivalent of bwboundaries, bwlabel In-Reply-To: <07C6A61102C94148B8104D42DE95F7E8C8F2B1@exchange2k.envision.co.il> References: <07C6A61102C94148B8104D42DE95F7E8C8F2B1@exchange2k.envision.co.il> Message-ID: <211BB9FF-F8FE-497B-828F-5C8488A8EA19@ient.rwth-aachen.de> Hi Nadav, > There are several image processing function (including labeling) in > numpy.numarray.nd_image package. You can find nd_image > documentation in numarray-1.5.pdf (http://downloads.sourceforge.net/ > numpy/numarray-1.5.pdf?modtime=1133880381&big_mirror=0) >> I'm trying to do object segmentation from image slices, and have >> found the >> matlab functions bwlabel and bwboundaries. I haven't been able to >> find a >> python equivalent in the pylab, scipy, numpy, or Image modules, >> nor has >> google been fruitful. Could somebody point me in the right >> direction to >> find equivalent functions if they exist? Since I'm one of the maintainers, I'd like to point you to OpenCV, the Open Computer Vision Library, that has a python wrapper (including PIL and numpy adaptors). For object segmentation, you might be better off to take a library that features a large set of building blocks for issues like these. http://sf.net/projects/opencvlibrary Yours, Mark -- Mark Asbach Institut f?r Nachrichtentechnik, RWTH Aachen University http://www.ient.rwth-aachen.de/cms/team/m_asbach From nedens at gmail.com Fri Jun 29 15:18:04 2007 From: nedens at gmail.com (Nick Edens) Date: Fri, 29 Jun 2007 09:18:04 -0400 Subject: [Image-SIG] 16 color gifs from 8 bit jpegs Message-ID: <9eda9dee0706290618i1b0da4abtd0890a61ba7f302b@mail.gmail.com> Hello. I have used pil for about 6 years with great success working with both jpegs and tiffs. I currently am working on a project that I need to take a jpeg that is 8bits and convert it to a 16color (not 16bit) gif file. I have trolled around forums, googled it, and read the manual and cannot find a good way to do this. What I am looking for is similar functionality as what is in Photoshops "indexed color" function where I can specify how many colors I want the palate to be and then it will calculate the palate. Any suggestions or help at all would be greatly appreciated. Thank you! -- - Nick From archsheep at yahoo.com.br Sat Jun 23 03:28:54 2007 From: archsheep at yahoo.com.br (Alex Torquato S. Carneiro) Date: Sat, 23 Jun 2007 08:28:54 +0700 (ICT) Subject: [Image-SIG] Transforms the channels Message-ID: <695445.94137.qm@web63402.mail.re1.yahoo.com> Hi Everyone, I'm doing a system for objects tracking and I'm needing a form do convert a RGB in a HSV image. I'm using Python and PIL. Exists a automatic form to do it (without do pixel X transform matrix for all the image)? Thanks, Alex. ____________________________________________________________________________________ Novo Yahoo! Cad?? - Experimente uma nova busca. http://yahoo.com.br/oqueeuganhocomisso -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070623/c187e900/attachment.htm From jabredic at adobe.com Tue Jun 26 17:44:06 2007 From: jabredic at adobe.com (Jason Bredice) Date: Tue, 26 Jun 2007 08:44:06 -0700 Subject: [Image-SIG] Working with odd display formats... Message-ID: <30B7B14B6B558243AA3D7CD7F98D5E7B01821E46@namail2.corp.adobe.com> Hi all, I'm working on a WinXP machine and I have a pixel array that's in 16bit RGB444 format (from a Nokia S60 phone), which I've been trying to use PIL to save it off as a TIFF file. Of course this format is not supported in unpack.c and so far I've tried the following: 1) Using other formats supported by the "raw" decoder (which generates a recognizable image but it's a mess). 2) Using the "bit" decoder with every conceivable combination of parameters with worse results than above. 3) Adding a new function to unpack.c and recompiling the library (had to install mingw32 and so far haven't had much success using PIL at all after making my changes). I've had great success dealing with other more standard 16bit formats, such as RGB555 and RGB565. Does anyone know if there is a good way to handle non-standard display formats with PIL? Perhaps I should be using a different module to approach this problem? Any help is greatly appreciated! Cheers, Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070626/696235b1/attachment.html From renier at morales-rodriguez.net Wed Jun 27 08:38:50 2007 From: renier at morales-rodriguez.net (Renier Morales =?ISO-8859-1?Q?Rodr=EDguez?=) Date: Wed, 27 Jun 2007 02:38:50 -0400 Subject: [Image-SIG] Patch: TIFF Group 3/4 decoder support for PIL 1.1.6 Message-ID: <20070627023850.71ac55b5@sirius.homelinux.net> Hello, Attached is a patch to add TIFF Group 3/4, TIFF CCITT, and TIFF RAW_16 decoding to PIL 1.1.6. The lack of this in PIL is something people have complained/asked about off and on for years (from looking at mailing lists and forums on google). However, this is not a new patch. It is completley based on a patch by Vladimir Pastukhov posted to the image-sig mailing list in the year of 2003 (http://mail.python.org/pipermail/image-sig/2003-July/002354.html). All I have done is adapted it so that it applies to PIL 1.1.6. I tested it against libtiff 3.8.2. One problem with the patch, and I suppose the reason why it never catched on, is that it requires libtiff header files that are not installed as per the current libtiff's installation process. These are tiffiop.h, tif_dir.h, and tif_config.h. Thus, I am also cc'ing the libtiff mailing list here. I solve the problem by adding the needed files to the PIL patch from the libtiff configured source. I assume this is not a problem license-wise as both libraries are under the BSD. Is this correct? I know this is far from ideal. There is a libtiff bug report from the year 2004 (http://bugzilla.remotesensing.org/show_bug.cgi?id=688) explaning the need for tiffiop.h and tif_dir.h to be installed (tiffiop.h didn't use tiff_config.h back then). There is also the explanation of why they are not installed (they contain private structures and functions) along with the intention, but without promises, of creating some separate interface for this kind of access. I'm adding my vote to that request, but couldn't the header files in question just be installed in the meantime? Given that there is no timeline for such special interface and all. The other problem is that, besides needing other eyes to revise the patch, I don't know how to test this on Win32 or if more work is required for that. Would need other interested people to take a shot. I hope the libtiff developers won't see a problem with adding the requested headers to the installation for now. It could be made to be like a deprecated interface by using #warnings or something similar. Then the problem of breaking applications when an interface to this finally comes wouldn't be so bad as you could say everyone was warned. Doing this simple change now, rather than just waiting for a formalized solution later, would help people improve TIFF support (multi-page, etc.) in PIL and others. Thoughts? --Renier -------------- next part -------------- A non-text attachment was scrubbed... Name: pil_tiff_group3_4_ccitt.diff Type: text/x-patch Size: 42634 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20070627/250dd77a/attachment-0001.bin From peter.mowry at amd.com Thu Jun 28 01:23:45 2007 From: peter.mowry at amd.com (Mowry, Peter) Date: Wed, 27 Jun 2007 18:23:45 -0500 Subject: [Image-SIG] PIL for Windows 64-bit - ??? Message-ID: <475F4CA05E4E1B46A7213674E70EFA6202C13F50@SAUSEXMB2.amd.com> It seems that PIL Windows only has binary installs for 32-bit? Why not include one for Windows 64-bit (AMD64)? It seems I may have to compile PIL for windows 64-bit or else I get an error importing imaging.pyd? >>> import _imaging Traceback (most recent call last): File "", line 1, in ImportError: DLL load failed with error code 193 Any help appreciated... Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070627/aa27033f/attachment.html From peter.mowry at amd.com Thu Jun 28 19:53:37 2007 From: peter.mowry at amd.com (Mowry, Peter) Date: Thu, 28 Jun 2007 12:53:37 -0500 Subject: [Image-SIG] PIL Windows AMD64 ? Message-ID: <475F4CA05E4E1B46A7213674E70EFA6202CB1F83@SAUSEXMB2.amd.com> It seems that PIL Windows only has binary installs for 32-bit? Why not include one for Windows 64-bit (AMD64)? It seems I may have to compile PIL for windows 64-bit or else I get an error importing imaging.pyd? >>> import _imaging Traceback (most recent call last): File "", line 1, in ImportError: DLL load failed with error code 193 Any help appreciated... Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070628/2b3e03a7/attachment.htm From cameron.walsh.lists at gmail.com Fri Jun 29 08:47:27 2007 From: cameron.walsh.lists at gmail.com (Cameron Walsh) Date: Fri, 29 Jun 2007 14:47:27 +0800 Subject: [Image-SIG] Python equivalent of bwboundaries, bwlabel Message-ID: <52c649fc0706282347g43871d1cw47f7c62ebc41e299@mail.gmail.com> Hi all, I'm trying to do object segmentation from image slices, and have found the matlab functions bwlabel and bwboundaries. I haven't been able to find a python equivalent in the pylab, scipy, numpy, or Image modules, nor has google been fruitful. Could somebody point me in the right direction to find equivalent functions if they exist? Cameron. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070629/3a7db59d/attachment.html From shzao at montrose.net Sat Jun 30 21:07:17 2007 From: shzao at montrose.net (Cornelius X.Hooper) Date: Sat, 30 Jun 2007 14:07:17 -0500 Subject: [Image-SIG] publication-USDUHVDNWQAFOS.pdf Message-ID: <4686A9E5.7080304@vsnl.com> -------------- next part -------------- A non-text attachment was scrubbed... Name: publication-USDUHVDNWQAFOS.pdf Type: application/pdf Size: 14444 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20070630/92c9e384/attachment.pdf