Skip to content

Commit

Permalink
bump pillow version and update reference to its api were necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
aerispaha committed Nov 22, 2023
1 parent 586f922 commit eca3556
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build dependencies
pytest
pillow>=6.2.0,<10.0.0
Pillow==10.1.0
numpy>=1.16.4
pandas>=0.24.2
pyshp==2.1.0
Expand Down
6 changes: 3 additions & 3 deletions swmmio/graphics/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ def annotate_timestamp(draw):
fnt = ImageFont.truetype(FONT_PATH, int(20 * scale))

timestamp = strftime("%b-%d-%Y %H:%M:%S")
txt_height = draw.textsize(timestamp, fnt)[1]
txt_width = draw.textsize(timestamp, fnt)[0]
txt_width = draw.textlength(timestamp, fnt)
xy = (size[0] - txt_width - 10, 15)
draw.text(xy, timestamp, fill=grey, font=fnt)

Expand All @@ -228,7 +227,8 @@ def annotate_details(txt, draw):
scale = 1 * size[0] / 2048
fnt = ImageFont.truetype(FONT_PATH, int(20 * scale))

txt_height = draw.textsize(txt, fnt)[1]
_, top, _, bottom = draw.textbbox((0, 0), txt, fnt)
txt_height = top - bottom

draw.text((10, size[1] - txt_height - 10),
txt, fill=black, font=fnt)
2 changes: 1 addition & 1 deletion swmmio/graphics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def save_image(img, img_path, antialias=True, auto_open=False):
imgSize = (img.getbbox()[2], img.getbbox()[3])
if antialias:
size = (int(imgSize[0] * 0.5), int(imgSize[1] * 0.5))
img.thumbnail(size, Image.ANTIALIAS)
img.thumbnail(size, Image.LANCZOS)

img.save(img_path)
if auto_open:
Expand Down

0 comments on commit eca3556

Please sign in to comment.