Support Pillow v10
Pillow 9.5 deprecated the getsize method for fonts in favor of its new getbbox, and then getsize was removed in Pillow 10.. Adjust the call we use for captcha generation so it will continue working, and declare a requirement for the earliest forward-compatible release. Change-Id: Ib35eea077d7f8c428493ef8e4cfe00e05e580a6f
This commit is contained in:
parent
376c2ba0d0
commit
1cee24ce0b
@ -151,7 +151,7 @@ class TextLayer(Layer):
|
|||||||
# draw grayscale image white on black
|
# draw grayscale image white on black
|
||||||
text_image = Image.new('L', image.size, 0)
|
text_image = Image.new('L', image.size, 0)
|
||||||
draw = ImageDraw.Draw(text_image)
|
draw = ImageDraw.Draw(text_image)
|
||||||
text_size = self.font.getsize(self.text)
|
text_size = self.font.getbbox(self.text)
|
||||||
x = int((image.size[0] - text_size[0]) * self.alignment[0] + 0.5)
|
x = int((image.size[0] - text_size[0]) * self.alignment[0] + 0.5)
|
||||||
y = int((image.size[1] - text_size[1]) * self.alignment[1] + 0.5)
|
y = int((image.size[1] - text_size[1]) * self.alignment[1] + 0.5)
|
||||||
draw.text((x, y), self.text, font=self.font,
|
draw.text((x, y), self.text, font=self.font,
|
||||||
|
@ -7,6 +7,6 @@ SQLAlchemy<2.0.0
|
|||||||
PyMySQL
|
PyMySQL
|
||||||
simplejson
|
simplejson
|
||||||
Babel
|
Babel
|
||||||
pillow
|
pillow>=9.5
|
||||||
pytz
|
pytz
|
||||||
MarkupSafe
|
MarkupSafe
|
||||||
|
Loading…
Reference in New Issue
Block a user