def centerdraw(img, msg, color, font): W, H = img.size draw = ImageDraw.Draw(img) w, h = draw.textsize(msg, font=f