diff --git a/plotid/__init__.py b/plotid/__init__.py index 4ade8ba6d4fc5846779bdda2116ff1429ec13703..541c837d685fc0add5408f3f6ba266bec69a93ee 100644 --- a/plotid/__init__.py +++ b/plotid/__init__.py @@ -10,5 +10,5 @@ research data, the plot is based on. Additionally, the script that created the plot will also be copied to the directory. """ -__version__ = "0.3.1" +__version__ = "0.3.2" __author__ = "Institut Fluidsystemtechnik within nfdi4ing at TU Darmstadt" diff --git a/plotid/tagplot_image.py b/plotid/tagplot_image.py index 6234ab648576346e0c8cbb1eb8ef8bc36629fa0f..5d71ad2b8d6e221457cb9842296294d086661a76 100644 --- a/plotid/tagplot_image.py +++ b/plotid/tagplot_image.py @@ -68,10 +68,12 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer: # Create temporary PIL image to get correct textsize tmp_img = Image.new("L", (100, 100)) tmp_draw = ImageDraw.Draw(tmp_img) - textsize = tmp_draw.textsize(img_id, font) + _, _, textwidth, textheight = tmp_draw.textbbox((0, 0), img_id, font) # Create new image with white background and the size of the textbox - img_txt = Image.new("RGBA", textsize, color=(255, 255, 255, 0)) + img_txt = Image.new( + "RGBA", (textwidth, textheight), color=(255, 255, 255, 0) + ) draw_txt = ImageDraw.Draw(img_txt) draw_txt.text((0, 0), img_id, font=font, fill=color) # Rotate the image by the given angle @@ -90,7 +92,7 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer: if plotid_object.qrcode: qrcode = create_qrcode(img_id) qrcode.thumbnail( - (plotid_object.qr_size, plotid_object.qr_size), Image.ANTIALIAS + (plotid_object.qr_size, plotid_object.qr_size), Image.Resampling.LANCZOS ) img.paste( qrcode, diff --git a/plotid/tagplot_matplotlib.py b/plotid/tagplot_matplotlib.py index c81ef3fa496d023225a320ecfa085e015e2e0b4d..6fded8f0c7bc00d23de5757b6b905f869c63bf26 100644 --- a/plotid/tagplot_matplotlib.py +++ b/plotid/tagplot_matplotlib.py @@ -75,7 +75,7 @@ def tagplot_matplotlib(plotid_object: PlotOptions) -> PlotIDTransfer: if plotid_object.qrcode: qrcode = create_qrcode(fig_id) qrcode.thumbnail( - (plotid_object.qr_size, plotid_object.qr_size), Image.ANTIALIAS + (plotid_object.qr_size, plotid_object.qr_size), Image.Resampling.LANCZOS ) fig.figimage( qrcode, diff --git a/requirements.txt b/requirements.txt index daf6bc1b1a09e5809ffe08eb6e6c37ca454a041b..ddb80f74e6a65ffc1a8ee9f9244b862aec3d1790 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,16 @@ -coverage==6.5.0 +coverage==7.3.0 cycler==0.11.0 -fonttools==4.38.0 -kiwisolver==1.4.4 -matplotlib==3.6.3 -myst-parser==0.18.0 -numpy==1.24.2 -packaging==23.0 -Pillow==9.4.0 +fonttools==4.42.1 +kiwisolver==1.4.5 +matplotlib==3.7.2 +myst-parser==2.0.0 +numpy==1.25.2 +packaging==23.1 +Pillow==10.0.0 pyparsing==3.0.9 python-dateutil==2.8.2 qrcode==7.4.2 six==1.16.0 -Sphinx==5.3.0 -sphinx-autoapi==2.0.1 -sphinx-rtd-theme==1.2.0 +Sphinx==7.2.5 +sphinx-autoapi==2.1.1 +sphinx-rtd-theme==1.3.0