From mark at kingant.net Wed Jun 1 00:53:23 2011 From: mark at kingant.net (Mark Doliner) Date: Tue, 31 May 2011 15:53:23 -0700 Subject: [Image-SIG] Saving gifs with optimize=True results in bad image Message-ID: Using Python "2.7.1+" on Ubuntu 11.04 I seem to be getting a corrupt image when saving a gif with the flag optimize=True. I'm able to reproduce the problem using the attached image and this code: > import PIL.Image > PIL.Image.open('test.gif').save('optimized.gif', 'GIF', optimize=True) Gimp complains if I try to open optimized.gif. I mostly just want to make sure people are aware of the problem. I found similar reports of this here: http://mail.python.org/pipermail/image-sig/2009-November/006007.html And here: http://groups.google.com/group/djangofilebrowser/browse_thread/thread/2c5df624ea350c24 Someone in the first email thread mentions that gif doesn't officially support optimize for gif files. And that sounds good... but maybe it would be better if PIL ignored the attribute instead of creating this seemingly invalid image? --Mark -------------- next part -------------- A non-text attachment was scrubbed... Name: test.gif Type: image/gif Size: 746 bytes Desc: not available URL: From edward at unicornschool.org Wed Jun 1 01:55:30 2011 From: edward at unicornschool.org (Edward Cannon) Date: Tue, 31 May 2011 16:55:30 -0700 Subject: [Image-SIG] Saving gifs with optimize=True results in bad image In-Reply-To: References: Message-ID: I get the same issue on windows 7 python 2.6.4. Both gimp and Internet Explorer don't like the image. Does seem like some sort of patch is in order, and perhaps a note in the documentation, which does not mention optimize under the GIF specific notes. It does say elsewhere that "If a writer doesn't recognize an option it is silently ignored" which should probably be done in this case. If the GIF writer does support optimize, the documentation should say that explicitly. Edward Cannon Unicorn School On Tue, May 31, 2011 at 3:53 PM, Mark Doliner wrote: > Using Python "2.7.1+" on Ubuntu 11.04 I seem to be getting a corrupt > image when saving a gif with the flag optimize=True. ?I'm able to > reproduce the problem using the attached image and this code: > >> import PIL.Image >> PIL.Image.open('test.gif').save('optimized.gif', 'GIF', optimize=True) > > Gimp complains if I try to open optimized.gif. ?I mostly just want to > make sure people are aware of the problem. ?I found similar reports of > this here: > http://mail.python.org/pipermail/image-sig/2009-November/006007.html > And here: > http://groups.google.com/group/djangofilebrowser/browse_thread/thread/2c5df624ea350c24 > > Someone in the first email thread mentions that gif doesn't officially > support optimize for gif files. ?And that sounds good... but maybe it > would be better if PIL ignored the attribute instead of creating this > seemingly invalid image? > > --Mark > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From ctimmerman2 at gmail.com Mon Jun 6 16:45:11 2011 From: ctimmerman2 at gmail.com (C. Timmerman) Date: Mon, 6 Jun 2011 16:45:11 +0200 Subject: [Image-SIG] Creating a 187x250 thumbnail from this (CMYK) JPG results in a 1.91 MB PNG; 32-bit data written instead of reported 24-bit? Message-ID: Creating a max. 250x250 thumbnail from attached 3.55 MB CMYK JPG using PIL 1.1.7 results in a 1.91 MB PNG. Re-saving the thumbnail with even the lowest (0) compression and ASCII encoding in IrfanView 4.28 produces a much smaller file: 0.14 MB. Paint.NET 3.5.8 can create a 1.91 MB version by setting Bit Depth to 32. Comparing image info with IrfanView, PIL's PNG has blank DPI instead of 96x96, and 24 BitsPerPixel instead of 32. Platform: 32-bit Windows 7 Enterprise SP1, Python 2.7, PIL 1.1.7. Code used: # image_convert.py # by CT. # 2011-05-13 v1.0 import glob, os import Image input_pics = glob.glob(r"resize\*.jpg") if input_pics: print("Resizing pics...") for pic in input_pics: print pic outfile = pic try: im = Image.open(pic) print "ORG: %s" % ["%s: %r" % (k, str(im.info[k])[:20]) for k in im.info.keys()] #continue # info only. im = im.convert("RGB") print "RGB: %s" % ["%s: %r" % (k, str(im.info[k])[:20]) for k in im.info.keys()] im.thumbnail((250, 250), Image.ANTIALIAS) path, ext = os.path.splitext(outfile) #im.save(path + "_thumb.jpg", quality=96, dpi=(96, 96)) im.save(path + "_250px_PIL_1.1.7.png") except IOError, er: print "cannot create thumbnail for", pic print er -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: resize.7z Type: application/octet-stream Size: 4618811 bytes Desc: not available URL: From charlie.clark at clark-consulting.eu Wed Jun 8 19:08:12 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Wed, 08 Jun 2011 19:08:12 +0200 Subject: [Image-SIG] Creating a 187x250 thumbnail from this (CMYK) JPG results in a 1.91 MB PNG; 32-bit data written instead of reported 24-bit? In-Reply-To: References: Message-ID: Hi there, Am 06.06.2011, 16:45 Uhr, schrieb C. Timmerman : > Creating a max. 250x250 thumbnail from attached 3.55 MB CMYK JPG using > PIL > 1.1.7 results in a 1.91 MB PNG. > Re-saving the thumbnail with even the lowest (0) compression and ASCII > encoding in IrfanView 4.28 produces a much smaller file: 0.14 MB. > Paint.NET 3.5.8 can create a 1.91 MB version by setting Bit Depth to 32. > Comparing image info with IrfanView, PIL's PNG has blank DPI instead of > 96x96, and 24 BitsPerPixel instead of 32. Ouch! It is pretty impolite to post e-mails with such large attachments to mailing lists. I think the problem may simply be a misunderstanding for the .thumbnail() method of images. From the docs: """ im.thumbnail(size, filter) Modifies the image to contain a thumbnail version of itself, no larger than the given size. This method calculates an appropriate thumbnail size to preserve the aspect of the image, calls the draft method to configure the file reader (where applicable), and finally resizes the image. The filter argument can be one of NEAREST, BILINEAR, BICUBIC, or ANTIALIAS (best quality). If omitted, it defaults to NEAREST. Note that the bilinear and bicubic filters in the current version of PIL are not well-suited for thumbnail generation. You should use ANTIALIAS unless speed is much more important than quality. Also note that this function modifies the Image object in place. If you need to use the full resolution image as well, apply this method to a copy of the original image. This method returns None. """ I read this to mean that the original image is preserved, and indeed, when I open the PNG in Photoline I see something much close to the CMYK original (no dayglow green). If you want a new image use resize() Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From svvampy at gmail.com Thu Jun 9 15:03:31 2011 From: svvampy at gmail.com (Eric) Date: Thu, 9 Jun 2011 23:03:31 +1000 Subject: [Image-SIG] Creating a 187x250 thumbnail from this (CMYK) JPG results in a 1.91 MB PNG; 32-bit data written instead of reported 24-bit? In-Reply-To: References: Message-ID: Hi C., I've had a look at your files and the size problem you're having with your PIL generated thumbnails is that they have an embedded colour profile. I don't know how to remove embedded colour profiles in PIL, I use GraphicsMagick for some other things and it has a convenient method to remove embedded colour profiles. According to gm, the embedded colour profile is 2,129,216 bytes gm convert +profile "*" When I run that on the thumbnail you've generated and again to ensure gm isn't doing anything else significant: >gm convert "MISSONI CAMELEON MET KAP_39L_250px_PIL_1.1.7.png" +profile "*" thumb_no_profile.png >gm convert "MISSONI CAMELEON MET KAP_39L_250px_PIL_1.1.7.png" thumb_control.png C:\Temp\resize>dir thumb* Volume in drive C has no label. Volume Serial Number is X Directory of C:\Temp\resize 09/06/2011 10:23 PM 1,900,687 thumb_control.png 09/06/2011 10:22 PM 36,305 thumb_no_profile.png 2 File(s) 1,936,992 bytes 0 Dir(s) X bytes free Additionally, if the colour profile is removed from the jpeg source, the subsequent PNGs won't magically recreate it, however the colours are different*. Which makes sense. I just tried using Image.resize on the original image as Charlie suggested, unfortunately the colour profile is embedded in the returned image and the original aspect ratio is lost (this is expected with resize). Perhaps you need to use some other method of copying the pixel data. I'm sure the list subscribers would be interested in your discoveries. Cheers, Eric * according to the channel statistics anyway, probably not different by much, but I'm no expert. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ctimmerman2 at gmail.com Thu Jun 9 16:21:36 2011 From: ctimmerman2 at gmail.com (C. Timmerman) Date: Thu, 9 Jun 2011 16:21:36 +0200 Subject: [Image-SIG] Creating a 187x250 thumbnail from this (CMYK) JPG results in a 1.91 MB PNG; 32-bit data written instead of reported 24-bit? In-Reply-To: References: Message-ID: On Thu, Jun 9, 2011 at 3:03 PM, Eric wrote: > > I don't know how to remove embedded colour profiles in PIL, I use > GraphicsMagick for some other things and > it has a convenient method to remove embedded colour profiles. According to > gm, the embedded colour profile is 2,129,216 bytes > Thank you. PIL doesn't appear to use the embedded color profile (despite the ImageCMS module), so now i just remove it before saving: im.info = {} If marketing has issues with neon-colored thumbnails in the newsletter, i'll use Paint.NET. Regards, Cees -------------- next part -------------- An HTML attachment was scrubbed... URL: From eddie.bishop at gmail.com Thu Jun 9 17:08:16 2011 From: eddie.bishop at gmail.com (Eddie Bishop) Date: Thu, 9 Jun 2011 09:08:16 -0600 Subject: [Image-SIG] png file example that breaks ImageFile In-Reply-To: References: Message-ID: Hello, The PNG file which I have uploaded to http://i.imgur.com/GpJs3.png doesn't work as expected with the example code given for the ImageFile class found at http://www.pythonware.com/library/pil/handbook/imagefile.htm . The docs say that feed() may raise an IOError exception, but a zlib error is raised instead. Note that this image does work fine if the whole file is passed to feed() in one single call. I have python 2.7.1, using PIL 1.1.7. Here is the python shell output: $ python2 Python 2.7.1 (r271:86832, Feb 21 2011, 01:28:26) [GCC 4.5.2 20110127 (prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import ImageFile >>> >>> fp = open('/srv/media/media/albums/60/47/566e-1c9c-41ac-9914-b63724f01693/6047566e-1c9c-41ac-9914-b63724f01693.png', "rb") >>> >>> p = ImageFile.Parser() >>> >>> while 1: ... s = fp.read(1024) ... if not s: ... break ... p.feed(s) ... Traceback (most recent call last): File "", line 5, in File "/usr/lib/python2.7/site-packages/PIL/ImageFile.py", line 402, in feed im = Image.open(fp) File "/usr/lib/python2.7/site-packages/PIL/Image.py", line 1965, in open return factory(fp, filename) File "/usr/lib/python2.7/site-packages/PIL/ImageFile.py", line 91, in __init__ self._open() File "/usr/lib/python2.7/site-packages/PIL/PngImagePlugin.py", line 331, in _open s = self.png.call(cid, pos, len) File "/usr/lib/python2.7/site-packages/PIL/PngImagePlugin.py", line 115, in call return getattr(self, "chunk_" + cid)(pos, len) File "/usr/lib/python2.7/site-packages/PIL/PngImagePlugin.py", line 296, in chunk_zTXt self.im_info[k] = self.im_text[k] = zlib.decompress(v[1:]) zlib.error: Error -5 while decompressing data: incomplete or truncated stream -Eddie Bishop -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffmelvaine at gmail.com Mon Jun 13 18:30:10 2011 From: jeffmelvaine at gmail.com (Jeff Melvaine) Date: Tue, 14 Jun 2011 02:30:10 +1000 Subject: [Image-SIG] PIL 1.1.7 and Python 2.7.1 Message-ID: Is this combination supported? I'm running 64 bit Windows 7 on my ASUS G73JW, and when I try to install PIL, the wizard complains that Python 2.7 is not registered, and the lists of versions and directories to use instead are both blank. When I run the register script from your website, it says that it cannot register, probably (it says) because Python is registered already. From charlie.clark at clark-consulting.eu Tue Jun 14 19:57:52 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Tue, 14 Jun 2011 19:57:52 +0200 Subject: [Image-SIG] PIL 1.1.7 and Python 2.7.1 In-Reply-To: References: Message-ID: Hiya Jeff, Am 13.06.2011, 18:30 Uhr, schrieb Jeff Melvaine : > Is this combination supported? I'm running 64 bit Windows 7 on my ASUS > G73JW, and when I try to install PIL, the wizard complains that Python > 2.7 is not registered, and the lists of versions and directories to > use instead are both blank. When I run the register script from your > website, it says that it cannot register, probably (it says) because > Python is registered already. I suspect that you have a 32/64 bit mismatch. PIL works fine with Python 2.7 on Windows as long as you have the 32-bit of Python. If you really need 64-bit you will have to compile PIL for Windows using Visual Studio. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From seb.haase at gmail.com Tue Jun 14 21:26:14 2011 From: seb.haase at gmail.com (Sebastian Haase) Date: Tue, 14 Jun 2011 21:26:14 +0200 Subject: [Image-SIG] PIL 1.1.7 and Python 2.7.1 In-Reply-To: References: Message-ID: Or get it from http://www.lfd.uci.edu/~gohlke/pythonlibs/ On Tue, Jun 14, 2011 at 7:57 PM, Charlie Clark wrote: > Hiya Jeff, > > Am 13.06.2011, 18:30 Uhr, schrieb Jeff Melvaine : > >> Is this combination supported? I'm running 64 bit Windows 7 on my ASUS >> G73JW, and when I try to install PIL, the wizard complains that Python >> 2.7 is not registered, and the lists of versions and directories to >> use instead are both blank. When I run the register script from your >> website, it says that it cannot register, probably (it says) because >> Python is registered already. > > I suspect that you have a 32/64 bit mismatch. PIL works fine with Python 2.7 > on Windows as long as you have the 32-bit of Python. If you really need > 64-bit you will have to compile PIL for Windows using Visual Studio. > > Charlie > -- > Charlie Clark > Managing Director > Clark Consulting & Research > German Office > Helmholtzstr. 20 > D?sseldorf > D- 40215 > Tel: +49-211-600-3657 > Mobile: +49-178-782-6226 > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From jeffmelvaine at gmail.com Wed Jun 15 02:03:44 2011 From: jeffmelvaine at gmail.com (Jeff Melvaine) Date: Wed, 15 Jun 2011 10:03:44 +1000 Subject: [Image-SIG] Fwd: PIL 1.1.7 and Python 2.7.1 In-Reply-To: References: Message-ID: Is this combination supported? I'm running 64 bit Windows 7 on my ASUS G73JW, and when I try to install PIL, the wizard complains as follows: Python version 2.7 required, whih was not found in the registry. When I OK this message box, I get a blank form: Python 2.7 is required for this package.Select installation to use {Blank list] Python Directory: [Blank text] Installation Directory: [Blank text] When I run the register script from your website, it says that it cannot register, probably (it says) because Python is registered already. The registry editor shows that I have the following entries defined: Python PythonCore Help Main Python Documentation: C:\Python27\Doc\python271.chm InstallPath: C:\Python27\ InstallGroup: Python 2.7 Modules PythonPath: C:\Python27\Lib;\Python27\DLLs;C:\Python27\Lib\lib-tk All these entries have type REG_SZ. I have not played with the registry or deviated from the default installation process. I am toying with the idea of entering C:\Python27\ in the installer's text entry fields for Python directory and installation directory, but I'm wary of misfired installation procedures that might be hard to undo, so I thought I should ask first. TIA Jeff From jeffmelvaine at gmail.com Wed Jun 15 17:49:49 2011 From: jeffmelvaine at gmail.com (Jeff Melvaine) Date: Thu, 16 Jun 2011 01:49:49 +1000 Subject: [Image-SIG] Fwd: PIL 1.1.7 and Python 2.7.1 In-Reply-To: <529868cf-5db9-4eab-8da8-eb145aad7883@email.android.com> References: <529868cf-5db9-4eab-8da8-eb145aad7883@email.android.com> Message-ID: [Slaps forehead after realising that he downloaded a file with Win32 in its name and didn't notice] Indeed, I found http://www.lfd.uci.edu/~gohlke/pythonlibs/ in 5 minutes. Thanks for the wake-up. On Thu, Jun 16, 2011 at 12:59 AM, Chris Mitchell wrote: > It's because the registry is different on 64 bit windows you are running > into this problem. It also probably means that what you are trying to > install is compiled for a 32 bit os. Chris gohlke has a 64 bit binary built. > Google around and you should find his website > > Jeff Melvaine wrote: >> >> Is this combination supported? I'm running 64 bit Windows 7 on my ASUS >> G73JW, and when I try to install PIL, the wizard complains as follows: >> Python version 2.7 required, whih was not found in the registry. When I OK >> this message box, I get a blank form: Python 2.7 is required for this >> package.Select installation to use {Blank list] Python Directory: [Blank >> text] Installation Directory: [Blank text] When I run the register script >> from your website, it says that it cannot register, probably (it says) >> because Python is registered already. The registry editor shows that I have >> the following entries defined: Python PythonCore Help Main Python >> Documentation: C:\Python27\Doc\python271.chm InstallPath: C:\Python27\ >> InstallGroup: Python 2.7 Modules PythonPath: >> C:\Python27\Lib;\Python27\DLLs;C:\Python27\Lib\lib-tk All these entries have >> type REG_SZ. I have not played with the registry or deviated from the >> default installation process. I am toying with the idea of entering >> C:\Python27\ in the installer's text entry fields for Python directory and >> installation directory, but I'm wary of misfired installation procedures >> that might be hard to undo, so I thought I should ask first. TIA Jeff >> ________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig From Chris.Barker at noaa.gov Thu Jun 16 20:06:59 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 16 Jun 2011 11:06:59 -0700 Subject: [Image-SIG] What does the 'F' mode mean in PIL? Message-ID: <4DFA4643.8010500@noaa.gov> Hi folks, I've been looking through the docs on File Decoders (or, in my case for decoding binary data with fromstring() or frombuffer()): http://www.pythonware.com/library/pil/handbook/decoder.htm With the raw decoder, most of the modes are clear to me, but the 'F' mode has me confused: What is it really storing, working with? - one floating point value per pixel? - one floating point value per colorband? - but then, how are they arranged? - Is it single precision (32 bit) floats only? What does it mean if you use one of the modified 'F' modes, like "F;16N"? I know what an 16 bit native unsigned integer is, but I don't understand: - What happens if I do fromstring() with a mode f "F;16N" ? - is the data converted to a float (32bit)? - if so, do you just lose information if you have higher precision types being passed in? - is the raw data stored in 16 bit (two byte) chunks? - How is 'F' mode interpreted if you convert to, say 'RGB' mode? -grayscale? - something else? Any enlightenment would be great. -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 Chris.Barker at noaa.gov Fri Jun 17 21:30:08 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 17 Jun 2011 12:30:08 -0700 Subject: [Image-SIG] What does the 'F' mode mean in PIL? In-Reply-To: <4DFA4643.8010500@noaa.gov> References: <4DFA4643.8010500@noaa.gov> Message-ID: <4DFBAB40.8020801@noaa.gov> A followup, trying to do something real It seems that the raw decoder doesn't understand all the modes listed in: http://www.pythonware.com/library/pil/handbook/decoder.htm indeed, hardly any of them ('F' only for the "floating point modes") Enclosed is some sample code I've got that attempts to convert a unsigned 16 bit grayscale image to RGB. I can't get it to do anything, as I get: ValueError: unknown raw mode for any floating point mode other than 'F' What am I missing here? -Chirs Christopher Barker wrote: > Hi folks, > > I've been looking through the docs on File Decoders (or, in my case for > decoding binary data with fromstring() or frombuffer()): > > http://www.pythonware.com/library/pil/handbook/decoder.htm > > With the raw decoder, most of the modes are clear to me, but the 'F' > mode has me confused: > > What is it really storing, working with? > - one floating point value per pixel? > - one floating point value per colorband? > - but then, how are they arranged? > - Is it single precision (32 bit) floats only? > > > What does it mean if you use one of the modified 'F' modes, like > "F;16N"? I know what an 16 bit native unsigned integer is, but I don't > understand: > > - What happens if I do fromstring() with a mode f "F;16N" ? > - is the data converted to a float (32bit)? > - if so, do you just lose information if you have higher precision > types being passed in? > - is the raw data stored in 16 bit (two byte) chunks? > > > - How is 'F' mode interpreted if you convert to, say 'RGB' mode? > -grayscale? > - something else? > > > Any enlightenment would be great. > > -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 -------------- next part -------------- A non-text attachment was scrubbed... Name: PIL_u16.py Type: application/x-python Size: 812 bytes Desc: not available URL: From chris.mit7 at gmail.com Wed Jun 15 16:59:48 2011 From: chris.mit7 at gmail.com (Chris Mitchell) Date: Wed, 15 Jun 2011 10:59:48 -0400 Subject: [Image-SIG] Fwd: PIL 1.1.7 and Python 2.7.1 In-Reply-To: References: Message-ID: <529868cf-5db9-4eab-8da8-eb145aad7883@email.android.com> It's because the registry is different on 64 bit windows you are running into this problem. It also probably means that what you are trying to install is compiled for a 32 bit os. Chris gohlke has a 64 bit binary built. Google around and you should find his website Jeff Melvaine wrote: Is this combination supported? I'm running 64 bit Windows 7 on my ASUS G73JW, and when I try to install PIL, the wizard complains as follows: Python version 2.7 required, whih was not found in the registry. When I OK this message box, I get a blank form: Python 2.7 is required for this package.Select installation to use {Blank list] Python Directory: [Blank text] Installation Directory: [Blank text] When I run the register script from your website, it says that it cannot register, probably (it says) because Python is registered already. The registry editor shows that I have the following entries defined: Python PythonCore Help Main Python Documentation: C:\Python27\Doc\python271.chm InstallPath: C:\Python27\ InstallGroup: Python 2.7 Modules PythonPath: C:\Python27\Lib;\Python27\DLLs;C:\Python27\Lib\lib-tk All these entries have type REG_SZ. I have not played with the registry or deviated from the default installation process. I am toying with the idea of entering C:\Python27\ in the installer's text entry fields for Python directory and installation directory, but I'm wary of misfired installation procedures that might be hard to undo, so I thought I should ask first. TIA Jeff_____________________________________________ Image-SIG maillist - Image-SIG at python.org http://mail.python.org/mailman/listinfo/image-sig -------------- next part -------------- An HTML attachment was scrubbed... URL: From bbbai at conncoll.edu Sat Jun 18 03:47:04 2011 From: bbbai at conncoll.edu (Bridget Baird) Date: Fri, 17 Jun 2011 21:47:04 -0400 Subject: [Image-SIG] Python 3.0 support? Message-ID: Anyone know when PIL will be released for Python 3.0? -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Tue Jun 21 20:05:51 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Tue, 21 Jun 2011 11:05:51 -0700 Subject: [Image-SIG] What does the 'F' mode mean in PIL? In-Reply-To: References: Message-ID: <4E00DD7F.6000608@noaa.gov> Managan, Rob wrote: > If you are not worried about rounding errors; this command grabs the data, > and puts it back scaled by 255/65535 and no offset. > > i.putdata(i.getdata(),255.0/np.iinfo(np.uint16).max,0.0) yup -- easy with numpy (I actually already did that), but I'm trying to figure out how to do it with PIL. Maybe there is no reason to, but is sure seems like it should be something PIL could easily do: Convert a unsigned int16 grayscale image to 24bit RGB. Thanks, -Chris By the way, your replies are not making it to the list -- you need to hit "reply all" or "reply to list". > > On 6/20/11 1:17 PM, "Chris Barker" wrote: > >> On 6/17/2011 8:58 PM, Managan, Rob wrote: >>> While I am not an expert, it seems you have to use mode = 'F' in from string. >>> Presumably then you can convert it to RGB? >>> All the floating point decoders (libImaging/Unpack.c) have mode 'F' so it >>> does not find a mode 'RGB' with the rawmode 'F;16' >>> >>> Hope this helps. >>> >> indeed it did -- I thought I'd triked that, but I guess I got confused >> about "mode" vs, "raw mode". So now I'm using mode: 'F', and raw mode >> 'F;16N'. >> >> It works without an error, but I'm still lost on how I can then convert >> the 'F' image to an RGB image. convert('RGB') seems to convert to grey >> (which I want), but doesn't scale t all -- so a value of 255 in the >> original uint16 data is white. How can I tell it to re-scalse? >> >> see attached code (requires numpy) >> >> -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 cannon.el at gmail.com Wed Jun 22 04:29:11 2011 From: cannon.el at gmail.com (Edward Cannon) Date: Tue, 21 Jun 2011 19:29:11 -0700 Subject: [Image-SIG] What does the 'F' mode mean in PIL? In-Reply-To: <4E00DD7F.6000608@noaa.gov> References: <4E00DD7F.6000608@noaa.gov> Message-ID: <64DCA7E6-62D5-4003-B48B-1532D5262554@gmail.com> To rescale you could try using the point method on your image object. On Jun 21, 2011, at 11:05 AM, Christopher Barker wrote: > Managan, Rob wrote: >> If you are not worried about rounding errors; this command grabs the data, >> and puts it back scaled by 255/65535 and no offset. >> i.putdata(i.getdata(),255.0/np.iinfo(np.uint16).max,0.0) > > yup -- easy with numpy (I actually already did that), but I'm trying to figure out how to do it with PIL. Maybe there is no reason to, but is sure seems like it should be something PIL could easily do: > > Convert a unsigned int16 grayscale image to 24bit RGB. > > Thanks, > > -Chris > > By the way, your replies are not making it to the list -- you need to hit "reply all" or "reply to list". > > > >> On 6/20/11 1:17 PM, "Chris Barker" wrote: >>> On 6/17/2011 8:58 PM, Managan, Rob wrote: >>>> While I am not an expert, it seems you have to use mode = 'F' in from string. >>>> Presumably then you can convert it to RGB? >>>> All the floating point decoders (libImaging/Unpack.c) have mode 'F' so it >>>> does not find a mode 'RGB' with the rawmode 'F;16' >>>> >>>> Hope this helps. >>>> >>> indeed it did -- I thought I'd triked that, but I guess I got confused >>> about "mode" vs, "raw mode". So now I'm using mode: 'F', and raw mode >>> 'F;16N'. >>> >>> It works without an error, but I'm still lost on how I can then convert >>> the 'F' image to an RGB image. convert('RGB') seems to convert to grey >>> (which I want), but doesn't scale t all -- so a value of 255 in the >>> original uint16 data is white. How can I tell it to re-scalse? >>> >>> see attached code (requires numpy) >>> >>> -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 > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From jeanpierrehill at gmail.com Fri Jun 24 10:47:08 2011 From: jeanpierrehill at gmail.com (Jean-Pierre Andre' Hill) Date: Fri, 24 Jun 2011 04:47:08 -0400 Subject: [Image-SIG] Can't get selftest.py to pass Message-ID: Hi, When I run "$ python setup.py build_ext -i" I get: """ running build_ext --- using frameworks at /System/Library/Frameworks -------------------------------------------------------------------- PIL 1.1.7 SETUP SUMMARY -------------------------------------------------------------------- version 1.1.7 platform darwin 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] -------------------------------------------------------------------- --- TKINTER support available --- JPEG support available --- ZLIB (PNG/ZIP) support available *** FREETYPE2 support not available *** LITTLECMS 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. """ Then I run "python selftest.py" and get: """ -------------------------------------------------------------------- PIL 1.1.7 TEST SUMMARY -------------------------------------------------------------------- Python modules loaded from ./PIL Binary modules loaded from ./PIL -------------------------------------------------------------------- --- PIL CORE support ok --- TKINTER support ok *** JPEG support not installed --- ZLIB (PNG/ZIP) support ok *** FREETYPE2 support not installed *** LITTLECMS support not installed -------------------------------------------------------------------- Running selftest: ***************************************************************** Failure in example: try: _info(Image.open(os.path.join(ROOT, "Images/lena.jpg"))) except IOError, v: print v from line #24 of selftest.testimage Expected: ('JPEG', 'RGB', (128, 128)) Got: decoder jpeg not available 1 items had failures: 1 of 57 in selftest.testimage ***Test Failed*** 1 failures. *** 1 tests of 57 failed. """ I get the EXACT same error for both "JPEG_ROOT = None" and 'JPEG_ROOT = "sw/lib", "sw/lib/" ' which should point to the directory where fink installed libjpeg. I've searched the web and tried multiple recommendations to no avail. I can't find anything explaining why the build would work and the test would fail. I'm running OS X 10.6.7. Any help would be greatly appreciated, thanks! JP From fangebault at etai.fr Fri Jun 24 11:12:30 2011 From: fangebault at etai.fr (Florent Angebault) Date: Fri, 24 Jun 2011 11:12:30 +0200 Subject: [Image-SIG] [PIL] Bug with split() Message-ID: <4E0454FE.8050002@etai.fr> Hello. There is a long-standing bug in the latest version of PIL and it seems to be easy to patch: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561965 Is there any chance that it will be fixed some day? Is the PIL project still alive? -- Florent Angebault D?veloppeur d'applications - service multim?dia Ligne interne : 90 18 ----------------------------------------------- E-T-A-I Antony Parc 2 10, place du G?n?ral de Gaulle 92 160 Antony Accueil : 01 77 92 92 92 From charlie.clark at clark-consulting.eu Fri Jun 24 12:58:51 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Fri, 24 Jun 2011 12:58:51 +0200 Subject: [Image-SIG] Can't get selftest.py to pass In-Reply-To: References: Message-ID: Am 24.06.2011, 10:47 Uhr, schrieb Jean-Pierre Andre' Hill : > I've searched the web and tried multiple recommendations to no avail. I > can't find anything explaining why the build would work and the test > would fail. I'm running OS X 10.6.7. Hi Jean-Pierre, I don't think that PIL compiles out of the box on Mac OS which is why I always recommend using either MacPorts (isn't there also a package for Fink?) or pip install Pillow. Probably worth checking the portsfile to see what things need tweaking. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From edward at unicornschool.org Fri Jun 24 18:29:10 2011 From: edward at unicornschool.org (Edward Cannon) Date: Fri, 24 Jun 2011 09:29:10 -0700 Subject: [Image-SIG] [PIL] Bug with split() In-Reply-To: <4E0454FE.8050002@etai.fr> References: <4E0454FE.8050002@etai.fr> Message-ID: I have investigated this bug on my system, Win7 64bit, Python 2.6.4 with PIL 1.1.6 and get the following results: 1) The .im attribute is None, but it is not defined in the public interface, so that is not a bug. (try help(Image) or looking at http://www.pythonware.com/library/pil/handbook/image.htm, it is not listed either place). 2) The .split method works just fine for me, returning no error. If I save out the images it returns they look like what I would expect, one is the grayscale image and the other is a mask. I don't have access to a Debian system but my guess is that the issue is solved in 1.1.6, if it is not, then the error is platform specific. I don't know what version of PIL Debian currently uses, you may need to install a newer version manually. And yes, the PIL project is still alive. Edward Cannon Unicorn School On Fri, Jun 24, 2011 at 2:12 AM, Florent Angebault wrote: > Hello. > > There is a long-standing bug in the latest version of PIL and it seems to > be easy to patch: > http://bugs.debian.org/cgi-**bin/bugreport.cgi?bug=561965 > > Is there any chance that it will be fixed some day? > Is the PIL project still alive? > > -- > Florent Angebault > D?veloppeur d'applications - service multim?dia > Ligne interne : 90 18 > ------------------------------**----------------- > E-T-A-I > Antony Parc 2 > 10, place du G?n?ral de Gaulle > 92 160 Antony > Accueil : 01 77 92 92 92 > > ______________________________**_________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/**mailman/listinfo/image-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From noreply at liacs.nl Sat Jun 25 08:20:51 2011 From: noreply at liacs.nl (ACM ICMR Committee) Date: Sat, 25 Jun 2011 08:20:51 +0200 Subject: [Image-SIG] Call for Organizers: ACM ICMR2013 Message-ID: <168b9cdd2f606e75ff66aca64aa497ce@press.liacs.nl> ACM ICMR 2013 - Call for Organizers The ACM ICMR Steering Committee invites interested parties to submit proposals to host and organize the the 3rd ACM International Conference on Multimedia Retrieval, ICMR2013 ACM ICMR is the premier scientific conference for multimedia retrieval worldwide. Its mission is to illuminate the state of the art in multimedia retrieval by bringing together researchers and practitioners in the field of multimedia retrieval. Submission Deadline: Friday, 23 September 2011 Email proposals or questions with subject line: ICMR2013 to Michael Lew ACM ICMR Steering Committee Chair Leiden University mlew at liacs.nl Details are available at http://press.liacs.nl/icmr/icmr2013.cfo.final.pdf and http://www.acmICMR.org Only one proposal from the submissions can be selected per year by the steering committee. All decisions are made by majority vote by the steering committee. ACM ICMR2011 was organized by Alberto del Bimbo and Francesco G.B. De Natale ACM ICMR2012 is organized by Horace Ip and Yong Rui see http://www.icmr2012.org/ ----------------------------- Remove from Email List: http://press.liacs.nl/email/removeemail.php?id=-vLiaMK9MQqF6r9Tr51NM9wloOZTDAqriC_WLVacyHw, From fd97207 at yahoo.com Sun Jun 26 05:43:54 2011 From: fd97207 at yahoo.com (Siddharth Jain) Date: Sat, 25 Jun 2011 20:43:54 -0700 (PDT) Subject: [Image-SIG] unable to install PIL on Win7 64-bit Message-ID: <395336.46499.qm@web126110.mail.ne1.yahoo.com> please help. i have a machine with a fresh installation of windows7 64 bit. i have installed python 2.5. i downloaded this file:http://effbot.org/downloads/PIL-1.1.7.win32-py2.5.exe but when i run it i get following message:---------------------------PIL-1.1.7.win32-py2.5.exe - System Error---------------------------The program can't start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this problem.?---------------------------OK ??---------------------------i suspect this is because i have a 64 bit installation of windows7. how can i install PIL on my win7 machine? -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabio.elisio at gmail.com Tue Jun 28 14:55:32 2011 From: fabio.elisio at gmail.com (=?ISO-8859-1?B?RuFiaW8gRWztc2lv?=) Date: Tue, 28 Jun 2011 09:55:32 -0300 Subject: [Image-SIG] Problem Pil in Apache .... Message-ID: Hi, I created webpage uses Django, Apache, Python2.7, PIL 1.1.7, running on Windows Server 2003. When I try to use PIL show-me this "The _imaging C module is not installed", please help-me..... Thanks.... -- dev_web = { nome : F?bio Elisio, profissao : Web Developer, site : http://www.fabioelisio.com, twitter : @felisio } -------------- next part -------------- An HTML attachment was scrubbed... URL: From edward at unicornschool.org Wed Jun 29 07:24:23 2011 From: edward at unicornschool.org (Edward Cannon) Date: Tue, 28 Jun 2011 22:24:23 -0700 Subject: [Image-SIG] unable to install PIL on Win7 64-bit In-Reply-To: <395336.46499.qm@web126110.mail.ne1.yahoo.com> References: <395336.46499.qm@web126110.mail.ne1.yahoo.com> Message-ID: you got the 32 bit version, you probably need the 64 bit build, or perhaps you need the appropriate dll, try getting it from Microsoft. Edward Cannon Unicorn School PS search the mailing list archives for 64 bit builds On Sat, Jun 25, 2011 at 8:43 PM, Siddharth Jain wrote: > > please help. i have a machine with a fresh installation of windows7 64 bit. i have installed python 2.5. i downloaded this file:http://effbot.org/downloads/PIL-1.1.7.win32-py2.5.exe but when i run it i get following message: > --------------------------- > PIL-1.1.7.win32-py2.5.exe - System Error > --------------------------- > The program can't start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this problem. > --------------------------- > OK > --------------------------- > i suspect this is because i have a 64 bit installation of windows7. how can i install PIL on my win7 machine? > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From edward at unicornschool.org Wed Jun 29 07:26:40 2011 From: edward at unicornschool.org (Edward Cannon) Date: Tue, 28 Jun 2011 22:26:40 -0700 Subject: [Image-SIG] Problem Pil in Apache .... In-Reply-To: References: Message-ID: your problem is probably permissions, Apache likes to run things with as little permission as possible (good idea) but then sometimes you can't access certain needed files. Check that you installed python and PIL for "everyone" and not just "me", also try reinstalling PIL, sometimes you can get a corrupted install. Edward Cannon Unicorn School On Tue, Jun 28, 2011 at 5:55 AM, F?bio El?sio wrote: > Hi, > I created webpage uses Django, Apache, Python2.7, PIL 1.1.7, running on > Windows Server 2003. > When I try to use PIL show-me this "The _imaging C module is not installed", > please help-me..... > Thanks.... > -- > dev_web = { > ? ? nome : F?bio Elisio, > ? ? profissao : Web Developer, > ? ? site : http://www.fabioelisio.com, > ? ? twitter : @felisio > } > > > > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From fredrik at pythonware.com Wed Jun 29 13:45:33 2011 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 29 Jun 2011 13:45:33 +0200 Subject: [Image-SIG] webp support? In-Reply-To: References: Message-ID: I just added WebP support to the development tree; see: http://offline.effbot.org/europython for code snippets and links. 2010/11/24 Josh Bleecher Snyder : > Hi, > > I was wondering whether webp support (encoding, decoding) was on the > PIL roadmap. > > I was going to hack together a cPython extension for myself, but if it > might be coming soon I'll hold off; alternatively, I could also try to > put together a contribution to PIL. (Caveats on that: it'd probably > have to be cPython only for now and I'd be new to PIL development so > I'd most likely need a few pointers.) > > Thanks, > Josh > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From charlie.clark at clark-consulting.eu Wed Jun 29 20:11:08 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Wed, 29 Jun 2011 20:11:08 +0200 Subject: [Image-SIG] webp support? In-Reply-To: References: Message-ID: Am 29.06.2011, 13:45 Uhr, schrieb Fredrik Lundh : > I just added WebP support to the development tree; see: > http://offline.effbot.org/europython > for code snippets and links. Thanks very much for this effbot! webp is a great image format. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From Chris.Barker at noaa.gov Thu Jun 30 02:27:36 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 29 Jun 2011 17:27:36 -0700 Subject: [Image-SIG] unable to install PIL on Win7 64-bit In-Reply-To: References: <395336.46499.qm@web126110.mail.ne1.yahoo.com> Message-ID: <4E0BC2F8.2010003@noaa.gov> Edward Cannon wrote: > you got the 32 bit version, you probably need the 64 bit build, That is certainly it. If there isn't one on the PIL website, try here: http://www.lfd.uci.edu/~gohlke/pythonlibs/ Great source of Windows Python package binaries. -Chris or > perhaps you need the appropriate dll, try getting it from Microsoft. > Edward Cannon > Unicorn School > PS search the mailing list archives for 64 bit builds > On Sat, Jun 25, 2011 at 8:43 PM, Siddharth Jain wrote: >> please help. i have a machine with a fresh installation of windows7 64 bit. i have installed python 2.5. i downloaded this file:http://effbot.org/downloads/PIL-1.1.7.win32-py2.5.exe but when i run it i get following message: >> --------------------------- >> PIL-1.1.7.win32-py2.5.exe - System Error >> --------------------------- >> The program can't start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this problem. >> --------------------------- >> OK >> --------------------------- >> i suspect this is because i have a 64 bit installation of windows7. how can i install PIL on my win7 machine? >> _______________________________________________ >> 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 -- 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 jeanclaudearbaut at orange.fr Thu Jun 30 18:23:35 2011 From: jeanclaudearbaut at orange.fr (Jean-Claude Arbaut) Date: Thu, 30 Jun 2011 18:23:35 +0200 Subject: [Image-SIG] python with PIL : problem showing images in Win 7 Message-ID: <4E0CA307.20507@orange.fr> I just installed Python 2.7.2 and PIL 1.1.7. In pil-handbook.pdf there is a trivial example (slightly modified here to change image name): import Image im = Image.open("fruit.ppm") im.show() Everything runs well, except I get an error from Windows image viewer, saying the file has been deleted. The problem seems to come from line 99 in ImageShow.py, return "start /wait %s && del /f %s" % (file, file) Looks like the del doesn't wait for start to finish, hence the file doesn't exist when the viewer is launched. If I try instead : return "start /wait %s" % file Then the image is shown as expected. So there is a workaround, but the file is not destroyed afterwards. Is there a cleaner way to solve the problem, e.g. forcing a wait before del ? From cgohlke at uci.edu Thu Jun 30 18:50:09 2011 From: cgohlke at uci.edu (Christoph Gohlke) Date: Thu, 30 Jun 2011 09:50:09 -0700 Subject: [Image-SIG] python with PIL : problem showing images in Win 7 In-Reply-To: <4E0CA307.20507@orange.fr> References: <4E0CA307.20507@orange.fr> Message-ID: <4E0CA941.8000801@uci.edu> On 6/30/2011 9:23 AM, Jean-Claude Arbaut wrote: > I just installed Python 2.7.2 and PIL 1.1.7. In pil-handbook.pdf there > is a trivial example (slightly modified here to change image name): > > import Image > im = Image.open("fruit.ppm") > im.show() > > Everything runs well, except I get an error from Windows image viewer, > saying the file has been deleted. > The problem seems to come from line 99 in ImageShow.py, > return "start /wait %s && del /f %s" % (file, file) > Looks like the del doesn't wait for start to finish, hence the file > doesn't exist when the viewer > is launched. If I try instead : > return "start /wait %s" % file > Then the image is shown as expected. So there is a workaround, but the > file is not > destroyed afterwards. > > Is there a cleaner way to solve the problem, e.g. forcing a wait before > del ? > This is a known issue. A possible solution is to sleep about a second before deleting the file, e.g.: return "start /wait %s && sleep 1 && del /f %s" % (file, file) Christoph From fd97207 at yahoo.com Wed Jun 29 20:19:29 2011 From: fd97207 at yahoo.com (Siddharth Jain) Date: Wed, 29 Jun 2011 11:19:29 -0700 (PDT) Subject: [Image-SIG] unable to install PIL on Win7 64-bit In-Reply-To: Message-ID: <1309371569.31881.YahooMailClassic@web126104.mail.ne1.yahoo.com> i installed the 64 bit version from a link to uci.edu/~gohkle something like that. that version should be listed on official website. --- On Tue, 6/28/11, Edward Cannon wrote: From: Edward Cannon Subject: Re: [Image-SIG] unable to install PIL on Win7 64-bit To: "Siddharth Jain" Cc: image-sig at python.org Date: Tuesday, June 28, 2011, 10:24 PM you got the 32 bit version, you probably need the 64 bit build, or perhaps you need the appropriate dll, try getting it from Microsoft. Edward Cannon Unicorn School PS search the mailing list archives for 64 bit builds On Sat, Jun 25, 2011 at 8:43 PM, Siddharth Jain wrote: > > please help. i have a machine with a fresh installation of windows7 64 bit. i have installed python 2.5. i downloaded this file:http://effbot.org/downloads/PIL-1.1.7.win32-py2.5.exe but when i run it i get following message: > --------------------------- > PIL-1.1.7.win32-py2.5.exe - System Error > --------------------------- > The program can't start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this problem. > --------------------------- > OK > --------------------------- > i suspect this is because i have a 64 bit installation of windows7. how can i install PIL on my win7 machine? > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: