Home / Tools / PIL to Pillow

PIL to Pillow converter

Paste code written against old PIL and it will be brought up to date, with a note on every change so you can see what it did and why.

Old code

For Pillow today

What it handles

What it flags but will not change for you

Some things cannot be rewritten safely by search and replace, so the tool points them out instead. draw.textsize() is the main one: it returned a width and height, while its replacement draw.textbbox() returns a four value box, so the surrounding code has to change too.

w, h = draw.textsize(text, font=font)

left, top, right, bottom = draw.textbbox((0, 0), text, font=font)
w = right - left
h = bottom - top

Nothing is uploaded

The whole thing is a list of rules in a JavaScript file in your browser. Your code is not sent anywhere, which also means it works with the network off.