[Image-SIG] Spotting PIL text rendering differences for TrueType fonts

Dinu Gherman gherman at darwin.in-berlin.de
Fri Aug 3 19:11:36 CEST 2012


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: <http://mail.python.org/pipermail/image-sig/attachments/20120803/33153643/attachment.png>
-------------- 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: <http://mail.python.org/pipermail/image-sig/attachments/20120803/33153643/attachment-0001.png>


More information about the Image-SIG mailing list