diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 52f9d48..c7730bf 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -19,7 +19,7 @@ jobs: name: Unit Tests strategy: matrix: - python_version: [3.7, 3.8, 3.9, "3.10"] + python_version: [3.8, 3.9, "3.10", "3.11"] os: [ ubuntu-latest, windows-latest, macos-latest ] runs-on: ${{ matrix.os }} steps: diff --git a/requirements.txt b/requirements.txt index 6b17292..928656f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/swmmio/graphics/drawing.py b/swmmio/graphics/drawing.py index 3721312..10fc9fb 100644 --- a/swmmio/graphics/drawing.py +++ b/swmmio/graphics/drawing.py @@ -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) @@ -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) diff --git a/swmmio/graphics/utils.py b/swmmio/graphics/utils.py index 70ddf95..915e27f 100644 --- a/swmmio/graphics/utils.py +++ b/swmmio/graphics/utils.py @@ -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: