From gherman at darwin.in-berlin.de Fri Aug 3 19:11:36 2012 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 3 Aug 2012 19:11:36 +0200 Subject: [Image-SIG] Spotting PIL text rendering differences for TrueType fonts Message-ID: Hi, I'm trying to generate bitmap files dynamically using Python, PIL and TrueType fonts. When deploying my code on a WebFaction.com box with a preinstalled PIL I observe nasty differences (most visible in the string widths) in the text being rendered compared to my development box, a MacBook with OS X 10.6 with my own Python/PIL installation (both with Python 2.7.3 and PIL 1.1.7). I've contacted the WebFaction support team, speculating about differ- ences in the JPEG, PNG and/or Freetype libraries used. It's not solved, but now I think Freetype might be the best guess since the output makes no difference between PNG and JPEG. WebFaction told me to install a custom PIL following their recipes here, but that didn't help (in fact the differences compared with my Mac even increased): http://community.webfaction.com/questions/7340/how-to-install-pil-with-truetype-support In order to test this I've written a simple script and put it on Gist here (with two small PNG files attached for an Arial TTF), so people can tweak it if they like: https://gist.github.com/3248606 While I haven't given up hope on the WebFaction support I have two questions for this list: 1. I wonder if I can expect the exact same rendering on different platforms with PIL and TrueType at all? 2. Is there some way to tell quickly (ideally at run time) which li- braries (and versions) went into building PIL and, maybe, where they reside in the system? Any help is highly appreciated. Regards, Dinu -------------- next part -------------- A non-text attachment was scrubbed... Name: test_arial_Linux.png Type: image/png Size: 2655 bytes Desc: not available URL: -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: test_arial_Darwin.png Type: image/png Size: 2728 bytes Desc: not available URL: From edward at unicornschool.org Sat Aug 4 21:20:39 2012 From: edward at unicornschool.org (Edward Cannon) Date: Sat, 4 Aug 2012 12:20:39 -0700 Subject: [Image-SIG] Spotting PIL text rendering differences for TrueType fonts In-Reply-To: References: Message-ID: I don't have much experience with this topic, but you could try looking at the selftest.py script that comes with PIL (you probably ran it during your install) as I recall it prints some useful information out, so it must be able to determine information about the install. Edward On Fri, Aug 3, 2012 at 10:11 AM, Dinu Gherman wrote: > Hi, > > I'm trying to generate bitmap files dynamically using Python, PIL and > TrueType fonts. When deploying my code on a WebFaction.com box with > a preinstalled PIL I observe nasty differences (most visible in the > string widths) in the text being rendered compared to my development > box, a MacBook with OS X 10.6 with my own Python/PIL installation > (both with Python 2.7.3 and PIL 1.1.7). > > I've contacted the WebFaction support team, speculating about differ- > ences in the JPEG, PNG and/or Freetype libraries used. It's not solved, > but now I think Freetype might be the best guess since the output makes > no difference between PNG and JPEG. WebFaction told me to install a > custom PIL following their recipes here, but that didn't help (in fact > the differences compared with my Mac even increased): > > http://community.webfaction.com/questions/7340/how-to-install-pil-with-truetype-support > > In order to test this I've written a simple script and put it on Gist > here (with two small PNG files attached for an Arial TTF), so people > can tweak it if they like: > > https://gist.github.com/3248606 > > While I haven't given up hope on the WebFaction support I have two > questions for this list: > > 1. I wonder if I can expect the exact same rendering on different > platforms with PIL and TrueType at all? > > 2. Is there some way to tell quickly (ideally at run time) which li- > braries (and versions) went into building PIL and, maybe, where > they reside in the system? > > Any help is highly appreciated. > > Regards, > > Dinu > > > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From gherman at darwin.in-berlin.de Mon Aug 6 17:27:43 2012 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Mon, 6 Aug 2012 17:27:43 +0200 Subject: [Image-SIG] Spotting PIL text rendering differences for TrueType fonts In-Reply-To: References: Message-ID: Edward Cannon: > On Fri, Aug 3, 2012 at 10:11 AM, Dinu Gherman > wrote: >> Hi, >> >> I'm trying to generate bitmap files dynamically using Python, PIL and >> TrueType fonts. When deploying my code on a WebFaction.com box with >> a preinstalled PIL I observe nasty differences (most visible in the >> string widths) in the text being rendered compared to my development >> box, a MacBook with OS X 10.6 with my own Python/PIL installation >> (both with Python 2.7.3 and PIL 1.1.7). >> >> I've contacted the WebFaction support team, speculating about differ- >> ences in the JPEG, PNG and/or Freetype libraries used. It's not solved, >> but now I think Freetype might be the best guess since the output makes >> no difference between PNG and JPEG. WebFaction told me to install a >> custom PIL following their recipes here, but that didn't help (in fact >> the differences compared with my Mac even increased): >> >> http://community.webfaction.com/questions/7340/how-to-install-pil-with-truetype-support >> >> In order to test this I've written a simple script and put it on Gist >> here (with two small PNG files attached for an Arial TTF), so people >> can tweak it if they like: >> >> https://gist.github.com/3248606 >> >> While I haven't given up hope on the WebFaction support I have two >> questions for this list: >> >> 1. I wonder if I can expect the exact same rendering on different >> platforms with PIL and TrueType at all? >> >> 2. Is there some way to tell quickly (ideally at run time) which li- >> braries (and versions) went into building PIL and, maybe, where >> they reside in the system? >> >> Any help is highly appreciated. >> >> Regards, >> >> Dinu > > I don't have much experience with this topic, but you could try > looking at the selftest.py script that comes with PIL (you probably > ran it during your install) as I recall it prints some useful > information out, so it must be able to determine information about the > install. > Edward Well, after some additional tests with many TTFs I concluded that PIL itself (or Freetype for its sake) must be somehow broken and not quite able to handle various TTFs consistently, since I get pretty different results when placing strings for different fonts - even on the same box! So I abandoned the idea of using PIL for that purpose and switched to ReportLab instead which seems to use libart for restarization, apparent- ly including fonts. This gives me predictable output for all fonts and two different platforms, Mac OS X and WebFaction's CentOS without all the previous hassle. Regards, Dinu From felix.schwarz at oss.schwarz.eu Thu Aug 9 12:08:10 2012 From: felix.schwarz at oss.schwarz.eu (Felix Schwarz) Date: Thu, 09 Aug 2012 12:08:10 +0200 Subject: [Image-SIG] PIL development / community+releases Message-ID: <50238C0A.9030703@oss.schwarz.eu> Hi, I'm a bit confused about the current state of PIL. As mentioned before the latest released version of PIL is 1.1.7, the latest version on pypi is 1.1.6. I'm also aware of the pil-2009-raclette hg repository. The hg repository has some interesting fixes but also several bitbucket forks, some open pull requests and open issues. What concerns me is that the last release was in 2009, issues don't seem to get attention and even the pull requests are not being merged (some are open for almost a year). In the hg repo I see some commits but the last one was more than a year ago. At the same time there is also pillow now (http://pypi.python.org/pypi/Pillow/) which comes with its own set of patches and even more forks on github. It looks to me as if PIL development is "on hold" right now even though there are clearly people interested in the library and a lot of work to do. Is the raclette repo still the "authoritative" source for PIL development? Any plans for a release? If not, what is missing right now? Can you not just join forces with the "friendly fork" (Pillow) and get fresh blood in the project? fs From aclark at aclark.net Thu Aug 9 19:08:04 2012 From: aclark at aclark.net (Alex Clark) Date: Thu, 09 Aug 2012 13:08:04 -0400 Subject: [Image-SIG] PIL development / community+releases In-Reply-To: <50238C0A.9030703@oss.schwarz.eu> References: <50238C0A.9030703@oss.schwarz.eu> Message-ID: Hi, On 8/9/12 6:08 AM, Felix Schwarz wrote: > Hi, > > I'm a bit confused about the current state of PIL. > > As mentioned before the latest released version of PIL is 1.1.7, the latest > version on pypi is 1.1.6. I'm also aware of the pil-2009-raclette hg repository. > > The hg repository has some interesting fixes but also several bitbucket forks, > some open pull requests and open issues. > > What concerns me is that the last release was in 2009, issues don't seem to > get attention and even the pull requests are not being merged (some are open > for almost a year). In the hg repo I see some commits but the last one was > more than a year ago. > > At the same time there is also pillow now > (http://pypi.python.org/pypi/Pillow/) which comes with its own set of patches > and even more forks on github. > > It looks to me as if PIL development is "on hold" right now even though there > are clearly people interested in the library and a lot of work to do. > > > Is the raclette repo still the "authoritative" source for PIL development? > Any plans for a release? If not, what is missing right now? > Can you not just join forces with the "friendly fork" (Pillow) and get fresh > blood in the project? Pillow is effectively tracking PIL. It exists because the release timetable for PIL was not satisfactory to some folks in the community, and the 1.1.7 release was/is not setuptools compatible. You can read the archives of this list to learn more about PIllow's birth and development and ongoing maintenance, starting here: - http://mail.python.org/pipermail/image-sig/2010-July/006423.html IIUC, pil-2009-raclette contains quite a bit of new development. So if folks don't want to wait for a release, they can open tickets and send patches to Pillow to get them out the door. This especially includes the need to address Python 3 compat. Here is the current Pillow home: - https://github.com/python-imaging The best case scenario would be for PIL to return to "active" development, along with a more aggressive release schedule. Until that happens, we have Pillow. (I don't have any information about PIL's current plans, Fredrik may be able to provide some insight.) Alex > > fs > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -- Alex Clark ? http://pythonpackages.com/ONE_CLICK From eric-python at soroos.net Fri Aug 10 02:12:42 2012 From: eric-python at soroos.net (eric soroos) Date: Thu, 09 Aug 2012 17:12:42 -0700 Subject: [Image-SIG] PIL development / community+releases In-Reply-To: References: <50238C0A.9030703@oss.schwarz.eu> Message-ID: <502451FA.8090607@soroos.net> On 08/09/2012 10:08 AM, Alex Clark wrote: > > IIUC, pil-2009-raclette contains quite a bit of new development. So if > folks don't want to wait for a release, they can open tickets and send > patches to Pillow to get them out the door. This especially includes > the need to address Python 3 compat. Here is the current Pillow home: > > > - https://github.com/python-imaging > I've got some patches against PIL 1.1.7 to do group 4 tiff decoding and (experimental) group 4 tiff encoding. https://github.com/wiredfool/Python-Imaging-Library-G4-Tiff-Support These are a total rewrite of the original patch that hit the Image-SIG list in July 2003, which never made it into the PIL distribution, since in Fredrik's words: > The patch depended on too many libtiff internals for me to feel > confident that it was a good idea to add it to PIL's standard > distribution; After digging through the patch when builds failed against newer versions of libtiff, I concur. I've rewritten it so that all operations go through the public libtiff interfaces. I'd love to see this make it into any of the currently developed versions. eric From aclark at aclark.net Fri Aug 10 03:35:23 2012 From: aclark at aclark.net (Alex Clark) Date: Thu, 09 Aug 2012 21:35:23 -0400 Subject: [Image-SIG] PIL development / community+releases In-Reply-To: <502451FA.8090607@soroos.net> References: <50238C0A.9030703@oss.schwarz.eu> <502451FA.8090607@soroos.net> Message-ID: Hi, On 8/9/12 8:12 PM, eric soroos wrote: > On 08/09/2012 10:08 AM, Alex Clark wrote: >> >> IIUC, pil-2009-raclette contains quite a bit of new development. So if >> folks don't want to wait for a release, they can open tickets and send >> patches to Pillow to get them out the door. This especially includes >> the need to address Python 3 compat. Here is the current Pillow home: >> >> >> - https://github.com/python-imaging >> > > I've got some patches against PIL 1.1.7 to do group 4 tiff decoding and > (experimental) group 4 tiff encoding. > > https://github.com/wiredfool/Python-Imaging-Library-G4-Tiff-Support > > These are a total rewrite of the original patch that hit the Image-SIG > list in July 2003, which never made it into the PIL distribution, since > in Fredrik's words: > >> The patch depended on too many libtiff internals for me to feel >> confident that it was a good idea to add it to PIL's standard >> distribution; > > After digging through the patch when builds failed against newer > versions of libtiff, I concur. I've rewritten it so that all operations > go through the public libtiff interfaces. > > I'd love to see this make it into any of the currently developed versions. Can you fork Pillow, make the changes, and send a pull request on GitHub? Originally Pillow was a packaging fork, however I feel OK about making imaging code changes, as long as there is an upstream bug report referenced in the pull request. Alex > > eric > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -- Alex Clark ? http://pythonpackages.com/ONE_CLICK