Skip to content

Commit

Permalink
upgrade Pillow to 10.1.0 and psycopg2-binary to 2.9.9, fix text_to_im…
Browse files Browse the repository at this point in the history
…age funtion in utils.py to use the last version of Pillow
  • Loading branch information
melizeche committed Nov 29, 2023
1 parent 29b1b62 commit be852a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ def text_to_image(text, width, height) -> Image:
img = Image.new('RGB', (width, height), color=(0, 209, 178))
d = ImageDraw.Draw(img)
fnt = ImageFont.truetype(FONT_PATH, 30)
w, h = d.textsize(text, font=fnt)
d.text(((width-w)/2, (height-h)/2), text, font=fnt, align="center", fill=(255, 255, 255))
w = d.textlength(text, font=fnt)
h=10
d.text(((width-w)/2, h), text, font=fnt, align="center", fill=(255, 255, 255))
return img


Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
django==4.2.7
Pillow==9.5.0
psycopg2-binary==2.8.6
Pillow==10.1.0
psycopg2-binary==2.9.9
django-leaflet==0.29.0
black
django-widget-tweaks==1.4.8
Expand Down

0 comments on commit be852a5

Please sign in to comment.