From seb.haase at gmail.com Mon Nov 5 13:52:55 2007 From: seb.haase at gmail.com (Sebastian Haase) Date: Mon, 5 Nov 2007 13:52:55 +0100 Subject: [Image-SIG] how to verify image file format - difficult ! Message-ID: Hi, So far I was just using Image.open(filename) to determine if a file was an image file or not. I thought a simple "except IOError" would catch non-image files. Now, I suddently got a SystemError (message: "tile cannot extend outside image") instead. A google-search brought up the "ImageValidator" function from the "django" project: http://code.djangoproject.com/changeset/6175 ==> apparently an older version of django also checked the "OverflowError" exception in addition. (comment: # OverflowError is due to a bug in PIL with Python 2.4+ which can cause # it to gag on OLE files. ) and the currently django file contains this code-snipplet in django/trunk/django/core/validators.py: 184 # load() is the only method that can spot a truncated JPEG, 185 # but it cannot be called sanely after verify() 186 trial_image = Image.open(StringIO(content)) 187 trial_image.load() 188 # verify() is the only method that can spot a corrupt PNG, 189 # but it must be called immediately after the constructor 190 trial_image = Image.open(StringIO(content)) 191 trial_image.verify() Are these obscure constrains ("load() cannot be called sanely after verify()" ) still needed ? And is it really suggested to "load" the entire image first, just to tell if it's valid ? Thanks, Sebastian Haase From mail at razor.dk Wed Nov 7 10:57:56 2007 From: mail at razor.dk (Christian Joergensen) Date: Wed, 07 Nov 2007 10:57:56 +0100 Subject: [Image-SIG] Problem with parsing PNG image Message-ID: <47318C24.2090009@razor.dk> Hello I'm having trouble parsing a PNG image. This snippet should show my problem: from PIL import ImageFile import StringIO import urllib2 f = urllib2.urlopen(urllib2.Request(url='http://www.bold.dk/billeder/art8651.png')) p = ImageFile.Parser() p.feed(f.read()) im = p.close() output = StringIO.StringIO() im.save(output, format="image/png") I keep getting: File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 298, in read data = self.data[pos:pos+bytes] TypeError: unsubscriptable object Am I doing something wrong? -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info From export at hope.cz Wed Nov 7 14:57:53 2007 From: export at hope.cz (export at hope.cz) Date: Wed, 07 Nov 2007 14:57:53 +0100 Subject: [Image-SIG] What colour model does the image use In-Reply-To: <47318C24.2090009@razor.dk> Message-ID: <4731D271.3712.69E2AE8@export.hope.cz> I use im.getpixel((x,y)) to find out the colour of a pixel. But how can I find out in which color model the the return value is? For example for png picture format im.getpixel((20,50)) gives the result 60. What does the value mean? Is it possible to find out the RGB model values? Thank you for help. L. From nadavh at visionsense.com Wed Nov 7 21:16:26 2007 From: nadavh at visionsense.com (Nadav Horesh) Date: Wed, 7 Nov 2007 22:16:26 +0200 Subject: [Image-SIG] What colour model does the image use Message-ID: <710F2847B0018641891D9A21602763600B6E27@ex3.envision.co.il> Try the following image methods: im.getbands() # Probably this is what you want im.info() Nadav. -----Original Message----- From: image-sig-bounces at python.org on behalf of export at hope.cz Sent: Wed 07-Nov-07 15:57 To: Image-SIG at python.org Subject: [Image-SIG] What colour model does the image use I use im.getpixel((x,y)) to find out the colour of a pixel. But how can I find out in which color model the the return value is? For example for png picture format im.getpixel((20,50)) gives the result 60. What does the value mean? Is it possible to find out the RGB model values? Thank you for help. L. _______________________________________________ Image-SIG maillist - Image-SIG at python.org http://mail.python.org/mailman/listinfo/image-sig From export at hope.cz Wed Nov 7 16:21:26 2007 From: export at hope.cz (export at hope.cz) Date: Wed, 07 Nov 2007 16:21:26 +0100 Subject: [Image-SIG] How to apply a threshold value to the image Message-ID: <4731E606.8503.6EAA97D@export.hope.cz> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071107/68ba5d80/attachment.htm From fredrik at pythonware.com Thu Nov 8 22:06:16 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 08 Nov 2007 22:06:16 +0100 Subject: [Image-SIG] Problem with parsing PNG image In-Reply-To: <47318C24.2090009@razor.dk> References: <47318C24.2090009@razor.dk> Message-ID: Christian Joergensen wrote: > I'm having trouble parsing a PNG image. This snippet should show my problem: > > from PIL import ImageFile > import StringIO > import urllib2 > f = > urllib2.urlopen(urllib2.Request(url='http://www.bold.dk/billeder/art8651.png')) > p = ImageFile.Parser() > p.feed(f.read()) > im = p.close() > output = StringIO.StringIO() > im.save(output, format="image/png") > > I keep getting: > > File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 298, > in read > data = self.data[pos:pos+bytes] > TypeError: unsubscriptable object > > Am I doing something wrong? well, the code looks right (except for the format string syntax; use "PNG", not a mime type), and I'm getting the same error, so it's more likely to be a bug. a 5-minute inspection didn't reveal any obvious work around, so I'm afraid you probably have to replace the parsing with: f = urllib2.urlopen(...) im = Image.open(StringIO.StringIO(f.read())) From fredrik at pythonware.com Thu Nov 8 22:11:18 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 08 Nov 2007 22:11:18 +0100 Subject: [Image-SIG] What colour model does the image use In-Reply-To: <4731D271.3712.69E2AE8@export.hope.cz> References: <47318C24.2090009@razor.dk> <4731D271.3712.69E2AE8@export.hope.cz> Message-ID: export at hope.cz wrote: > I use im.getpixel((x,y)) to find out the colour of a pixel. > But how can I find out in which color model the the return value is? > > For example for png picture format > > im.getpixel((20,50)) gives the result 60. > > What does the value mean? the im.mode attribute tells you what color model the image is using (see the documentation for details). > Is it possible to find out the RGB model values? assuming the mode is "P" (for 8-bit palette images), you can either convert the entire image to RGB and then pick out the values for the pixels you need image = im.convert("RGB") rgb = image.getpixel((x, y)) or crop out just the pixel you want and convert that one: rgb = im.crop((x, y, x+1, y+1)).convert("RGB").getpixel((0, 0)) or use the pixel value as an index into the palette array: p = im.getpalette() v = im.getpixel((x, y)) rgb = p[v*3:v*3+3] From fredrik at pythonware.com Thu Nov 8 22:18:52 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 08 Nov 2007 22:18:52 +0100 Subject: [Image-SIG] how to verify image file format - difficult ! In-Reply-To: References: Message-ID: Sebastian Haase wrote: > Are these obscure constrains ("load() cannot be called sanely after > verify()" ) still needed ? open() sets things up for lazy loading; the actual loading/decoding is done when needed, or explicitly by load(). verify() just checks the file's internal checksums etc, where available; it doesn't guarantee anything, and a format drive is free to mess up the lazy loading state during verification (which is why it has to be used in a specific way). there's hardly ever any reason to do both verify() and load() on a file; if the file cannot be loaded, load() will catch it. > And is it really suggested to "load" the entire image first, just to > tell if it's valid ? to tell if a file really is possible to load into an image memory, you need to load it. From fredrik at pythonware.com Thu Nov 8 22:21:52 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 08 Nov 2007 22:21:52 +0100 Subject: [Image-SIG] How to apply a threshold value to the image In-Reply-To: <4731E606.8503.6EAA97D@export.hope.cz> References: <4731E606.8503.6EAA97D@export.hope.cz> Message-ID: export at hope.cz wrote: > I would need to apply a threshold value to the image, where everything > above a certain brightness level becomes white, and everything below the > level becomes black. > How can I do that with PIL? create a 256-item mapping table and pass it to the "point" method. From fredrik at pythonware.com Thu Nov 8 22:31:02 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 08 Nov 2007 22:31:02 +0100 Subject: [Image-SIG] _imagingft for OSX In-Reply-To: <1B54E573-9C0F-40D2-A8A2-5323CCE84A4F@pacbell.net> References: <1B54E573-9C0F-40D2-A8A2-5323CCE84A4F@pacbell.net> Message-ID: Scott Frankel wrote: > Finally got PIL to build and install without error. > > Stuck now on using the ImageFont module. Where do I get _imagingft? > How is it built and installed? if the setup.py script is able to find the freetype2 library, it's built by default. the following excerpt from setup.py might be somewhat helpful: elif sys.platform == "darwin": # attempt to make sure we pick freetype2 over other versions add_directory(include_dirs, "/sw/include/freetype2") add_directory(include_dirs, "/sw/lib/freetype2/include") # fink installation directories add_directory(library_dirs, "/sw/lib") add_directory(include_dirs, "/sw/include") # darwin ports installation directories add_directory(library_dirs, "/opt/local/lib") add_directory(include_dirs, "/opt/local/include") if you get stuck, maybe you could just use a prebuilt version? http://pythonmac.org/packages/ this thread may also be somewhat helpful: http://mail.python.org/pipermail/image-sig/2007-April/004395.html ps. if someone has more Mac OS X boxes than they have use for, let me know ;-) From srichter at cosmos.phy.tufts.edu Thu Nov 8 22:30:13 2007 From: srichter at cosmos.phy.tufts.edu (Stephan Richter) Date: Thu, 8 Nov 2007 16:30:13 -0500 Subject: [Image-SIG] Proper Package for PIL Message-ID: <200711081630.13325.srichter@cosmos.phy.tufts.edu> Hello everyone, I am a Zope 3 developer and we have moved all our code into PyPI projects. Some of our packages require PIL. Unfortunately, we cannot list PIL as a dependency, since its distributions are not uploaded to PyPI and the download URL does not provide access the adequate links. For us, having a valid package/egg for PIL at the right location is very important. I would love to contribute proper packaging and eggification to PIL. (In fact, the Zope 3 community already has a proper, Tk-free egg for PIL at http://download.zope.org/distribution/PILwoTk-1.1.6.3.tar.gz.) However, even if we package PIL correctly, we cannot put it into PyPI, since noone but "effbot" has permissions to upload new PIL releases. So what do we have to do to get this done? Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training From fredrik at pythonware.com Thu Nov 8 23:24:12 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 08 Nov 2007 23:24:12 +0100 Subject: [Image-SIG] Proper Package for PIL In-Reply-To: <200711081630.13325.srichter@cosmos.phy.tufts.edu> References: <200711081630.13325.srichter@cosmos.phy.tufts.edu> Message-ID: Stephan Richter wrote: > I am a Zope 3 developer and we have moved all our code into PyPI projects. > Some of our packages require PIL. Unfortunately, we cannot list PIL as a > dependency, since its distributions are not uploaded to PyPI and the download > URL does not provide access the adequate links. > > For us, having a valid package/egg for PIL at the right location is very > important. I would love to contribute proper packaging and eggification to > PIL. (In fact, the Zope 3 community already has a proper, Tk-free egg for PIL > at http://download.zope.org/distribution/PILwoTk-1.1.6.3.tar.gz.) > > However, even if we package PIL correctly, we cannot put it into PyPI, since > noone but "effbot" has permissions to upload new PIL releases. > > So what do we have to do to get this done? posting a short how-to ("proper packaging/eggification for dummies/lazy programmers") and the necessary tweaks to setup.py to this list would be a good start, I think. From srichter at cosmos.phy.tufts.edu Fri Nov 9 14:03:02 2007 From: srichter at cosmos.phy.tufts.edu (Stephan Richter) Date: Fri, 9 Nov 2007 08:03:02 -0500 Subject: [Image-SIG] Proper Package for PIL In-Reply-To: References: <200711081630.13325.srichter@cosmos.phy.tufts.edu> Message-ID: <200711090803.02242.srichter@cosmos.phy.tufts.edu> On Thursday 08 November 2007, Fredrik Lundh wrote: > > So what do we have to do to get this done? > > posting a short how-to ("proper packaging/eggification for dummies/lazy > programmers") and the necessary tweaks to setup.py to this list would be > a good start, I think. Okay, I will work on that. How fast would you be able to get the proper egg out? :-) (I would love to have a working PIL by Thanksgiving (Nov. 22), but any time this year would be okay too!) Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training From leknarf at pacbell.net Fri Nov 9 17:14:01 2007 From: leknarf at pacbell.net (Scott Frankel) Date: Fri, 9 Nov 2007 08:14:01 -0800 Subject: [Image-SIG] _imagingft for OSX In-Reply-To: References: <1B54E573-9C0F-40D2-A8A2-5323CCE84A4F@pacbell.net> Message-ID: <3F07EC32-C547-41D8-8D07-0C5FA2531709@pacbell.net> Got it. Thanks! Scott On Nov 8, 2007, at 1:31 PM, Fredrik Lundh wrote: > Scott Frankel wrote: > >> Finally got PIL to build and install without error. >> >> Stuck now on using the ImageFont module. Where do I get _imagingft? >> How is it built and installed? > > if the setup.py script is able to find the freetype2 library, it's > built > by default. > > the following excerpt from setup.py might be somewhat helpful: > > elif sys.platform == "darwin": > # attempt to make sure we pick freetype2 over other > versions > add_directory(include_dirs, "/sw/include/freetype2") > add_directory(include_dirs, "/sw/lib/freetype2/include") > # fink installation directories > add_directory(library_dirs, "/sw/lib") > add_directory(include_dirs, "/sw/include") > # darwin ports installation directories > add_directory(library_dirs, "/opt/local/lib") > add_directory(include_dirs, "/opt/local/include") > > if you get stuck, maybe you could just use a prebuilt version? > > http://pythonmac.org/packages/ > > this thread may also be somewhat helpful: > > http://mail.python.org/pipermail/image-sig/2007-April/004395.html > > > > ps. if someone has more Mac OS X boxes than they have use for, let me > know ;-) > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From export at hope.cz Sat Nov 10 10:22:54 2007 From: export at hope.cz (export at hope.cz) Date: Sat, 10 Nov 2007 10:22:54 +0100 Subject: [Image-SIG] How to apply a threshold value to the image In-Reply-To: References: <4731E606.8503.6EAA97D@export.hope.cz> Message-ID: <4735867E.23138.8DFFBE@export.hope.cz> Can anyone give me an example how to apply a threshold value to an image? (everything above a certain brightness level becomes white, and everything below the level becomes black.) I was told I should use 256-item mapping table and pass it to the "point" method. But how should the 256-item mapping table look like, if the threshold is 18( found from the histogram) Thank you for any hint. L. > export at hope.cz wrote: > > > I would need to apply a threshold value to the image, where everything > > above a certain brightness level becomes white, and everything below the > > level becomes black. > > How can I do that with PIL? > > create a 256-item mapping table and pass it to the "point" method. > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From fredrik at pythonware.com Sat Nov 10 11:44:55 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat, 10 Nov 2007 11:44:55 +0100 Subject: [Image-SIG] How to apply a threshold value to the image In-Reply-To: <4735867E.23138.8DFFBE@export.hope.cz> References: <4731E606.8503.6EAA97D@export.hope.cz> <4735867E.23138.8DFFBE@export.hope.cz> Message-ID: export at hope.cz wrote: > But how should the 256-item mapping table look like, if the > threshold is 18( found from the histogram) here's one way to do it: threshold = 18 table = [] for i in range(256): if i < threshold: table.append(0) # black else: table.append(255) # white out = im.point(table) there are shorter ways to write this; the above was written for clarity. quite often, passing in a function instead of a table can make the code shorter: threshold = 18 def map(i): if i < threshold: return 0 return 255 out = im.point(table) there are plenty of ways to do this in one line as well, but I'll leave that as an exercise. From rollbak at gmail.com Fri Nov 9 14:51:16 2007 From: rollbak at gmail.com (Lucas Shrewsbury E.) Date: Fri, 9 Nov 2007 10:51:16 -0300 Subject: [Image-SIG] Proper Package for PIL In-Reply-To: <200711090803.02242.srichter@cosmos.phy.tufts.edu> References: <200711081630.13325.srichter@cosmos.phy.tufts.edu> <200711090803.02242.srichter@cosmos.phy.tufts.edu> Message-ID: <194b7da00711090551y15f0a6a3n7a5b98758dff427f@mail.gmail.com> Python Package Index Tutorial http://www.python.org/~jeremy/weblog/030924.html On Nov 9, 2007 10:03 AM, Stephan Richter wrote: > On Thursday 08 November 2007, Fredrik Lundh wrote: > > > So what do we have to do to get this done? > > > > posting a short how-to ("proper packaging/eggification for dummies/lazy > > programmers") and the necessary tweaks to setup.py to this list would be > > a good start, I think. > > Okay, I will work on that. How fast would you be able to get the proper > egg > out? :-) (I would love to have a working PIL by Thanksgiving (Nov. 22), > but > any time this year would be okay too!) > > Regards, > Stephan > -- > Stephan Richter > CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) > Web2k - Web Software Design, Development and Training > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -- LuCaS ---------------------------------------------------- Open Your Mind, Use Open Source -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071109/02992577/attachment.htm From tonylabarbara at aol.com Fri Nov 9 16:00:13 2007 From: tonylabarbara at aol.com (tonylabarbara at aol.com) Date: Fri, 09 Nov 2007 10:00:13 -0500 Subject: [Image-SIG] PIL Installation Problem Message-ID: <8C9F0F85DA05857-12F0-3F9E@MBLK-M29.sysops.aol.com> Hi; I?ve installed Zope 2.10.5 on top of Python 2.4.2 (not optimal, but it will work, according to the build instructions). I installed Plone 3.0.2 and I get errors when I crank up Zope, all related to a non-existent PIL. So I d/l/d the latest PIL, plopped it in my Extensions dir, ran this: python setup.py build_ext -i and got this: running build_ext building '_imagingtk' extension creating build/temp.freebsd-5.5-RELEASE-i386-2.4/Tk cc -fno-strict-aliasing -DNDEBUG -O -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/freetype2 -IlibImaging -I/usr/local/include -I/usr/include -I/usr/local/include/python2.4 -c _imagingtk.c -o build/temp.freebsd-5.5-RELEASE-i386-2.4/_imagingtk.o _imagingtk.c:20:16: tk.h: No such file or directory _imagingtk.c:23: error: syntax error before '*' token _imagingtk.c:31: error: syntax error before "Tcl_Interp" _imagingtk.c: In function `_tkinit': _imagingtk.c:37: error: `Tcl_Interp' undeclared (first use in this function) _imagingtk.c:37: error: (Each undeclared identifier is reported only once _imagingtk.c:37: error: for each function it appears in.) _imagingtk.c:37: error: `interp' undeclared (first use in this function) _imagingtk.c:45: error: syntax error before ')' token _imagingtk.c:50: error: `app' undeclared (first use in this function) _imagingtk.c: At top level: _imagingtk.c:55: warning: parameter names (without types) in function declaration _imagingtk.c:55: error: conflicting types for 'TkImaging_Init' _imagingtk.c:23: error: previous declaration of 'TkImaging_Init' was here _imagingtk.c:55: error: conflicting types for 'TkImaging_Init' _imagingtk.c:23: error: previous declaration of 'TkImaging_Init' was here _imagingtk.c:55: warning: data definition has no type or storage class _imagingtk.c:57: error: syntax error before '&' token error: command 'cc' failed with exit status 1 What do? TIA, Tony ________________________________________________________________________ Email and AIM finally together. You've gotta check out free AOL Mail! - http://mail.aol.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071109/c3ce301d/attachment.htm From bloominator at hotmail.com Sat Nov 10 06:21:05 2007 From: bloominator at hotmail.com (Gary Bloom) Date: Sat, 10 Nov 2007 00:21:05 -0500 Subject: [Image-SIG] BUG: PIL DPI trouble - fix for TIFF files (PIL 1.1.6) References: <632DE642-17E4-49A9-9139-A59AF770D780@gmx.at> Message-ID: Hi Markus, Thanks for your reply and sorry for the long delay. Hey, in your travels, have you seen any fixes to allow the TIFF module to support writing with compression? It seems that the PIL always writes TIFF files uncompressed and doesn't seem to support writing with compression. I would love to find a fix for that, as well. Any help would be greatly appreciated. Thanks! Gary ----- Original Message ----- From: Markus Kemmerling To: Gary Bloom Cc: Image-SIG at python.org ; gbloom at sefas.com Sent: Thursday, October 18, 2007 2:50 AM Subject: Re: [Image-SIG] BUG: PIL DPI trouble - fix for TIFF files (PIL 1.1.6) I would really like to see these fixes included in a next PIL release, if there will be one. (I also would like to see an egg release, but that's a different story.) Note, that I posted a similar fix (combining Florian's and your's) to the list a long time ago (july 2006). There is a small difference though, see below. Maybe a test for these fixes should be added, but I can't see any TIFF image tests at all in the PIL distribution. Am 10.10.2007 um 16:18 schrieb Gary Bloom: Here's a quick fix for the writing of the file, as well... Before making the fix below, go to line 721 and change the '1' to a '2' ! 721: ifd[RESOLUTION_UNIT] = 1 becomes 721: ifd[RESOLUTION_UNIT] = 2 Then make the changes listed below. This is consistent with those changes. This is a quick and dirty fix that I have not tested extensively, but it quickly allows me to read and write TIFF images with both the PIL and Photoshop, and each can see the DPI as set by the other. It fixes the problem I've had with PIL reading/writing TIFFs. Thanks, Florian! Regards, Gary Bloom Sales Engineer Sefas Innovation www.sefas.com ============ [Image-SIG] BUG: PIL DPI trouble - fix for TIFF files (PIL 1.1.6) Florian H?ch lists+Image_SIG at hoech.org Fri Oct 5 00:05:16 CEST 2007 a.. Previous message: [Image-SIG] fromstring image question b.. Next message: [Image-SIG] Image transpose c.. Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] ---------------------------------------------------------------------------- PIL only adds a dpi entry in the info dictionary if no resolution unit is specified in the TIFF file. This seems to be because of a misinterpretation of resolution unit values: they have a different meaning than in a JPEG file. JPEG: 0 = None; 1 = inches; 2 = cm. TIFF: 1 = None; 2 = inches; 3 = cm (see http://www.awaresystems.be/imaging/tiff/tifftags/resolutionunit.html and http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html) Here's a quick fix: Open TiffImagePlugin.py and go to line 577. Change the code: xres = getscalar(X_RESOLUTION, (1, 1)) yres = getscalar(Y_RESOLUTION, (1, 1)) if xres and yres: xres = xres[0] / (xres[1] or 1) yres = yres[0] / (yres[1] or 1) resunit = getscalar(RESOLUTION_UNIT, 1) if resunit == 2: # Inches self.info["dpi"] = xres, yres elif resunit == 3: # Centimeters self.info["dpi"] = xres * 2.54, yres * 2.54When converting from inches to centimeters, shouldn't you rather divide by 2.54 instead of multiplying? else: # No absolute unit of measurement. self.info["resolution"] = xres, yres Regards, Florian Hoech _______________________________________________ Image-SIG maillist - Image-SIG at python.org http://mail.python.org/mailman/listinfo/image-sig Regards, Markus Kemmerling -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071110/0a476d27/attachment.htm From janssen at parc.com Sun Nov 11 23:50:52 2007 From: janssen at parc.com (Bill Janssen) Date: Sun, 11 Nov 2007 14:50:52 PST Subject: [Image-SIG] Proper Package for PIL In-Reply-To: <194b7da00711090551y15f0a6a3n7a5b98758dff427f@mail.gmail.com> References: <200711081630.13325.srichter@cosmos.phy.tufts.edu> <200711090803.02242.srichter@cosmos.phy.tufts.edu> <194b7da00711090551y15f0a6a3n7a5b98758dff427f@mail.gmail.com> Message-ID: <07Nov11.145101pst."57996"@synergy1.parc.xerox.com> > > > posting a short how-to ("proper packaging/eggification for dummies/lazy > > > programmers") and the necessary tweaks to setup.py to this list would be > > > a good start, I think. > > Python Package Index Tutorial > http://www.python.org/~jeremy/weblog/030924.html Does this create an egg? If so, where does it wind up? Bill From fredrik at pythonware.com Mon Nov 12 20:37:00 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 12 Nov 2007 20:37:00 +0100 Subject: [Image-SIG] PIL Installation Problem In-Reply-To: <8C9F0F85DA05857-12F0-3F9E@MBLK-M29.sysops.aol.com> References: <8C9F0F85DA05857-12F0-3F9E@MBLK-M29.sysops.aol.com> Message-ID: tonylabarbara at aol.com wrote: > I?ve installed Zope 2.10.5 on top of Python 2.4.2 (not optimal, but it > will work, according to the build instructions). I installed Plone 3.0.2 > and I get errors when I crank up Zope, all related to a non-existent > PIL. So I d/l/d the latest PIL, plopped it in my Extensions dir, ran this: > python setup.py build_ext -i > > and got this: > running build_ext > building '_imagingtk' extension Looks like you have a Python linked with Tkinter, and the Tcl/Tk build libraries, but not the Tcl/Tk include files. You can locate a Tcl/Tk developer package, or comment out the following lines in the setup.py file: elif feature.tcl and feature.tk: exts.append(Extension( "_imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"], libraries=[feature.tcl, feature.tk] )) From fredrik at pythonware.com Mon Nov 12 20:39:19 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 12 Nov 2007 20:39:19 +0100 Subject: [Image-SIG] Proper Package for PIL In-Reply-To: <200711090803.02242.srichter@cosmos.phy.tufts.edu> References: <200711081630.13325.srichter@cosmos.phy.tufts.edu> <200711090803.02242.srichter@cosmos.phy.tufts.edu> Message-ID: Stephan Richter wrote: > Okay, I will work on that. How fast would you be able to get the proper egg > out? :-) (I would love to have a working PIL by Thanksgiving (Nov. 22) I'm travelling that week, so I need to have the info/patch before next weekend. cheers /F From fredrik at pythonware.com Mon Nov 12 20:40:53 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 12 Nov 2007 20:40:53 +0100 Subject: [Image-SIG] Proper Package for PIL In-Reply-To: <194b7da00711090551y15f0a6a3n7a5b98758dff427f@mail.gmail.com> References: <200711081630.13325.srichter@cosmos.phy.tufts.edu> <200711090803.02242.srichter@cosmos.phy.tufts.edu> <194b7da00711090551y15f0a6a3n7a5b98758dff427f@mail.gmail.com> Message-ID: Lucas Shrewsbury E. wrote: > Python Package Index Tutorial > http://www.python.org/~jeremy/weblog/030924.html PIL is available on PyPI, but Stephan needs an "eggified" version that's compatible with Zope's auto-installer. From Oliver.Bock at barclaysglobal.com Mon Nov 19 00:53:49 2007 From: Oliver.Bock at barclaysglobal.com (Bock, Oliver BGI SYD) Date: Mon, 19 Nov 2007 10:53:49 +1100 Subject: [Image-SIG] Inconsistent line widths using ImageDraw.line() Message-ID: <1D2261C0DEDA024A8061E653AD9779880B6817@sydnte2k032.insidelive.net> When I use line()'s newish 'width' parameter, the observed line width seems to depend on the angle of the line. If you run this script: import Image, ImageDraw im = Image.new("RGB", (100,100), "white") draw = ImageDraw.Draw(im) draw.line((0,0,100,100), width=3, fill="black") draw.line((0,100,100,0), width=3, fill="black") del draw im.show() then (on Windows XP, using PIL 1.1.6 with Python 2.4) the second line (from bottom left to top right) is noticeably thinner than the first. Can anyone suggest a fix? Oliver -- This message and any attachments are confidential, proprietary, and may be privileged. If this message was misdirected, Barclays Global Investors (BGI) does not waive any confidentiality or privilege. If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BGI, unless the author is authorized by BGI to express such views or opinions on its behalf. All email sent to or from this address is subject to electronic storage and review by BGI. Although BGI operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed. From gandalf at shopzeus.com Tue Nov 20 18:59:49 2007 From: gandalf at shopzeus.com (Laszlo Nagy) Date: Tue, 20 Nov 2007 18:59:49 +0100 Subject: [Image-SIG] Antialiased text on transparent image fails? In-Reply-To: <46EA8E40.8050307@reservoir.nl> References: <46E67FF1.70705@shopzeus.com> <46EA8E40.8050307@reservoir.nl> Message-ID: <47432095.70303@shopzeus.com> Hi Coen, I'm sorry for the late answer. I was out of the country. > > Isn't this the way it should work? The alpha value of a pixel is > treated the same way as any other channel. When a pixel is half > covered by a shape, PIL wil draw 50% of the foreground and 50% of the > background. In your case: a green shape 0, 255, 0, 255 (rgba) and > background 255, 0, 0, 0. If you take the average of the two you come > up with R=128 in the pixel and will be visible for 50% A=128. Isn't > this the desired effect? Not desired for me. When you put a transparent image I1 on another image I2, then you should see what you would see from I2, plus what you would see from I2 that is under I1. Let me tell you an example. Let's have two pieces of glass, G1 and G2. G1 is: (0,255,0,128), representing a material that is, when you put white light on it: a.) 50% the red component is absorbed, 50% goes through b.) 50% is reflected, 50% goes through c.) 50% the blue component is absorbed, 50% goes through G2 is: (255,0,0,2), representing an almost clear, fully transparent glass, when you put white light on it: a.) a very few of the red component is reflected, the remaining goes through b.) a very few of the green component is absorbed, the remaining goes through c.) a very few of the blue component is absorbed, the remaining goes through Maybe my interpretation is bad, but this is how I think it is - the alpha channel gives transparency, the other channels tells us how many of the remaining light is reflected vs. absorbed. 255 means full reflect, whereas 0 means full absorption. Now what happens if you put a piece of G1 on top of G2, put a white lamp (255,255,255) over it and examine the result? How much red you will see in it? Will it be (128,128,0) or (1,128,0)? Of course, the later. There are other scenarios: you can put the lamp behind it, you can let them shine etc. Any scenario you choose, you will not see too much red in it because there is nothing in G1 or G2 that could reflect or let throught much more red then green or blue. Maybe I'm wrong and I have misinterpreted the meaning of the alpha channel. In that case I wonder what it means? And finally, I'm still interested in the good method, e.g. how can I achieve the same effect with PIL, effectively? I'm asking this because all of the methods in PIL will take the average of the two alpha channels, and this is bad for me. Calculating pixels values one by one would work but it is not effective. Thanks, Laszlo p.s.: I do not like top posting, but once you started with it, I did not want to "mid post". :-) > And if it would be a color? Don't you want the same to happen? > > The solution? Render the shape on a 0,0,0,0 background. No red will be > added, your half filled pixel with a correct alpha value will blend > with new backgrounds as it is supposed to. You can save this image in > various ways for later use. > > Just my thought... and i hope it helps. > Greetings, > > Coen > > > Laszlo Nagy wrote: >> >> Hi All, >> >> I tried to put a text on a transparent image. Here is a test: >> >> import Image >> import ImageDraw >> import ImageFont >> >> img = Image.new('RGBA',(100,20),(255,0,0,0)) >> drawer = ImageDraw.Draw(img) >> fnt = ImageFont.truetype("Vera.ttf",20) # >> http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/ >> drawer.text((0,0),"ABCDE",font=fnt,fill="#00ff00") >> img.save("test.png") # Result image >> >> I'm working on a rendering engine but I created this example to show >> the problem. The rendering engine should be able to create an image >> with transparent parts, and one should be able to put the rendered >> image on top of any other image. >> >> The problem itself: font edges are interpolated between the >> background and foreground color. You can see it on the resulting >> image. If you open the created "test.png" file in GIMP and use the >> color picker tool then you can see values like: >> >> (203,52,0,52) >> (215,40,0,40) >> >> >> I think that this is bad. The background was fully transparent. If >> you put a green object on a fully transparent thing, you should never >> see any red in it. I believe that the result should be something like >> >> (0,52,0,52) >> (0,40,0,40) >> >> In other words, when antialiasing a text, the background pixel's >> color should be weighted with its transparency. In my example, the >> background pixel is fully red but should have zero weight. >> >> Workarounds? >> >> Working with black or white initial background is not a workaround, >> because PIL will darken/lighten the pixels. I used red+green just to >> make the problem more visible. A correct workaround is to use the >> actual target background that will finally be used, but it is not a >> good workaround. This is obvious: I want to render the result image >> once, then put it on different target images. Rendering the result >> image each time I need to put it on a target would be very slow. >> >> Can you please confirm if this is a bug in PIL? Comments welcome. >> >> Best, >> >> Laszlo >> >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > From whatyoulookin at yahoo.com Sun Nov 25 03:36:39 2007 From: whatyoulookin at yahoo.com (Alec Bennett) Date: Sat, 24 Nov 2007 18:36:39 -0800 (PST) Subject: [Image-SIG] Handling "image file is not of type 17" errors... Message-ID: <267293.85039.qm@web54603.mail.re2.yahoo.com> Running PIL 1.1.6 with Python 2.4 on Windows XP I occasoinally get an error "Image file is not of type 17". Unfortunately this error doesn't throw an exception, instead it pops up a modular dialog box that completely halts my program. I know (or think) its caused by a thread conflict, one thread accessing the image before the other one has finished writing it, and I hate to admit this, but in this case I'd rather fix the error handling than the problem itself. I've grepped the PIL files for any mention of this error and can't find it. I don't imagine anyone knows what file is throwing this error? Or otherwise how to disable it? Thanks for any help. ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ From fredrik at pythonware.com Sun Nov 25 16:22:02 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 25 Nov 2007 16:22:02 +0100 Subject: [Image-SIG] Handling "image file is not of type 17" errors... In-Reply-To: <267293.85039.qm@web54603.mail.re2.yahoo.com> References: <267293.85039.qm@web54603.mail.re2.yahoo.com> Message-ID: Alec Bennett wrote: > Running PIL 1.1.6 with Python 2.4 on Windows XP I > occasoinally get an error "Image file is not of type > 17". Unfortunately this error doesn't throw an > exception, instead it pops up a modular dialog box > that completely halts my program. > I've grepped the PIL files for any mention of this > error and can't find it. I don't imagine anyone knows > what file is throwing this error? Or otherwise how to > disable it? there's no such error message in PIL, afaik. a quick googling indicates that it might be caused by something in wxWindows. does your application perhaps use wxPython? From whatyoulookin at yahoo.com Mon Nov 26 01:34:01 2007 From: whatyoulookin at yahoo.com (Alec Bennett) Date: Sun, 25 Nov 2007 16:34:01 -0800 (PST) Subject: [Image-SIG] Handling "image file is not of type 17" errors... In-Reply-To: Message-ID: <146608.84629.qm@web54603.mail.re2.yahoo.com> Indeed it does, I'm sure you're right. For anyone else coming down this path, here's how I handled the situation. None too graceful but so far so good: try: w, h = im.size # check integrity of image file im.save("whatever.jpg", quality=100) except: print "Whoops, bad file" What's interesting is this code (without determining the image dimensions) wouldn't throw an exception, just that annoying popup error: try: im.save("whatever.jpg", quality=100) except: print "Whoops, bad file" ____________________________________________________________________________________ Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/ From leknarf at pacbell.net Mon Nov 26 05:15:45 2007 From: leknarf at pacbell.net (Scott Frankel) Date: Sun, 25 Nov 2007 20:15:45 -0800 Subject: [Image-SIG] text justification In-Reply-To: <3F07EC32-C547-41D8-8D07-0C5FA2531709@pacbell.net> References: <1B54E573-9C0F-40D2-A8A2-5323CCE84A4F@pacbell.net> <3F07EC32-C547-41D8-8D07-0C5FA2531709@pacbell.net> Message-ID: <472BDB8C-7269-4789-AF6E-0467AC4A75D5@pacbell.net> I'm using PIL to render text. Is there a way to specify left, center, or right justification? After setting X and Y coordinate positions, the text string, and the font, my text drawing line of code is this: draw.text((xpos, ypos), text, font=font) Thanks in advance Scott From kevin at cazabon.com Mon Nov 26 16:09:29 2007 From: kevin at cazabon.com (Kevin Cazabon) Date: Mon, 26 Nov 2007 16:09:29 +0100 Subject: [Image-SIG] text justification In-Reply-To: <472BDB8C-7269-4789-AF6E-0467AC4A75D5@pacbell.net> References: <1B54E573-9C0F-40D2-A8A2-5323CCE84A4F@pacbell.net> <3F07EC32-C547-41D8-8D07-0C5FA2531709@pacbell.net> <472BDB8C-7269-4789-AF6E-0467AC4A75D5@pacbell.net> Message-ID: There's nothing built into the library, but I've hacked some code in the past to do this - unfortunately I can't find any code which can be neatly extracted for you. It's pretty straight forward though - the PIL text rendering functions include the ability to tell you exactly what size the finished text will be. You can simply use that, then calculate how far left/right to move your starting point. i.e. - if your text area is 300 pixels wide, and the text will be only 223 pixels, to right-justify you just offset by the difference (77 pixels). For center justified, just offset by half that (38 or 39 pixels). Kevin. On 26 Nov 2007, at 05:15, Scott Frankel wrote: > > I'm using PIL to render text. Is there a way to specify left, > center, or right justification? > > After setting X and Y coordinate positions, the text string, and the > font, my text drawing line of code is this: > > draw.text((xpos, ypos), text, font=font) > > > Thanks in advance > Scott > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From leknarf at pacbell.net Tue Nov 27 19:44:03 2007 From: leknarf at pacbell.net (Scott Frankel) Date: Tue, 27 Nov 2007 10:44:03 -0800 Subject: [Image-SIG] text render quality (jpg attached) Message-ID: One more question about text: Is there a way to increase text render quality? I haven't seen any hinting, anti-aliasing, or quality settings in the documentation for font objects. Are there any tricks for cheating better quality out of text renders? I'm attaching an image with a PIL text render on the left and a Shake text render on the right. They both use the same font. Here's my PIL code: import Image from PIL import Image import ImageFont img = Image.new("RGB", (512, 256), (128, 128, 128)) import ImageDraw draw = ImageDraw.Draw(img) font = ImageFont.truetype("/Library/Fonts/HelveticaNeue.dfont", 24, encoding="armn") draw.text((10, 10), "hello world", font=font) img.save("foo.jpg", "JPEG") Thanks! Scott -------------- next part -------------- A non-text attachment was scrubbed... Name: tmp.001.jpg Type: image/jpeg Size: 4490 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20071127/6c0292bb/attachment.jpg -------------- next part -------------- From cz at gocept.com Wed Nov 28 19:00:14 2007 From: cz at gocept.com (Christian Zagrodnick) Date: Wed, 28 Nov 2007 19:00:14 +0100 Subject: [Image-SIG] Proper Package for PIL References: <200711081630.13325.srichter@cosmos.phy.tufts.edu> <200711090803.02242.srichter@cosmos.phy.tufts.edu> Message-ID: On 2007-11-12 20:39:19 +0100, Fredrik Lundh said: > Stephan Richter wrote: > >> Okay, I will work on that. How fast would you be able to get the proper egg >> out? :-) (I would love to have a working PIL by Thanksgiving (Nov. 22) > > I'm travelling that week, so I need to have the info/patch before next > weekend. Any progress on this? I'd like to have an egg, too :) -- Christian Zagrodnick gocept gmbh & co. kg ? forsterstrasse 29 ? 06112 halle/saale www.gocept.com ? fon. +49 345 12298894 ? fax. +49 345 12298891 From fredrik at pythonware.com Wed Nov 28 20:46:52 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 28 Nov 2007 20:46:52 +0100 Subject: [Image-SIG] Proper Package for PIL In-Reply-To: References: <200711081630.13325.srichter@cosmos.phy.tufts.edu> <200711090803.02242.srichter@cosmos.phy.tufts.edu> Message-ID: Christian Zagrodnick wrote: >>> Okay, I will work on that. How fast would you be able to get the proper egg >>> out? :-) (I would love to have a working PIL by Thanksgiving (Nov. 22) >> >> I'm travelling that week, so I need to have the info/patch before next >> weekend. > > Any progress on this? I'd like to have an egg, too :) no sign of a "busy developers guide" (or patch) yet. From fredrik at pythonware.com Wed Nov 28 20:50:41 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 28 Nov 2007 20:50:41 +0100 Subject: [Image-SIG] text render quality (jpg attached) In-Reply-To: References: Message-ID: Scott Frankel wrote: > One more question about text: Is there a way to increase text render > quality? > > I haven't seen any hinting, anti-aliasing, or quality settings in the > documentation for font objects. Are there any tricks for cheating > better quality out of text renders? > > I'm attaching an image with a PIL text render on the left and a Shake > text render on the right. They both use the same font. I don't know what "Shake" is, but if those are based on exactly the same font file, it looks like a bug in Freetype. Can you mail me a copy of the TTF file so I can double check this on another build/platform? From fredrik at pythonware.com Wed Nov 28 20:55:51 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 28 Nov 2007 20:55:51 +0100 Subject: [Image-SIG] text render quality (jpg attached) In-Reply-To: References: Message-ID: Scott Frankel wrote: > font = ImageFont.truetype("/Library/Fonts/HelveticaNeue.dfont", 24, > encoding="armn") judging from http://www.nabble.com/Font-searching-t4325461.html dfont files are collections of TTF files, so you're probably getting different fonts (my guess is that Freetype picks up the first one, by default). The post mentions a utility that lets you extract individual TTF files from the Mac archives: > Mac users could run fondu over their fonts to get .ttfs from > .dfonts. I assume it's this tool they're referring to: http://fondu.sourceforge.net/ From Chris.Barker at noaa.gov Wed Nov 28 21:09:10 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 28 Nov 2007 12:09:10 -0800 Subject: [Image-SIG] text render quality (jpg attached) In-Reply-To: References: <474C71B8.20400@noaa.gov> Message-ID: <474DCAE6.9080106@noaa.gov> Scott Frankel wrote: > Point well taken regarding jpeg. Nonetheless, my text is still looking > pretty funky. Any other suggestions I've repeated your experiment, and yes, it doesn't look so good. I think the issue is that that is a very skinny font, and rendering it with anti-aliasing at 72dpi (which it appears is the default -- I can't find anything in the PIL docs about setting dpi, or what unit the "size" of a font is given in). Some systems use tricks to line up the lines of a font with the pixels to make this sort of thing look better (MS ClearType). Here's a bit of discussion about that: http://www.antigrain.com/research/font_rasterization/index.html It looks like PIL isn't trying to do anything special in that regard. You might try the agg renderer -- I don't know if it's different, but it might be. I'd use a thicker font, it looks much better -- see enclosure. #!/usr/bin/env python import Image from PIL import Image import ImageFont img = Image.new("RGB", (512, 256), (128, 128, 128)) import ImageDraw draw = ImageDraw.Draw(img) font = ImageFont.truetype("/Library/Fonts/HelveticaNeue.dfont", 24, encoding="armn") draw.text((10, 10), "hello world", font=font) font = ImageFont.truetype("/Library/Fonts/HelveticaCY.dfont", 24, encoding="armn") draw.text((10, 40), "hello world", font=font) print "size of X is:", font.getsize("X") img.save("foo.png", "PNG") -- 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: foo.png Type: image/png Size: 7489 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20071128/a14f006c/attachment.png From cz at gocept.com Thu Nov 29 08:00:00 2007 From: cz at gocept.com (Christian Zagrodnick) Date: Thu, 29 Nov 2007 08:00:00 +0100 Subject: [Image-SIG] Proper Package for PIL References: <200711081630.13325.srichter@cosmos.phy.tufts.edu> <200711090803.02242.srichter@cosmos.phy.tufts.edu> Message-ID: On 2007-11-28 20:46:52 +0100, Fredrik Lundh said: > Christian Zagrodnick wrote: > >>>> Okay, I will work on that. How fast would you be able to get the proper egg >>>> out? :-) (I would love to have a working PIL by Thanksgiving (Nov. 22) > >> >>> I'm travelling that week, so I need to have the info/patch before next >>> weekend. >> >> Any progress on this? I'd like to have an egg, too :) > > no sign of a "busy developers guide" (or patch) yet. Ah :) Stephan? Actually I tried to package it once, but miserably failed because PIL did all sorts of things I didn't understand. So I'm not of much help here. Anyway, would be good to have an eggified package. :) -- Christian Zagrodnick gocept gmbh & co. kg ? forsterstrasse 29 ? 06112 halle/saale www.gocept.com ? fon. +49 345 12298894 ? fax. +49 345 12298891 From srichter at cosmos.phy.tufts.edu Thu Nov 29 18:59:26 2007 From: srichter at cosmos.phy.tufts.edu (Stephan Richter) Date: Thu, 29 Nov 2007 12:59:26 -0500 Subject: [Image-SIG] Proper Package for PIL In-Reply-To: References: <200711081630.13325.srichter@cosmos.phy.tufts.edu> Message-ID: <200711291259.26293.srichter@cosmos.phy.tufts.edu> On Thursday 29 November 2007, Christian Zagrodnick wrote: > On 2007-11-28 20:46:52 +0100, Fredrik Lundh said: > > Christian Zagrodnick wrote: > >>>> Okay, I will work on that. How fast would you be able to get the > >>>> proper egg out? :-) (I would love to have a working PIL by > >>>> Thanksgiving (Nov. 22) > > > > ?>> > > > >>> I'm travelling that week, so I need to have the info/patch before next > >>> weekend. > >> > >> Any progress on this? I'd like to have an egg, too :) > > > > no sign of a "busy developers guide" (or patch) yet. > > Ah :) > > Stephan? My fault. I got stuck with three clients in crisis mode. However, I really want this before Zope 3.4.0, so I Will work on it soon. My first try will be to just rename the distribution file from Imaging-*.tgz to PIL-*.tgz. That might already do the trick. I also noticed that the homepage and download link seem to be reversed in PyPI. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training From oumar at fastermail.com Fri Nov 30 11:09:08 2007 From: oumar at fastermail.com (oumar deen swarray) Date: Fri, 30 Nov 2007 18:09:08 +0800 Subject: [Image-SIG] I am a computer operetor Message-ID: <20071130100908.5029C7B8F9@ws5-10.us4.outblaze.com> Dear Sir/Madam, ] I am a sierra leonean living in the city of Freetown, my name is Oumar Swarray-Deen; address 6k Thunder Hill Road Kissy, am 31 yrs old i studies computer software and networking and communication. i have been operating in one agency and manager, so i would like sobody to do business with = Your Choice for Studies in Spain Spanish and study abroad programs for university students and professionals. http://a8-asy.a8ww.net/a8-ads/adftrclick?redirectid=01f5fde786aa34c2819fb2196b1cc1b8 -- Powered by Outblaze From gm770 at verizon.net Wed Nov 14 15:54:26 2007 From: gm770 at verizon.net (MARIA LEONFORTI) Date: Wed, 14 Nov 2007 14:54:26 -0000 Subject: [Image-SIG] PIL grabscreen module Message-ID: <000601c826cd$5766b880$0502a8c0@giga> The grabscreen module only seems to work on the primary screen, of my 2 displays, instead of both screen. Pressing PrintScreen easily captures both screens. I looked over the C code, and found out why. It's getting the physical screen size, and not the virtual one. I wanted to fix it, but get some odd error about requiring .NET Below is that error message. How can I correct the C code without .Net SDK? -- error from console -- G:\software\python_image_lib\Imaging-1.1.6\Imaging-1.1.6>python setup.py build_ext -i running build_ext error: The .NET Framework SDK needs to be installed before building extensions for Python. Richard R. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071114/232d0e49/attachment.htm From raghuram.narasimhan at gmail.com Thu Nov 22 06:26:02 2007 From: raghuram.narasimhan at gmail.com (raghuram narasimhan) Date: Wed, 21 Nov 2007 21:26:02 -0800 Subject: [Image-SIG] Importing image file as text Message-ID: <2b125de60711212126i11d8dbbapa337cab1271937a@mail.gmail.com> Hi all, I have converted an ENVI image file into ASCII. The ASCII file has NaNs or NoData in them. I am not able to read the file into python since it is not able to recognize NaN. I'm not an experience python user, and hence i guess i'm not able to figure it out. Does anyone have any idea as to how i can import an ASCII file with NaNs in them ? Hoping to hear from you, Raghu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071121/b268a66c/attachment.htm From raghuram.narasimhan at gmail.com Thu Nov 22 06:30:48 2007 From: raghuram.narasimhan at gmail.com (raghuram narasimhan) Date: Wed, 21 Nov 2007 21:30:48 -0800 Subject: [Image-SIG] How do i import text file which has NaNs ? Message-ID: <2b125de60711212130s4c99ede9jcc3775cbb7f45bbf@mail.gmail.com> Hi all, I have converted an ENVI image file into ASCII. The ASCII file has NaNs or NoData in them. I am not able to read the file into python since it is not able to recognize NaN. I'm not an experience python user, and hence i guess i'm not able to figure it out. Does anyone have any idea as to how i can import an ASCII file with NaNs in them ? Hoping to hear from you, Raghu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071121/3d62864a/attachment.htm From mobiledreamers at gmail.com Mon Nov 26 02:09:25 2007 From: mobiledreamers at gmail.com (mobiledreamers at gmail.com) Date: Sun, 25 Nov 2007 17:09:25 -0800 Subject: [Image-SIG] image rendering in python In-Reply-To: References: Message-ID: http://cdnll.i.imagechef.com/ic/templimg2/Shaved%20Head.jpg Do u know how to make such images using PIL or other tools in python thanks a lot for your kind help -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071125/5d5a41a6/attachment.htm From HAWRYLA at novachem.com Fri Nov 30 17:51:35 2007 From: HAWRYLA at novachem.com (Andrew Hawryluk) Date: Fri, 30 Nov 2007 09:51:35 -0700 Subject: [Image-SIG] Does PIL support the sBIT chunk in PNG files? Message-ID: <48C01AE7354EC240A26F19CEB995E94301693434@CHMAILMBX01.novachem.com> Thanks to everyone that is using and developing PIL - it has been most helpful! I am working with a 16-bit greyscale PNGs created by LabVIEW (currently 14695 of them). They were captured on a 12-bit camera and encoded with the "sBIT" chunk, scaling the values up to 16-bit values as described in the PNG specs, section 12.5. Opening the images with PIL I get the full 16-bit values, but I need the original values. (The rescaling I need is described in the PNG specs, section 13.12.) The problem is additionally complicated by the fact that some of the darker images use only 10 or 11 of the available bits in the camera and LabVIEW also scales these to the full 16 bits available, so blindly dividing all images by a constant will not solve the problem. As a workaround, I am opening each file and reading the "sBIT" byte directly and then using an integer division to restore the original camera values. This has solved my problem, but it would be better if I knew how to ask PIL to do the work for me. PNG specification: http://www.w3.org/TR/PNG/ Thanks again, Andrew Calgary, Canada -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071130/a3408910/attachment.htm From jjkk73 at gmail.com Fri Nov 30 19:42:15 2007 From: jjkk73 at gmail.com (jorma kala) Date: Fri, 30 Nov 2007 19:42:15 +0100 Subject: [Image-SIG] Is getdata() or load() more efficient for accessing pixels? Message-ID: Hi, I read that the getpixel function of the PIL library is relatively slow. Which alternative is therefore faster and more efficient, accesing the result of getdata() as a flat list or using the function load(), and accessing pixels through the resulting 2-dimensional array? Thanks a lot. j. kala -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071130/a788790c/attachment.htm From georgelecompte at gmail.com Fri Nov 30 15:58:03 2007 From: georgelecompte at gmail.com (George LeCompte) Date: Fri, 30 Nov 2007 06:58:03 -0800 Subject: [Image-SIG] Find camera information from JPG image Message-ID: <5b6eb1490711300658w2b073a61r7639f830f54de4fa@mail.gmail.com> How do I recover camera information such as shtter speed, focal length from the header of a JPG image? thanks