[Image-SIG] Announcing my PIL repository

Alexey Borzenkov snaury at gmail.com
Sun Sep 7 16:53:04 CEST 2008

On Sun, Sep 7, 2008 at 5:42 PM, Pander <pander at users.sourceforge.net> wrote:
> Thanks for your work. Did you get any replies from the original authors?

Well, It's just that nobody replied to my patch emails. They went to
the list completely silently, and that felt a little bit odd. :-/

> Attached you will find a contribution from my side. I hope it can find
> its way into PIL. Please review the code and report back any issues you
> might encounter.

I'm afraid you might have misunderstood me. I don't have anything to
do with PythonWare or Secret Labs AB, so I absolutely can't decide
what goes and what doesn't go into PIL. :-/

As for the review I see at least some problems with your code:

1) It's too specialized. I would recommend, if possible, splitting
image generation and caching code into different functions, so that
one returns unsaved images and the other checks file cache and in case
of a cache-miss uses the first one and saves it on disk.

2) You hard-code text to be str in utf-8 encoding. Even worse,
different functions expect different things (for example,
getWidth[Height] expects a ascii/unicode string, but generateLabel
expects utf-8 string), you even make the mistake of incorrectly
calling them in your own code. Just make users call your functions
with ascii/unicode strings and convert to unicode if you really need
to, don't special-case on utf-8 or any other encoding.

~ Alexey

More information about the Image-SIG mailing list