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.
import Image becoming from PIL import ImageImage.ANTIALIAS that Pillow 10 removedtostring and fromstring becoming tobytes and frombytesPIL.__version__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
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.