From eric at bright-interactive.com Sun Jun 1 23:44:10 2008 From: eric at bright-interactive.com (Eric Clack) Date: Sun, 1 Jun 2008 22:44:10 +0100 Subject: [Image-SIG] Anyway to keep ICC profiles intact (e.g. sRGB)? Message-ID: <5c58e3ca0806011444h63bd686bm8739c68b3698b286@mail.gmail.com> Hi there,I've been using PIL for some time now and it works very well to rescale and watermark images, however recently I've noticed that it doesn't preserve ICC colour profiles. I have this version (from Image.py): # 2005-03-28 fl PIL release 1.1.5 For example: import Image i = "/path/to/input_image.jpg" o = "/path/to/output_i,age.jpg" im = Image.open(i) im.save(o) input_image has the sRGB ICC profile, but now output_image has no profile (confirmed with photoshop). Is there any way to keep the existing profile, or copy it across so that save saves it? Many thanks, -Eric. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at karsten.name Tue Jun 3 12:13:58 2008 From: mail at karsten.name (Karsten Hiddemann) Date: Tue, 03 Jun 2008 12:13:58 +0200 Subject: [Image-SIG] Anyway to keep ICC profiles intact (e.g. sRGB)? In-Reply-To: <5c58e3ca0806011444h63bd686bm8739c68b3698b286@mail.gmail.com> References: <5c58e3ca0806011444h63bd686bm8739c68b3698b286@mail.gmail.com> Message-ID: <48451966.8080708@karsten.name> Eric Clack schrieb: > Hi there, > I've been using PIL for some time now and it works very well to rescale > and watermark images, however recently I've noticed that it doesn't > preserve ICC colour profiles. Maybe these links are what you are looking for? http://trac.gbiloba.org/ImageCms/ http://www.cazabon.com/pyCMS/ Cheers, Karsten From frederic.mantegazza at gbiloba.org Tue Jun 3 14:46:00 2008 From: frederic.mantegazza at gbiloba.org (=?ISO-8859-1?Q?Fr=E9d=E9ric?=) Date: Tue, 3 Jun 2008 14:46:00 +0200 (CEST) Subject: [Image-SIG] Anyway to keep ICC profiles intact (e.g. sRGB)? In-Reply-To: <48451966.8080708@karsten.name> Message-ID: Le 3/6/2008, "Karsten Hiddemann" a ?crit: >> I've been using PIL for some time now and it works very well to rescale >> and watermark images, however recently I've noticed that it doesn't >> preserve ICC colour profiles. > >Maybe these links are what you are looking for? > >http://trac.gbiloba.org/ImageCms/ >http://www.cazabon.com/pyCMS/ Unfortunally not. ImageCms (based of pyCMS code) can't read/write profiles. It can just convert an image from a color space (using a source profile) to another one (using a destination profile). But you need to provide both profiles. I plan to add support to be able to convert using the embedded profile as source profile, but it needs to be read in PIL, which is not the case. But have a look in this list archives: Florian H?ch wrote a patch against 1.1.6 to do that. I just tried it, but don't use it in ImageCms yet. I would love to see such patch included in the official release. And I think it could be great to be able to write back profiles too, so it could become easy to keep profiles during read/write. From eric at bright-interactive.com Tue Jun 3 13:53:29 2008 From: eric at bright-interactive.com (Eric Clack) Date: Tue, 3 Jun 2008 12:53:29 +0100 Subject: [Image-SIG] Anyway to keep ICC profiles intact (e.g. sRGB)? In-Reply-To: <48451966.8080708@karsten.name> References: <5c58e3ca0806011444h63bd686bm8739c68b3698b286@mail.gmail.com> <48451966.8080708@karsten.name> Message-ID: <5c58e3ca0806030453h31b67353s428b5d86c87de126@mail.gmail.com> Those other libraries look interesting, but I wonder if there is a way to do this just using PIL? I don't actually want to do any colour management (e.g. change profiles), just maintain colour profiles when working with images. -Eric. 2008/6/3 Karsten Hiddemann : > Eric Clack schrieb: > >> Hi there, >> I've been using PIL for some time now and it works very well to rescale >> and watermark images, however recently I've noticed that it doesn't preserve >> ICC colour profiles. >> > > Maybe these links are what you are looking for? > > http://trac.gbiloba.org/ImageCms/ > http://www.cazabon.com/pyCMS/ > > Cheers, > Karsten > -- Eric Clack eric at bright-interactive.com Bright Interactive : Successfully delivering interactive websites and business applications http://www.bright-interactive.com/ +44 (0) 1273 201 112 Registered in England No. 3865036. VAT Reg. No. 786 6073 86 Registered Office: 12-13 Ship Street, Brighton, East Sussex, BN1 1AD -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric at bright-interactive.com Tue Jun 3 16:30:46 2008 From: eric at bright-interactive.com (Eric Clack) Date: Tue, 3 Jun 2008 15:30:46 +0100 Subject: [Image-SIG] Anyway to keep ICC profiles intact (e.g. sRGB)? In-Reply-To: References: <48451966.8080708@karsten.name> Message-ID: <5c58e3ca0806030730idd7442cxace982ea7690cac0@mail.gmail.com> My knowledge is very limited when it comes to colour profiles, so I might be describing something that is impossible here, but isn't the colour profile information just a tag, or piece of metadata that I could copy from image to image? -Eric. 2008/6/3 Fr?d?ric : > > Le 3/6/2008, "Karsten Hiddemann" a ?crit: > > >> I've been using PIL for some time now and it works very well to rescale > >> and watermark images, however recently I've noticed that it doesn't > >> preserve ICC colour profiles. > > > >Maybe these links are what you are looking for? > > > >http://trac.gbiloba.org/ImageCms/ > >http://www.cazabon.com/pyCMS/ > > Unfortunally not. ImageCms (based of pyCMS code) can't read/write > profiles. It can just convert an image from a color space (using a > source profile) to another one (using a destination profile). But you > need to provide both profiles. > > I plan to add support to be able to convert using the embedded profile as > source profile, but it needs to be read in PIL, which is not the case. > But have a look in this list archives: Florian H?ch wrote a patch > against 1.1.6 to do that. I just tried it, but don't use it in ImageCms > yet. > > I would love to see such patch included in the official release. And I > think it could be great to be able to write back profiles too, so it > could become easy to keep profiles during read/write. > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -- Eric Clack eric at bright-interactive.com Bright Interactive : Successfully delivering interactive websites and business applications http://www.bright-interactive.com/ +44 (0) 1273 201 112 Registered in England No. 3865036. VAT Reg. No. 786 6073 86 Registered Office: 12-13 Ship Street, Brighton, East Sussex, BN1 1AD -------------- next part -------------- An HTML attachment was scrubbed... URL: From frederic.mantegazza at gbiloba.org Wed Jun 4 16:34:18 2008 From: frederic.mantegazza at gbiloba.org (=?ISO-8859-1?Q?Fr=E9d=E9ric?=) Date: Wed, 4 Jun 2008 16:34:18 +0200 (CEST) Subject: [Image-SIG] Anyway to keep ICC profiles intact (e.g. sRGB)? In-Reply-To: <5c58e3ca0806030730idd7442cxace982ea7690cac0@mail.gmail.com> Message-ID: Le 4/6/2008, "Eric Clack" a ?crit: > My knowledge is very limited when it comes to colour profiles, so I might be > describing something that is impossible here, but isn't the colour profile > information just a tag, or piece of metadata that I could copy from image to > image? In most cases, the profile is embedded. I don't now exactly where, but the current PIL version (1.1.6) does not read/write it. It is not stored in the EXIF table. If the profile is not embedded, the image is maybe just tagged (in the EXIF table), but currently, only sRGB as a standard definition there (even if more and more programs use AdobeRGB1998 too, it is not yet a standard). If you want to copy/paste profiles, use exiftool: $ exiftool -icc_profile -b -o profile.dat $ exiftool -icc_profile\<=profile.dat Also note that not all image format can embedded a profile (jpeg, tiff and pdf can). From cgarza at mosso.com Thu Jun 5 00:40:28 2008 From: cgarza at mosso.com (Carlos D. Garza) Date: Wed, 04 Jun 2008 17:40:28 -0500 Subject: [Image-SIG] Trying to build EGG Message-ID: <484719DC.4050904@mosso.com> I am trying to build an egg for PIL 1.1.6 via setuptools and changed the setup.py via the following patch 83a84 > from setuptools import setup 85c86 < from distutils.core import Extension, setup --- > from distutils.core import Extension I build the egg with the command python setup.py bdist_egg and an Egg is build but the namespaces is not being preserved. The file PIL-1.1.6-py2.4-linux-x86_64.egg does not contain a PIL sub directory. IE all the files are expanded flat. Is there some trick to creating an EGG such that I can import it via pkg_resources? IE I am trying to import the packages via a command like from pkg_resources import require require("Imaging") import PIL Does any one have an idea of what might be going wrong? From doko at cs.tu-berlin.de Thu Jun 5 23:30:58 2008 From: doko at cs.tu-berlin.de (Matthias Klose) Date: Thu, 5 Jun 2008 23:30:58 +0200 Subject: [Image-SIG] Sane module with support for numpy? Message-ID: <18504.23314.502246.199649@gargle.gargle.HOWL> The Sane module does use python-numarray in 1.1.6, while pil already can be used with numpy. Is there a port to numpy for the Sane module? thanks, Matthias From eric at bright-interactive.com Wed Jun 4 19:17:27 2008 From: eric at bright-interactive.com (Eric Clack) Date: Wed, 4 Jun 2008 18:17:27 +0100 Subject: [Image-SIG] Anyway to keep ICC profiles intact (e.g. sRGB)? In-Reply-To: References: <5c58e3ca0806030730idd7442cxace982ea7690cac0@mail.gmail.com> Message-ID: <5c58e3ca0806041017i7854f94fq1259c5e687d36eef@mail.gmail.com> Fr?d?ric, that looks to be just what I need :-)-Eric. 2008/6/4 Fr?d?ric : > > Le 4/6/2008, "Eric Clack" a ?crit: > > > My knowledge is very limited when it comes to colour profiles, so I might > be > > describing something that is impossible here, but isn't the colour > profile > > information just a tag, or piece of metadata that I could copy from image > to > > image? > > In most cases, the profile is embedded. I don't now exactly where, but > the current PIL version (1.1.6) does not read/write it. It is not stored > in the EXIF table. > > If the profile is not embedded, the image is maybe just tagged (in the > EXIF table), but currently, only sRGB as a standard definition there > (even if more and more programs use AdobeRGB1998 too, it is not yet a > standard). > > If you want to copy/paste profiles, use exiftool: > > $ exiftool -icc_profile -b -o profile.dat > $ exiftool -icc_profile\<=profile.dat > > Also note that not all image format can embedded a profile (jpeg, tiff > and pdf can). > -- Eric Clack eric at bright-interactive.com Bright Interactive : Successfully delivering interactive websites and business applications http://www.bright-interactive.com/ +44 (0) 1273 201 112 Registered in England No. 3865036. VAT Reg. No. 786 6073 86 Registered Office: 12-13 Ship Street, Brighton, East Sussex, BN1 1AD -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric.germaneau at epfl.ch Thu Jun 5 17:18:28 2008 From: eric.germaneau at epfl.ch (Eric Germaneau) Date: Thu, 05 Jun 2008 17:18:28 +0200 Subject: [Image-SIG] eval & PIL Message-ID: <484803C4.4080808@epfl.ch> Dear PIL users, I make 3d reconstructions from sets of projection. Currently, I'm using a double loop in order to covert each 512x512 pixels of each images. It works but it's slow!! So, I'm wondering whether it's possible to use eval function from the ImageMath module. I do not know how to use it, do you have an example? Thanks in advance, Regards, Eric. -- / Vivre dans la conscience du Tao Se lib?rer du mental / --- Thierry Cha?bli --- Dr. ?ric Germaneau Ecole polytechnique f?d?rale de Lausanne (EPFL) FSB - IPMC Laboratoire de Cristallographie (LCr) BSP 518 CH-1015 Lausanne Switzerland eric.germaneau at epfl.ch /Tel./: +41 (0)21 / 693 06 36 /Fax./: +41 (0)21 / 693 05 04 /msn/: aihaike at hotmail.com /skype/: aihaike / Please consider the environment before printing this email. Consid?rez svp l'environnement avant d'imprimer cet email. / -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists+Image_SIG at hoech.org Fri Jun 6 17:55:03 2008 From: lists+Image_SIG at hoech.org (=?ISO-8859-1?Q?Florian_H=F6ch?=) Date: Fri, 06 Jun 2008 17:55:03 +0200 Subject: [Image-SIG] Patch to access/retain embedded ICC profiles (PIL 1.1.6) In-Reply-To: <5c58e3ca0806011444h63bd686bm8739c68b3698b286@mail.gmail.com> References: <5c58e3ca0806011444h63bd686bm8739c68b3698b286@mail.gmail.com> Message-ID: <48495DD7.8020503@hoech.org> Now there is (but you need to upgrade to PIL 1.1.6 first): http://hoech.net/files/PIL-1.1.6-ICCProfile.zip (this is an updated version of the patch for accessing ICC profiles I posted to the list a while ago) Refer to the included ReadMe for installation/more info. It's a beta, so still needs some testing, but should allow you to: - retain embedded ICC profiles when saving from/to JPEG, PNG, TIFF. Existing code doesn't need to be changed. - access embedded profiles in JPEG, PNG, PSD, TIFF. It also includes patches for TIFF to retain IPTC, Photoshop and XMP metadata when saving as TIFF again, read/write TIFF resolution information correctly, and to correct inverted CMYK JPEG files. For actual color conversions using profiles, you still need an additional library (I recommend ImageCms). Regards, Florian Eric Clack schrieb: > Hi there, > I've been using PIL for some time now and it works very well to rescale > and watermark images, however recently I've noticed that it doesn't > preserve ICC colour profiles. I have this version (from Image.py): > # 2005-03-28 fl PIL release 1.1.5 > > For example: > > import Image > i = "/path/to/input_image.jpg" > o = "/path/to/output_i,age.jpg" > > im = Image.open(i) > im.save(o) > > input_image has the sRGB ICC profile, but now output_image has no > profile (confirmed with photoshop). > > Is there any way to keep the existing profile, or copy it across so that > save saves it? > > Many thanks, > -Eric. > > > ------------------------------------------------------------------------ > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From Chris.Barker at noaa.gov Fri Jun 6 18:13:15 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 06 Jun 2008 09:13:15 -0700 Subject: [Image-SIG] eval & PIL In-Reply-To: <484803C4.4080808@epfl.ch> References: <484803C4.4080808@epfl.ch> Message-ID: <4849621B.7050901@noaa.gov> Eric Germaneau wrote: > Currently, I'm using a double loop in order to covert each 512x512 > pixels of each images. It's hard to know without knowing what you are doing with each pixel, but it's likely that you could use numpy to manipulate the pixels: import numpy as np import PIL.Image as Image i = Image.open('lena.jpg') a = np.asarray(i) Now you can do math with pixels in the array. When you want a PIL image again: i = Image.fromarray(a) -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 frederic.mantegazza at gbiloba.org Fri Jun 6 22:01:11 2008 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric_Mantegazza?=) Date: Fri, 6 Jun 2008 22:01:11 +0200 Subject: [Image-SIG] Patch to access/retain embedded ICC profiles (PIL 1.1.6) In-Reply-To: <48495DD7.8020503@hoech.org> References: <5c58e3ca0806011444h63bd686bm8739c68b3698b286@mail.gmail.com> <48495DD7.8020503@hoech.org> Message-ID: <200806062201.12172.frederic.mantegazza@gbiloba.org> On vendredi 06 juin 2008, Florian H?ch wrote: > Now there is (but you need to upgrade to PIL 1.1.6 first): Great! I really hope this patch will be in the next PIL release... > For actual color conversions using profiles, you still need an > additional library (I recommend ImageCms). :o) -- Fr?d?ric http://www.gbiloba.org From 2008 at pietrosperoni.it Wed Jun 11 12:33:50 2008 From: 2008 at pietrosperoni.it (Pietro Speroni di Fenizio) Date: Wed, 11 Jun 2008 11:33:50 +0100 Subject: [Image-SIG] PIL on intel based Mac not compiling Message-ID: Hello, my name is Pietro Speroni and I am a postdoc at Dublin City University. Working on making a program to study the evolution of bitstrings. My computer is a Mac Book Air, Intel, Leopard. I am producing some data with matplot lib, and showing it with tkinter. All this is ok for the text data. But I am having difficulties with the images: tkinter takes only gif, matplotlib stores in various formats (png, jpg, eps,...), but gif is not one of them. Everywhere I look I always find references to the PIL as the library I should use. But the PIL is not part of python release. And more it is only available for windows. For Mac OSX (and Linux, Unix,...) we are givent the source files. After installing the XCode I finally managed to have gcc in the Mac. And as I tried to install the PIL I received the answer that: gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-i386-2.5/_imagingft.o -L/sw/lib -L/usr/local/lib -L/Library/Frameworks/Python.framework/Versions/2.5/lib -L/usr/lib -lfreetype -o build/lib.macosx-10.3-i386-2.5/_imagingft.so ld: in /sw/lib/libiconv.2.dylib, file is not of required architecture for architecture i386 collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/NO/NOLXufVKFVKFoItorBKaUE+++TI/-Tmp-//ccc9vVQJ.out (No such file or directory) error: command 'gcc' failed with exit status 1 So, now what? It sounds like the source code are not going to work for intel based Macs. Is there any way in which I can have the PIL installed on the Leopard? Will there be a future Python release with PIL as a standard module? Any help would be greatly appreciated. Many thanks, Pietro From janssen at parc.com Wed Jun 11 18:28:32 2008 From: janssen at parc.com (Bill Janssen) Date: Wed, 11 Jun 2008 09:28:32 PDT Subject: [Image-SIG] PIL on intel based Mac not compiling In-Reply-To: References: Message-ID: <08Jun11.092837pdt."58698"@synergy1.parc.xerox.com> Hi, Pietro. I build PIL from source on Leopard all the time (usually once per day), without any problems. Your problem seems to be that you are using Fink (/sw): ld: in /sw/lib/libiconv.2.dylib, file is not of required architecture My advice is to remove the /sw directory, and stop using Fink; it just confuses things on the Mac. While it was a good idea 4 or 5 years ago, it's mostly unnecessary now. Bill From Chris.Barker at noaa.gov Wed Jun 11 20:03:26 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 11 Jun 2008 11:03:26 -0700 Subject: [Image-SIG] PIL on intel based Mac not compiling In-Reply-To: References: Message-ID: <4850136E.2010300@noaa.gov> Pietro Speroni di Fenizio wrote: > I am producing some data with matplot lib, and showing it with > tkinter. All this is ok for the text data. But I am having > difficulties with the images: > tkinter takes only gif, > matplotlib stores in various formats (png, jpg, eps,...), but gif is > not one of them. If you are trying to put a MPL plot in a TK app, Matplotlib can do that directly -- no need to go through files, GIF or otherwise. Also, I'm not a TK user, but it seems very odd that GIF is the only format it understands -- with the patent issues around it, I"d think it would be the last choice for a single format. All that being said, if you want PIL on OS_X, get it here: http://www.pythonmac.org/packages/ (I thought that package was going to go up on the PIL download site, but I guess not yet) I suppose this is a good reminder to re-invigorate my effort to write a script to build PIL binaries on OS-X... -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 gwidion at mpc.com.br Thu Jun 12 02:42:46 2008 From: gwidion at mpc.com.br (Joao S. O. Bueno) Date: Wed, 11 Jun 2008 21:42:46 -0300 Subject: [Image-SIG] PIL on intel based Mac not compiling In-Reply-To: <4850136E.2010300@noaa.gov> References: <4850136E.2010300@noaa.gov> Message-ID: <200806112142.46403.gwidion@mpc.com.br> On Wednesday 11 June 2008, Christopher Barker wrote: > with the patent issues around it, I"d think it > would be the last choice for a single format. Just clarifying this little bit: patent issues for gif are _no more_. The patents expired some years ago. Software patentes are a lot bad already without misinformation spreading around - so I am writing this. Having set that aside, .gif is also technically inferior to .png in indexed mode. js -><- From 2008 at pietrosperoni.it Thu Jun 12 13:21:56 2008 From: 2008 at pietrosperoni.it (Pietro Speroni di Fenizio) Date: Thu, 12 Jun 2008 12:21:56 +0100 Subject: [Image-SIG] PIL on intel based Mac not compiling In-Reply-To: <4850136E.2010300@noaa.gov> References: <4850136E.2010300@noaa.gov> Message-ID: Hi Christopher. > > If you are trying to put a MPL plot in a TK app, Matplotlib can do that > directly -- no need to go through files, GIF or otherwise. But how? How?? I keep on reading that it is possible, but I never find the 3 lines of code that explains how. It is probably too obvious to explain it, but it is missing both in matplotlib tutorials, and in Tk tutorials (at least I could not find it). There are some obscure references that should be done through backends. But then no explenations are given on how to install, import, activate, command and get obeyed by them (whatever they are). Even wikipedia has only few lines on backend, and the matplotlib page on backend ( http://matplotlib.sourceforge.net/backends.html ) isn't very explicit on how to actually use them. You know just 5 lines of code of a simple program that imports all that is necessary, makes a figure with a simple graph, and then shows it in a simple widget with only that as a label or similar would go a long way. FOr now I can just save the file, and reload it, but I am planning to make much better interactive tools to study CA (cellular automaton), and then I would really need to be able to interact with Tk in a graphical way. Thanks if you (or anyone else) can help on this. > > Also, I'm not a TK user, but it seems very odd that GIF is the only format > it understands -- with the patent issues around it, I"d think it would be > the last choice for a single format. > > All that being said, if you want PIL on OS_X, get it here: > > http://www.pythonmac.org/packages/ Thanks! Just downloaded! > > (I thought that package was going to go up on the PIL download site, but I > guess not yet) > > I suppose this is a good reminder to re-invigorate my effort to write a > script to build PIL binaries on OS-X... Now that would be greatly appreciated. As you know more and more of the academic world is using python, using mac, using matplot. SO having PIL available would be really good. Can you guys not get it as part of the standard python installation? Thanks again, Pietro > > -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 > -- Dr. Pietro Speroni di Fenizio, Post Doc at Artificial Life Laboratory Research Institute in Networks & Communications Engineering (RINCE) Dublin City University Home Page: http://www.pietrosperoni.it Mobile:(Ireland) +353 (87) 7409708 (new) Mobile (Italy): +39 (333) 1694290 Work phone: Tel.: +353-1-700-7696 Home Address: Pietro Speroni di Fenizio C/O MBE 547 - BOX 304 Via Della Scrofa 16 00186, Roma Italy From 2008 at pietrosperoni.it Thu Jun 12 13:24:57 2008 From: 2008 at pietrosperoni.it (Pietro Speroni di Fenizio) Date: Thu, 12 Jun 2008 12:24:57 +0100 Subject: [Image-SIG] PIL on intel based Mac not compiling In-Reply-To: <-6634034980178940956@unknownmsgid> References: <-6634034980178940956@unknownmsgid> Message-ID: Hi Bill, On Wed, Jun 11, 2008 at 5:28 PM, Bill Janssen wrote: > Hi, Pietro. > > I build PIL from source on Leopard all the time (usually once per > day), without any problems. > > Your problem seems to be that you are using Fink (/sw): > > ld: in /sw/lib/libiconv.2.dylib, file is not of required architecture > > My advice is to remove the /sw directory, and stop using Fink; it just > confuses things on the Mac. While it was a good idea 4 or 5 years ago, > it's mostly unnecessary now. This is very interesting because I do not have fink on this machine. But I use to have it in the previous one, a Tiger, and then I imported all the inside with the Time Machine when I bought this machine. You are absolutely right, I will remove the directory, and get rid of all the Fink I still had. Thanks, Pietro -- Dr. Pietro Speroni di Fenizio, Post Doc at Artificial Life Laboratory Research Institute in Networks & Communications Engineering (RINCE) Dublin City University Home Page: http://www.pietrosperoni.it Mobile:(Ireland) +353 (87) 7409708 (new) Mobile (Italy): +39 (333) 1694290 Work phone: Tel.: +353-1-700-7696 Home Address: Pietro Speroni di Fenizio C/O MBE 547 - BOX 304 Via Della Scrofa 16 00186, Roma Italy From janssen at parc.com Thu Jun 12 17:21:03 2008 From: janssen at parc.com (Bill Janssen) Date: Thu, 12 Jun 2008 08:21:03 PDT Subject: [Image-SIG] PIL on intel based Mac not compiling In-Reply-To: <4850136E.2010300@noaa.gov> References: <4850136E.2010300@noaa.gov> Message-ID: <08Jun12.082106pdt."58698"@synergy1.parc.xerox.com> > I suppose this is a good reminder to re-invigorate my effort to write a > script to build PIL binaries on OS-X... On that topic -- I'd love to have PIL using the hardware acceleration on my Mac, the way that numpy does, out of the box. To do this, we'd have to re-write parts of the PIL C code to (optionally, of course) use CoreGraphics, though. Bill From Chris.Barker at noaa.gov Thu Jun 12 18:45:56 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 12 Jun 2008 09:45:56 -0700 Subject: [Image-SIG] PIL on intel based Mac not compiling In-Reply-To: References: <4850136E.2010300@noaa.gov> Message-ID: <485152C4.7040706@noaa.gov> Pietro Speroni di Fenizio wrote: >> If you are trying to put a MPL plot in a TK app, Matplotlib can do that >> directly -- no need to go through files, GIF or otherwise. > > But how? How?? This is really a question for the matplotlib list, but here's a short explanation: Matplotlib can use a number of "back-ends". These are the parts that do the actual rendering. The some of the options are: TkInter, pyGTK, wxPython, Agg, pyQT, PDF, PS, etc. > But then no explanations are given on > how to install, TkInter is probably installed by default. > activate, command and get obeyed by them The default back end is set in your .matplotlibrc file. Alternately, you can set it at runtime like so: import matplotlib matplotlib.use('TkAgg') then you can do import pylab etc, and tk will be used. > I would really need to be able to interact with > Tk in a graphical way. What you want is to embed MPL in a Tk app. To see how to do this, take a look at the examples: user_interfaces/embedding_in_tk* The examples can be downloaded as a zip file from the main MPL web site: http://matplotlib.sourceforge.net/ direct further questions to the MPL list: https://lists.sourceforge.net/lists/listinfo/matplotlib-users -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 stefan at musicpictures.com Fri Jun 13 19:08:09 2008 From: stefan at musicpictures.com (Stefan Bethge) Date: Fri, 13 Jun 2008 19:08:09 +0200 Subject: [Image-SIG] IPTC write support in PIL, someone working on that? Message-ID: <20080613190809.5d7d3492@hugin> Hi everyone, If I have not overlooked something, PIL still only reads iptc data from jpeg files. Since we use PIL for a number of things for musicpictures.com and since writing iptc data would be a nice thing to have we thought of adding it. This means that methods like Image.save could automatically add metadata again so the user doesn't have to worry. I'm not sure if that is the right way to do it, but I guess the JpegImagePlugin would use the IptcImagePlugin which will get a new save method. Then when opening an image with metadata, it will be added to the image object and saved with the image data on save. Maybe someone can tell me if that's the alright or what is a better way to do it. Thanks, Stefan Musicpictures Ltd. From gandalf at shopzeus.com Fri Jun 13 13:29:56 2008 From: gandalf at shopzeus.com (Laszlo Nagy) Date: Fri, 13 Jun 2008 13:29:56 +0200 Subject: [Image-SIG] TrueType font encoding (re-post) Message-ID: <48525A34.7040107@shopzeus.com> This is a re-post. I did this re-post because nobody knew the answer to my original one, which was about a month ago. In the worst case I'm going to give up working with PIL and migrate to something that does not have this bug and will not post again. I hope you forgive me. Example program "test.py" is attached . The font (cartoon.ttf) and output of the program (test.png) is attached. Also "with_gimp.png" is attached that shows the same thing created in Gimp with the same ttf file. The obvious problem is that PIL puts "u" instead of "?". Fredrik Lundh told me that PIL and Gimp are using the same engine for rendering fonts, so probably the problem is not with font rendering, and of course not with the ttf file. He also told me that the encoding parameter of ImageFont.truetype is ignored unless it is exactly four characters. Does anybody know how to solve the problem? Thanks, Laszlo -------------- next part -------------- A non-text attachment was scrubbed... Name: cartoon.ttf Type: application/x-font-ttf Size: 95588 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.png Type: image/png Size: 9118 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.py Type: text/x-python Size: 412 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: with_gimp.png Type: image/png Size: 6270 bytes Desc: not available URL: From haase at msg.ucsf.edu Sun Jun 15 09:08:22 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Sun, 15 Jun 2008 09:08:22 +0200 Subject: [Image-SIG] TrueType font encoding (re-post) In-Reply-To: <48525A34.7040107@shopzeus.com> References: <48525A34.7040107@shopzeus.com> Message-ID: Hi Laszlo , (sorry I can not help you) just curious, what would you be using instead of PIL ? And, when did Fredrik Lundh tell you this ? Thanks, Sebastian Haase 2008/6/13 Laszlo Nagy : > This is a re-post. I did this re-post because nobody knew the answer to my > original one, which was about a month ago. In the worst case I'm going to > give up working with PIL and migrate to something that does not have this > bug and will not post again. I hope you forgive me. > > Example program "test.py" is attached . > > The font (cartoon.ttf) and output of the program (test.png) is attached. > Also "with_gimp.png" is attached that shows the same thing created in Gimp > with the same ttf file. The obvious problem is that PIL puts "u" instead of > "?". > > Fredrik Lundh told me that PIL and Gimp are using the same engine for > rendering fonts, so probably the problem is not with font rendering, and of > course not with the ttf file. He also told me that the encoding parameter of > ImageFont.truetype is ignored unless it is exactly four characters. > > Does anybody know how to solve the problem? > > Thanks, > > Laszlo > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From cat at vv.carleton.ca Mon Jun 16 07:46:27 2008 From: cat at vv.carleton.ca (Catalin Patulea) Date: Mon, 16 Jun 2008 01:46:27 -0400 Subject: [Image-SIG] [PATCH] Make Win32 ImageGrab work with multiple monitors Message-ID: <9664a4720806152246rd93e930n5744f8658c746fa7@mail.gmail.com> Hi Image-SIG, PIL very nicely supports taking screen shots in Win32. Unfortunately, for a user with multiple monitors such as myself, only the primary monitor is captured. The attached patch, against 1.1.6, makes ImageGrab capture the entire virtual screen, spanning all enabled monitors. I have tested this with two (differently-sized) monitors. Thanks, Catalin Patulea -------------- next part -------------- A non-text attachment was scrubbed... Name: Imaging-1.1.6-vres.diff Type: text/x-diff Size: 1350 bytes Desc: not available URL: From gandalf at shopzeus.com Mon Jun 16 12:37:54 2008 From: gandalf at shopzeus.com (Laszlo Nagy) Date: Mon, 16 Jun 2008 12:37:54 +0200 Subject: [Image-SIG] TrueType font encoding (re-post) In-Reply-To: References: <48525A34.7040107@shopzeus.com> Message-ID: <48564282.70803@shopzeus.com> Sebastian Haase wrote: > Hi Laszlo , > (sorry I can not help you) > just curious, what would you be using instead of PIL ? > reportlab or pycairo Not decided yet. My program prints out small images on a printer, I do not really need to render an raster image, PDF would also be fine. > And, when did Fredrik Lundh tell you this ? > He replied to my first post in private. It was about a month ago. I also got a private response from somebody called Nicolas Pinault with this: > I have not found a solution to your problem. I think the problem is in > _imagingft service. > In ImageFont.py module, FreeTypeFont class, getmask2 method : > Replace > im = fill("L", size, 0) > by > im = fill("L", size, 128) > > Run your testcase. You can see that the text is located at the top of > the rendered window. > I guess that it should be located at the bottom of the rendered window > leaving space for the missing upper part of the font. > Unfortunately _imagingft service in not written in Python. So the > investigation is not as easy as with modules written in Python. I think he is right. Unfortunately, I do not know C well enough to fix/debug the problem. Thanks, Laszlo From keith.briggs at bt.com Mon Jun 16 14:09:58 2008 From: keith.briggs at bt.com (keith.briggs at bt.com) Date: Mon, 16 Jun 2008 13:09:58 +0100 Subject: [Image-SIG] PIL documentation error Message-ID: > Image.crop: > Returns a rectangular region from the current image. The box is a 4-tuple defining the left, upper, right, and lower pixel coordinate. I think this should be "left, lower, right, upper". Keith From haase at msg.ucsf.edu Mon Jun 16 23:03:34 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Mon, 16 Jun 2008 23:03:34 +0200 Subject: [Image-SIG] TrueType font encoding (re-post) In-Reply-To: <48564282.70803@shopzeus.com> References: <48525A34.7040107@shopzeus.com> <48564282.70803@shopzeus.com> Message-ID: Hi Laszlo , thanks for the reply -- it's interesting to see how often public questions get answered privately .... [ :-( ] Have you heard about pyx ? http://pyx.sourceforge.net If you don't need pixels, this is maybe what you want .... don't know it if needs Latex though .... -Sebastian On Mon, Jun 16, 2008 at 12:37 PM, Laszlo Nagy wrote: > Sebastian Haase wrote: >> >> Hi Laszlo , >> (sorry I can not help you) >> just curious, what would you be using instead of PIL ? >> > > reportlab or pycairo Not decided yet. My program prints out small images on > a printer, I do not really need to render an raster image, PDF would also be > fine. >> >> And, when did Fredrik Lundh tell you this ? >> > > He replied to my first post in private. It was about a month ago. > > I also got a private response from somebody called Nicolas Pinault with > this: > >> I have not found a solution to your problem. I think the problem is in >> _imagingft service. >> In ImageFont.py module, FreeTypeFont class, getmask2 method : >> Replace >> im = fill("L", size, 0) >> by >> im = fill("L", size, 128) >> >> Run your testcase. You can see that the text is located at the top of the >> rendered window. >> I guess that it should be located at the bottom of the rendered window >> leaving space for the missing upper part of the font. >> Unfortunately _imagingft service in not written in Python. So the >> investigation is not as easy as with modules written in Python. > > I think he is right. Unfortunately, I do not know C well enough to fix/debug > the problem. > > Thanks, > > Laszlo > > From languitar at semipol.de Mon Jun 16 23:17:52 2008 From: languitar at semipol.de (Johannes Wienke) Date: Mon, 16 Jun 2008 23:17:52 +0200 Subject: [Image-SIG] TrueType font encoding (re-post) In-Reply-To: References: <48525A34.7040107@shopzeus.com> <48564282.70803@shopzeus.com> Message-ID: <4856D880.8040606@semipol.de> Am 06/16/2008 11:03 PM schrieb Sebastian Haase: > thanks for the reply -- it's interesting to see how often public > questions get answered privately .... [ :-( ] Well, to my mind that's also a problem of the settings this list uses. Other mailing lists use the list address as sender and you can easily forget to use "answer all". Johannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 260 bytes Desc: OpenPGP digital signature URL: From mail at karsten.name Tue Jun 17 01:25:30 2008 From: mail at karsten.name (Karsten Hiddemann) Date: Tue, 17 Jun 2008 01:25:30 +0200 Subject: [Image-SIG] TrueType font encoding (re-post) In-Reply-To: <4856D880.8040606@semipol.de> References: <48525A34.7040107@shopzeus.com> <48564282.70803@shopzeus.com> <4856D880.8040606@semipol.de> Message-ID: <4856F66A.5020306@karsten.name> Johannes Wienke schrieb: > Am 06/16/2008 11:03 PM schrieb Sebastian Haase: >> thanks for the reply -- it's interesting to see how often public >> questions get answered privately .... [ :-( ] > > Well, to my mind that's also a problem of the settings this list uses. > Other mailing lists use the list address as sender and you can easily > forget to use "answer all". Yeah, same here, it's happened to me before and to others that replied to posts from me. It's certainly not uncommon. From gsnarayan at gmail.com Tue Jun 17 19:48:42 2008 From: gsnarayan at gmail.com (Gautham Narayan) Date: Tue, 17 Jun 2008 13:48:42 -0400 Subject: [Image-SIG] Image.crop with bbox off image Message-ID: <20d04d890806171048o149210e3i73f126e1accdf0ae@mail.gmail.com> I'm having trouble understanding the behaviour of Image.crop (PIL 1.1.6 w/ python 2.5.1) when the bbox is outside the limits of the image. So something like, b = a.crop(x1,y1,x2,y2) with x1 and y1 < 0 say. Sometimes I get a purely black border (which is good), sometimes I get the image edges and patterns that are not in the image beyond. Is there some way I can specify a crop that is off the image in at least one coordinate and consistently have the region that is off the image padded with 0s? Otherwise is there another alternative to checking if the bbox is off the image and setting the remaining values to zero? >>> import Image >>> a=Image.open("work/screen/defaults/illumination5.bmp") >>> a.crop((-100,-100,10,10)).show() #The above has a pure black border >>> a.crop((-500,-200,10,10)).show() >>> a.crop((-500,-400,50,10)).show() #These above two do not >>> print a.__dict__ {'info': {'compression': 0}, 'category': 0, 'palette': None, 'decoderconfig': (), 'map': , 'filename': 'work/screen/defaults/illumination5.bmp', 'fp': None, 'readonly': 1, 'im': , 'mode': 'L', 'decodermaxblock': 65536, 'tile': [], 'size': (1000, 1000)} The file itself is a simple 1000x1000 image off a gaussian fall off but the same behaviour happens with any image I try, irrespective of dimensions and content. Thanks! Cheers, -Gautham From ktenney at gmail.com Wed Jun 18 16:31:52 2008 From: ktenney at gmail.com (Kent Tenney) Date: Wed, 18 Jun 2008 09:31:52 -0500 Subject: [Image-SIG] tEXt chunks Message-ID: Howdy, PIL can read and write tEXt and zEXt chunks, however they are not preserved by default open and save. Is there interest in PIL preserving optional chunk types? Thanks, Kent From thomaswylie at btinternet.com Thu Jun 19 20:17:57 2008 From: thomaswylie at btinternet.com (Tom Wylie) Date: Thu, 19 Jun 2008 19:17:57 +0100 Subject: [Image-SIG] Please help... I'm desperate Message-ID: I want to install Pil but I keep getting the following error: ld: in /sw/lib/libxml2.2.dylib, file is not of required architecture for architecture ppc collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/wT/wTgnmehRGomxhfpWK-Da7E++ +TI/-Tmp-//ccCSnIQc.out (No such file or directory) error: command 'gcc' failed with exit status 1 Macintosh:Imaging-1.1.6 tomwylie$ Any ideas? Please??? Thanks, Tom From Chris.Barker at noaa.gov Thu Jun 19 21:38:15 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 19 Jun 2008 12:38:15 -0700 Subject: [Image-SIG] Please help... I'm desperate In-Reply-To: References: Message-ID: <485AB5A7.1080708@noaa.gov> Tom Wylie wrote: > I want to install Pil but I keep getting the following error: you need to tell us OS, Python version, how you are trying to install it, etc, etc. > ld: in /sw/lib/libxml2.2.dylib, file is not of required architecture for however, this looks like an OS-X issue. > Any ideas? Please??? 1) Use the Python2.5 you get from python org. 2) Install PIL from here: http://pythonmac.org/packages/py25-fat/index.html -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 janssen at parc.com Thu Jun 19 23:10:35 2008 From: janssen at parc.com (Bill Janssen) Date: Thu, 19 Jun 2008 14:10:35 PDT Subject: [Image-SIG] Please help... I'm desperate In-Reply-To: <485AB5A7.1080708@noaa.gov> References: <485AB5A7.1080708@noaa.gov> Message-ID: <08Jun19.141044pdt."58698"@synergy1.parc.xerox.com> Tom, We just answered this on this list a few weeks ago. This is not an OS X "problem". You do not need to install a different Python. Installing PIL from pythonmac.org may or may not help; I personally distrust using pre-packaged repositories that depend on non-Apple Python unless you know what you're doing (and you don't). Your problem is that you are using Fink; my advice is to remove the whole /sw tree, and rid yourself of dependence on Fink. Once you've removed Fink, PIL installs just fine with: sudo python setup.py install Bill > Tom Wylie wrote: > > I want to install Pil but I keep getting the following error: > > you need to tell us OS, Python version, how you are trying to install > it, etc, etc. > > > > ld: in /sw/lib/libxml2.2.dylib, file is not of required architecture for > > however, this looks like an OS-X issue. > > > Any ideas? Please??? > > 1) Use the Python2.5 you get from python org. > > 2) Install PIL from here: > > http://pythonmac.org/packages/py25-fat/index.html > > > -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 Chris.Barker at noaa.gov Fri Jun 20 01:55:18 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 19 Jun 2008 16:55:18 -0700 Subject: [Image-SIG] Please help... I'm desperate In-Reply-To: <08Jun19.141044pdt.58698@synergy1.parc.xerox.com> References: <485AB5A7.1080708@noaa.gov> <08Jun19.141044pdt.58698@synergy1.parc.xerox.com> Message-ID: <485AF1E6.4020002@noaa.gov> Bill Janssen wrote: > We just answered this on this list a few weeks ago. yes, it was. > This is not an OS X "problem". Well, yes and no. If you think of OS-X as the whole ecosystem surrounding it, then yes, it is an OS-X problem -- the problem is that that there are very many ways to build and install python and the various dependencies and packages on OS-X, and they are often incompatible. This is caused (at least somewhat) by the nature of OS-X itself: 1) It does things just enough differently than other *nix systems, so people have to roll a new version (fink, macports, etc) 2) it now available for two different architectures with "universal" binaries as an option. > You do not need to install a different Python. > Installing PIL from pythonmac.org may or may not help; Actually it pretty much always will help, at least if we can keep those packages up to date -- they work. They work with the version of python they are advertised to work with, they install in the right place, and they include all their dependencies -- what exactly do you need to know to use them? the problem is building them -- that you do need to know what you are doing to do. > I personally > distrust using pre-packaged repositories that depend on non-Apple > Python unless you know what you're doing (and you don't). come on -- you need to know what you are doing far more to build your own. I've seen your build scripts! And I'm a lot more distrustful of using Apple's Python -- among other things, we can be pretty sure it will never be updated, and you can't update it yourself. I've recently been bitten by a bug in 2.5.1 that has been fixed for 2.5.2. If I was using Apple's Python, exactly what would my options be? Not to mention all the out of date packages Apple has provided. The python.org python does not get in the way of or interact with Apple's python. Aside from having to download it (and disk space), there is no reason not to use it. > Your problem is that you are using Fink; my advice is to remove the > whole /sw tree, and rid yourself of dependence on Fink. Well, that I agree with, but if you're using Fink for something else, that's not a great option. I do think that NO python distutils scripts should look for stuff in /sw by default. > Once you've removed Fink, PIL installs just fine with: > > sudo python setup.py install Only if you've got the dependencies installed properly. And I'll bet if you google to figure out how to do that, there's good chance you'll try to use Fink (or macports)! Sorry for the ranting, but the truth is that OS-X is almost like Linux, but not quite -- it's just not that easy to build stuff yourself, particularly for the typical Mac user. It's more like Windows, and almost every python extension distributes pre-build binaries for Windows. It would be nice if we could do that same for the Mac. And supporting the python.org python is the easiest way to do that. -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 cat at vv.carleton.ca Fri Jun 20 01:53:55 2008 From: cat at vv.carleton.ca (Catalin Patulea) Date: Thu, 19 Jun 2008 19:53:55 -0400 Subject: [Image-SIG] [PATCH] Make Win32 ImageGrab work with multiple monitors In-Reply-To: <9664a4720806152246rd93e930n5744f8658c746fa7@mail.gmail.com> References: <9664a4720806152246rd93e930n5744f8658c746fa7@mail.gmail.com> Message-ID: <9664a4720806191653v650b3009tbeb196837ab7367a@mail.gmail.com> Ping. On Mon, Jun 16, 2008 at 1:46 AM, Catalin Patulea wrote: > Hi Image-SIG, > > PIL very nicely supports taking screen shots in Win32. Unfortunately, > for a user with multiple monitors such as myself, only the primary > monitor is captured. > > The attached patch, against 1.1.6, makes ImageGrab capture the entire > virtual screen, spanning all enabled monitors. > > I have tested this with two (differently-sized) monitors. > > Thanks, > > Catalin Patulea > From haase at msg.ucsf.edu Fri Jun 20 03:09:51 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Fri, 20 Jun 2008 03:09:51 +0200 Subject: [Image-SIG] [PATCH] Make Win32 ImageGrab work with multiple monitors In-Reply-To: <9664a4720806191653v650b3009tbeb196837ab7367a@mail.gmail.com> References: <9664a4720806152246rd93e930n5744f8658c746fa7@mail.gmail.com> <9664a4720806191653v650b3009tbeb196837ab7367a@mail.gmail.com> Message-ID: Hi Catalin, don't put up your hopes ..... It seems there is a long list of not-yet-included patches .... I think the situation is getting out of hand ? Others ? Comments ? Don't misunderstand me -- I'm very thankful for PIL ! I would be much worse off without it !! -Sebastian Haase PS: Please change the mailing list settings so that default-replies go to the list ... On Fri, Jun 20, 2008 at 1:53 AM, Catalin Patulea wrote: > Ping. > > On Mon, Jun 16, 2008 at 1:46 AM, Catalin Patulea wrote: >> Hi Image-SIG, >> >> PIL very nicely supports taking screen shots in Win32. Unfortunately, >> for a user with multiple monitors such as myself, only the primary >> monitor is captured. >> >> The attached patch, against 1.1.6, makes ImageGrab capture the entire >> virtual screen, spanning all enabled monitors. >> >> I have tested this with two (differently-sized) monitors. >> >> Thanks, >> >> Catalin Patulea >> > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From buckleybruceb at gmail.com Fri Jun 20 10:24:25 2008 From: buckleybruceb at gmail.com (Bruce B. Buckley) Date: Fri, 20 Jun 2008 03:24:25 -0500 Subject: [Image-SIG] PIL ImageGrab with multi-monitors. Message-ID: <000b01c8d2af$0e030d90$6501a8c0@PS3> I have recently been using PIL 1.1.6 for Python 2.5, with MS Windows XP Pro, and the ImageGrab module works fine with my Tkinter application, with one exception, as follows: The built-in driver used 1) grabber = Image.core.grabscreen 2) size, data = grabber() returns the monitor size (in my case of 1920,1200), but always defaults to the first monitor-0. Since up to five multiple monitors will be used, my application needs to be able to grab a cropped image from whichever monitor is specified. As far as I can tell, only access to monitor-0 is provided as the default, with no other options available. I have no problem programmatically creating and moving Tkinter windows to any screen, as MS Windows and Tcl/Tk support multiple monitors. Since PIL has been available for years, and multi-monitors are quite common now, I am surprised that the "grab" feature seems to be still limited to one monitor. Fredrik Lundh has provided a powerful and comprehensive package, so there is a good chance that it can do what I want, and that I may be overlooking some aspect of the system. I hope my assessment is wrong, and, of course, any help or other comments will be greatly appreciated. B.B.Buckley From haase at msg.ucsf.edu Fri Jun 20 09:50:24 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Fri, 20 Jun 2008 09:50:24 +0200 Subject: [Image-SIG] Fwd: [PATCH] Make Win32 ImageGrab work with multiple monitors In-Reply-To: References: <9664a4720806152246rd93e930n5744f8658c746fa7@mail.gmail.com> <9664a4720806191653v650b3009tbeb196837ab7367a@mail.gmail.com> Message-ID: Bruce, did you read this ? Was today on this list ...... -S. ---------- Forwarded message ---------- From: Sebastian Haase Date: Fri, Jun 20, 2008 at 3:09 AM Subject: Re: [Image-SIG] [PATCH] Make Win32 ImageGrab work with multiple monitors To: Image-SIG at python.org Hi Catalin, don't put up your hopes ..... It seems there is a long list of not-yet-included patches .... I think the situation is getting out of hand ? Others ? Comments ? Don't misunderstand me -- I'm very thankful for PIL ! I would be much worse off without it !! -Sebastian Haase PS: Please change the mailing list settings so that default-replies go to the list ... On Fri, Jun 20, 2008 at 1:53 AM, Catalin Patulea wrote: > Ping. > > On Mon, Jun 16, 2008 at 1:46 AM, Catalin Patulea wrote: >> Hi Image-SIG, >> >> PIL very nicely supports taking screen shots in Win32. Unfortunately, >> for a user with multiple monitors such as myself, only the primary >> monitor is captured. >> >> The attached patch, against 1.1.6, makes ImageGrab capture the entire >> virtual screen, spanning all enabled monitors. >> >> I have tested this with two (differently-sized) monitors. >> >> Thanks, >> >> Catalin Patulea >> > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From spe.stani.be at gmail.com Fri Jun 20 10:24:07 2008 From: spe.stani.be at gmail.com (Stani) Date: Fri, 20 Jun 2008 10:24:07 +0200 Subject: [Image-SIG] Patch repository for PIL (was Re: [PATCH] Make Win32 ImageGrab work with multiple monitors) In-Reply-To: References: <9664a4720806152246rd93e930n5744f8658c746fa7@mail.gmail.com> <9664a4720806191653v650b3009tbeb196837ab7367a@mail.gmail.com> Message-ID: <1213950247.14643.25.camel@blue> Op vrijdag 20-06-2008 om 03:09 uur [tijdzone +0200], schreef Sebastian Haase: > Hi Catalin, > > don't put up your hopes ..... It seems there is a long list of > not-yet-included patches .... There are and they are not archived in a structured way. You have to Google or dig through the archives of this mailing list, which is inefficient at least. > I think the situation is getting out of hand ? Right now I solve it by shipping my own patched PIL with my applications, but this is not an ideal solution. New patches appear from time to time and it is hard to keep up. > > Others ? Comments ? > > Don't misunderstand me -- I'm very thankful for PIL ! I would be much > worse off without it !! Me too and I guess that is true for everyone on this list. PIL follows the successful model of open source (just like python, ubuntu, ...): having a benevolent dictator in charge. I'd like to thank ?Fredrik Lundh for the amazing work he is doing on PIL. However what is missing is a platform which enables collaborative input. Right now some patches get accepted, while others get ignored without any statement. This opaqueness is far from ideal, but I can live with it. (I would never want to claim what somebody has to do in his free time.) However I do feel the need to create for example a launchpad page where all patches can be submitted, tested & reviewed by other pil users and where you can see the popularity of a patch by the amount of people who subscribed to it. Even if this launchpad page is unofficial and maintained by the PIL users/community, I would think this would also save some work load for ?Fredrik Lundh as he can benefit from the tests and reviews by other people. In the case where patches are not accepted by him in a new release, the community could update the patch to the new version. This is just a humble proposal. ?Fredrik, in case you have a proposal which would suit you better just let us know. I will be happy to follow it. What do other people think? Stani http://photobatch.stani.be > -Sebastian Haase > > PS: Please change the mailing list settings so that default-replies go > to the list ... > > > On Fri, Jun 20, 2008 at 1:53 AM, Catalin Patulea wrote: > > Ping. > > > > On Mon, Jun 16, 2008 at 1:46 AM, Catalin Patulea wrote: > >> Hi Image-SIG, > >> > >> PIL very nicely supports taking screen shots in Win32. Unfortunately, > >> for a user with multiple monitors such as myself, only the primary > >> monitor is captured. > >> > >> The attached patch, against 1.1.6, makes ImageGrab capture the entire > >> virtual screen, spanning all enabled monitors. > >> > >> I have tested this with two (differently-sized) monitors. > >> > >> Thanks, > >> > >> Catalin Patulea > >> > > _______________________________________________ > > Image-SIG maillist - Image-SIG at python.org > > http://mail.python.org/mailman/listinfo/image-sig > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From haase at msg.ucsf.edu Fri Jun 20 23:44:44 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Fri, 20 Jun 2008 23:44:44 +0200 Subject: [Image-SIG] Patch repository for PIL (was Re: [PATCH] Make Win32 ImageGrab work with multiple monitors) In-Reply-To: <1213950247.14643.25.camel@blue> References: <9664a4720806152246rd93e930n5744f8658c746fa7@mail.gmail.com> <9664a4720806191653v650b3009tbeb196837ab7367a@mail.gmail.com> <1213950247.14643.25.camel@blue> Message-ID: On Fri, Jun 20, 2008 at 10:24 AM, Stani wrote: > Op vrijdag 20-06-2008 om 03:09 uur [tijdzone +0200], schreef Sebastian > Haase: >> Hi Catalin, >> >> don't put up your hopes ..... It seems there is a long list of >> not-yet-included patches .... > There are and they are not archived in a structured way. You have to > Google or dig through the archives of this mailing list, which is > inefficient at least. > >> I think the situation is getting out of hand ? > Right now I solve it by shipping my own patched PIL with my > applications, but this is not an ideal solution. New patches appear from > time to time and it is hard to keep up. >> >> Others ? Comments ? >> >> Don't misunderstand me -- I'm very thankful for PIL ! I would be much >> worse off without it !! > Me too and I guess that is true for everyone on this list. PIL follows > the successful model of open source (just like python, ubuntu, ...): > having a benevolent dictator in charge. I'd like to thank ?Fredrik Lundh > for the amazing work he is doing on PIL. > > However what is missing is a platform which enables collaborative input. > Right now some patches get accepted, while others get ignored without > any statement. This opaqueness is far from ideal, but I can live with > it. (I would never want to claim what somebody has to do in his free > time.) However I do feel the need to create for example a launchpad page > where all patches can be submitted, tested & reviewed by other pil users > and where you can see the popularity of a patch by the amount of people > who subscribed to it. Even if this launchpad page is unofficial and > maintained by the PIL users/community, I would think this would also > save some work load for ?Fredrik Lundh as he can benefit from the tests > and reviews by other people. In the case where patches are not accepted > by him in a new release, the community could update the patch to the new > version. > > This is just a humble proposal. ?Fredrik, in case you have a proposal > which would suit you better just let us know. I will be happy to follow > it. > This sounds good to me. I think the current complication comes also from the fact that there is a commercial PIL license (http://www.pythonware.com/products/pil/support.htm) that gives preferred / exclusive SVN access if you pay $1950 / year --- so if someone else provides a patch he cannot even get the pached version back himself. ?Fredrik, I hope I did not misunderstand this, but if you could give some extra comments, it might clarify the situation better. When is the next (free) 1.1.7 version coming ... ? In the meantime, Stani, could you say, where you keep your (patched) version of PIL ? Is it downloadable as a separate package ? With binaries ? Thanks, Sebastian Haase From narendran_9 at yahoo.com Sun Jun 22 13:56:52 2008 From: narendran_9 at yahoo.com (narendran subu) Date: Sun, 22 Jun 2008 17:26:52 +0530 (IST) Subject: [Image-SIG] Find color or grayscale image Message-ID: <639209.83391.qm@web94715.mail.in2.yahoo.com> Hi to all, I used to convert EPS to JPEG using Ghostscript and PIL for image processing. I want to know whether image should be color or grayscale. Can any one help to get this done. Regards Narendran Bring your gang together. Do your thing. Find your favourite Yahoo! group at http://in.promos.yahoo.com/groups/ From d_l_goldsmith at yahoo.com Fri Jun 27 19:37:33 2008 From: d_l_goldsmith at yahoo.com (David Goldsmith) Date: Fri, 27 Jun 2008 10:37:33 -0700 (PDT) Subject: [Image-SIG] "Point in polygon" test? Message-ID: <281938.49415.qm@web52104.mail.re2.yahoo.com> Hi! Does PIL have already implemented a method to return true/false according as a provided point is inside a provided polygon? Thanks! DG From pander at users.sourceforge.net Fri Jun 27 20:04:24 2008 From: pander at users.sourceforge.net (Pander) Date: Fri, 27 Jun 2008 20:04:24 +0200 Subject: [Image-SIG] Proposed ImageText.py, please review Message-ID: <48652BA8.5040203@users.sourceforge.net> Hi allm Please review ImageText.py which I would like to propose to be included in the next version of PIL. Regards, Pander contents of ImageText.py: ========================= # -*- coding: utf-8 -*- # # The Python Imaging Library. # $Id: ImageText.py 2008-06-26 0.1 Pander$ # # PIL text as images # # History: # 2008-06-26 0.1 Pander initial publication to be reviewed # # Inspired by http://plone.org/products/TextImage which is from the same author. # # Todo: # - Implement functionality to use background image. # - Implement workaround for problem with invisible first character for small # fonts, until this bug is fixed in ImageFont. # - Implement unit test that can verify output images. # - Implement returning result as a MIME string. # # See the README file for information on usage and redistribution. # import PIL.Image import PIL.ImageDraw import PIL.ImageFont import os from hashlib import md5 ## # The ImageText module defines a class with the same name. # It offers static methods to create images displaying specified text by using # the ImageText and ImageDraw classes. #

