Skip to content

Tag: python-imaging-library

Center-/middle-align text with PIL?

How would I center-align (and middle-vertical-align) text when using PIL? Answer Deprecation Warning: textsize is deprecated and will be removed in Pillow 10 (2023-07-01). Use textbbox or textlength instead. Code using textbbox instead of textsize. Result Use Draw.textsize method to calculate text size and re…