# Either labels or wrapped paragraphs for UTF-8 text can be generated with a # range of parameters like output file (name and directory), font (align, path, # size and color) and background (width, height, color, transparency) and more. #

# Effort has been made in setting sane default values for all parameters. See # test cases. # # @see ImageDraw#ImageDraw.text # @see ImageFont#ImageText.truetype class ImageText: "PIL font wrapper" ## # Get width and height for specified text if it would be rendered in specified font. # # @param text Text for which width will be measured. Default is set to ' '. # @param font Font to be used to measure with. # @return Text width and height in a list of integers. def getWidthHeight(font, text=' '): # determine text width and height return PIL.ImageDraw.Draw(PIL.Image.new(mode='RGB', size=(0, 0))).textsize(text, font=font) getWidthHeight = staticmethod(getWidthHeight) ## # Get width for specified text if it would be rendered in specified font. # # @param text Text for which width will be measured. # @param font Font to be used to measure with. # @return Text width as integer. def getWidth(font, text=' '): # determine text width return PIL.ImageDraw.Draw(PIL.Image.new(mode='RGB', size=(0, 0))).textsize(text, font=font)[0] getWidth = staticmethod(getWidth) ## # Generate label with specified text rendered in it. # # @param text Text that will be rendered as a label, i.e. a single line of text. # @param filename Name of output file which will have to have '.png' extension. Default is MD5 hash according to unique set of specified parameters with '.png' extension. # @param directory Directory to which output file will be writting. Default is the current directory '.'. # @param fontAlign Align text lef, center, centre or right. Default is left. # @param fontPath Path to font used for redering. When set to '' or None, a default font will be used. # @param fontSize Font size used in rendering. Default is 16. # @param fontColor Font color used in rendering Default is '#000000' which is black. # @param widht Width of the resulting background image. Default is -1, which results in automatic setting. # @param height Height of the resulting backgound image. Default is -1, which results in automatic setting. # @param color Color of the resulting backgroun image like '#FF0000' or transparancy when set to 'transparent'. # @param quality Image quality of output image file format. Default is 100 which means no data reduction. # @param overwrite Should existing generated image be overwritten. # @return String of path to generated image. # @exception SyntaxError If align is not 'left', 'center', 'centre' or 'right'. def generateLabel(text='The quick brown fox jumps over the lazy dog.', filename='', directory='.', fontAlign='left', fontPath='', fontSize=16, fontColor='#000000', width=-1, height=-1, color='transparent', quality=100, overwrite=False): # validate parameters fontAlign = fontAlign.lower() if fontAlign not in ('left', 'center', 'centre', 'right'): raise SyntaxError('Unsupported align ' + fontAlign) fontColor = fontColor.lower() color = color.lower() # configure font font = None if fontPath == '' or fontPath == None: font = PIL.ImageFont.load_default() else: font = PIL.ImageFont.truetype(fontPath, fontSize) # determine text width and height w, h = ImageText.getWidthHeight(font=font, text=text) if width == -1: width = w if height == -1: height = h # create filename if filename == '' or filename == None: hash = md5() hash.update(text) hash.update(fontAlign) hash.update(fontPath) hash.update(str(fontSize)) hash.update(fontColor) hash.update(str(width)) hash.update(str(height)) hash.update(color) hash.update(str(quality)) hash.update('Label') filename = str(hash.hexdigest()) + '.png' path = directory + '/' + filename if not overwrite and os.path.exists(path): return filename # align text x = 0 if fontAlign == 'left': x = 0; elif fontAlign in ('center', 'centre'): x = (width - w) / 2 elif fontAlign == 'right': x = width - w; y = (height - h) / 2 image = None if color == 'transparent': image = PIL.Image.new(mode='RGBA', size=(width, height), color=(0,0,0,0)) else: image = PIL.Image.new(mode='RGB', size=(width, height), color=color) image.info['quality'] = quality; draw = PIL.ImageDraw.Draw(image) draw.text((x, y), text.decode('utf-8'), font=font, fill=fontColor) image.save(path, quality=quality) return filename generateLabel = staticmethod(generateLabel) ## # Generate paragraph with specified text wrapped and rendered in it. # # @param text Text that will be rendered as a label, i.e. a single line of text. # @param filename Name of output file which will have to have '.png' extension. Default is MD5 hash according to unique set of specified parameters with '.png' extension. # @param directory Directory to which output file will be writting. Default is the current directory '.'. # @param fontAlign Align text lef, center, centre or right. Default is left. # @param fontPath Path to font used for redering. When set to '' or None, a default font will be used. # @param fontSize Font size used in rendering. Default is 16. # @param fontColor Font color used in rendering Default is '#000000' which is black. # @param widht Width of the resulting background image. Default is -1, which results in automatic setting. # @param height Height of the resulting backgound image. Default is -1, which results in automatic setting. # @param color Color of the resulting backgroun image like '#FF0000' or transparancy when set to 'transparent'. # @param quality Image quality of output image file format. Default is 100 which means no data reduction. # @param overwrite Should existing generated image be overwritten. # @return String of path to generated image. # @exception SyntaxError If align is not 'left', 'center', 'centre' or 'right'. # @exception SyntaxError If unable to wrap text because width is too small. def generateParagraph(text='Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', filename='', directory='.', fontAlign='left', fontPath='', fontSize=16, fontColor='#000000', width=512, height=-1, color='transparent', quality=100, overwrite=False): # validate parameters if text.find(' ') == -1: return ImageText.generateLabel(text=text, filename=filename, directory=directory, fontAlign=fontAlign, fontPath=fontPath, fontSize=fontSize, fontColor=fontColor, width=width, height=height, color=color, quality=quality, overwrite=overwrite) fontAlign = fontAlign.lower() if fontAlign not in ('left', 'center', 'centre', 'right'): raise SyntaxError('Unsupported align ' + fontAlign) fontColor = fontColor.lower() color = color.lower() # configure font font = None if fontPath == '' or fontPath == None: font = PIL.ImageFont.load_default() else: font = PIL.ImageFont.truetype(fontPath, fontSize) # determine lines words = text.split() lines = [] first = True line = '' lineWidth = 0 maxWidth = 0 spaceWidth, h = ImageText.getWidthHeight(font=font) for word in words: wordWidth = ImageText.getWidth(font=font, text=word) if (wordWidth > width): raise SyntaxError('Unable to wrap text because width is too small') if first: first = False line = word lineWidth = wordWidth else: if (lineWidth + spaceWidth + wordWidth > width): lines.append((lineWidth, line)) if (lineWidth > maxWidth): maxWidth = lineWidth line = word lineWidth = wordWidth else: line = line + ' ' + word lineWidth = lineWidth + spaceWidth + wordWidth if not first: lines.append((lineWidth, line)) # determine text width and height w = maxWidth if height == -1: height = len(lines) * h # create filename if filename == '' or fileName == None: hash = md5() hash.update(text) hash.update(fontAlign) hash.update(fontPath) hash.update(str(fontSize)) hash.update(fontColor) hash.update(str(width)) hash.update(str(height)) hash.update(color) hash.update(str(quality)) hash.update('Paragraph') filename = str(hash.hexdigest()) + '.png' path = directory + '/' + filename if not overwrite and os.path.exists(path): return filename # align text x = 0 y = (height - len(lines) * h) / 2 # create image image = None if color == 'transparent': image = PIL.Image.new(mode='RGBA', size=(width, height), color=(0,0,0,0)) else: image = PIL.Image.new(mode='RGB', size=(width, height), color=color) image.info['quality'] = quality; draw = PIL.ImageDraw.Draw(image) for line in lines: if fontAlign == 'left': x = 0; elif fontAlign in ('center', 'centre'): x = (width - line[0]) / 2 elif fontAlign == 'right': x = width - line[0]; draw.text((x, y), line[1].decode('utf-8'), font=font, fill=fontColor) y = y + h image.save(path, quality=quality) return filename generateParagraph = staticmethod(generateParagraph) ## # Test code in main. # if __name__ == '__main__': # tests for label # default print ImageText.generateLabel() # m- and x-width as well as total height with background color print ImageText.generateLabel(text='moooom', color='#ffffff') print ImageText.generateLabel(text='MbpqdM', color='#ffffff') # alignment print ImageText.generateLabel(text='left', color='#ffffff', width=128, overwrite=True) print ImageText.generateLabel(text='center', color='#ffffff', width=128, fontAlign='center', overwrite=True) print ImageText.generateLabel(text='right', color='#ffffff', width=128, fontAlign='right', overwrite=True) # unicode print ImageText.generateLabel(text='??????', filename='??????.png', color='#ffffff', fontPath='/usr/share/fonts/truetype/freefont/FreeSans.ttf') # sometimes first character of slim fonts are not displayed print ImageText.generateLabel(text='iiiiii', color='#ffffff') print ImageText.generateLabel(text=' iiiiii', color='#ffffff') print ImageText.generateLabel(text='iiiiii', color='#ffffff', fontPath='/usr/share/fonts/truetype/ttf-liberation/LiberationSerif-Regular.ttf') print ImageText.generateLabel(text=' iiiiii', color='#ffffff', fontPath='/usr/share/fonts/truetype/ttf-liberation/LiberationSerif-Regular.ttf') print ImageText.generateLabel(text='iiiiii=6*i without preceeding space', color='#ffffff') print ImageText.generateLabel(text='iiiiii=6*i without preceeding space', color='#ffffff', fontPath='/usr/share/fonts/truetype/ttf-liberation/LiberationSerif-Regular.ttf') print ImageText.generateLabel(text=' iiiiii=6*i with spaceding space', color='#ffffff', fontPath='/usr/share/fonts/truetype/ttf-liberation/LiberationSerif-Regular.ttf') print ImageText.generateLabel(text=' iiiiii=6*i with spaceding space', color='#ffffff') # tests for paragraph # default with overwriting already existing output print ImageText.generateParagraph(overwrite=True) # alignment print ImageText.generateParagraph(fontAlign='center', overwrite=True) print ImageText.generateParagraph(fontAlign='right', overwrite=True) print ImageText.generateParagraph(fontAlign='right', width=320, height=320, overwrite=True) # unicode print ImageText.generateParagraph(text='???????', filename='???????.png', color='#ffffff', fontPath='/usr/share/fonts/truetype/freefont/FreeSans.ttf') # old code # def getDefaultFontPath(): # # most common sans font on Linux # fontPath='/usr/share/fonts/truetype/freefont/FreeSans.ttf' # if not os.path.exists(fontPath): # # most common sans font on OSX # fontPath='/Library/Fonts/Arial.ttf' # if not os.path.exists(fontPath): # # most common sans font on Windows # fontPath = 'C:/WINDOWS/Fonts/arial.ttf' # if not os.path.exists(fontPath): # raise SyntaxError('Cound not find default font') # return fontPath # getDefaultFontPath = staticmethod(getDefaultFontPath) . -------------- next part -------------- A non-text attachment was scrubbed... Name: ImageText.py Type: text/x-python Size: 15253 bytes Desc: not available URL: From mikem at blazenetme.net Sun Jun 29 20:51:13 2008 From: mikem at blazenetme.net (Mike Meisner) Date: Sun, 29 Jun 2008 14:51:13 -0400 Subject: [Image-SIG] Filtering out all but black pixels for OCR Message-ID: <000601c8da19$1f969920$08a305cf@Parents> I'd like to use PIL to prep an image file to improve OCR quality. Specifically, I need to filter out all but black pixels from the image (i.e., convert all non-black pixels to white while retaining the black pixels). Can someone please direct me to the appropriate PIL function/method to accomplish this along with a brief description of the correct arguments to use? Thanks for your help. Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: