-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Dear RAFFT makers,
I encountered some compatibility issues while running plot_path.py with the latest version of Pillow (10.4.0). Since the release of Pillow 10.0.0, the following changes are affecting the script:
- Image.ANTIALIAS has been deprecated and replaced by Image.Resampling.LANCZOS. (https://pillow.readthedocs.io/en/stable/releasenotes/10.0.0.html)
- FreeTypeFont.getsize() has been deprecated and replaced by FreeTypeFont.getbbox(). (https://pillow.readthedocs.io/en/stable/releasenotes/9.2.0.html)
If you are interested in upgrading plot_path.py for Pillow 10+, below the updates to consider :
Line 60 (add_grad_img) :
draw = ImageDraw.Draw(path_img)
#x_size, y_size = fnt.getsize("{:.1f}".format(max_val)) ## DEPRECATED
bbox = fnt.getbbox("{:.1f}".format(max_val)) # update
x_size, y_size = bbox[2] - bbox[0], bbox[3] - bbox[1] # update
Line 177 (main) :
#cur_str = cur_str.resize((n_fig_w, n_fig_h), Image.ANTIALIAS) ## DEPRECATED
cur_str = cur_str.resize((n_fig_w, n_fig_h), Image.Resampling.LANCZOS) # update
Line 208 (main) :
#cur_str = cur_str.resize((n_fig_w, n_fig_h), Image.ANTIALIAS) ## DEPRECATED
cur_str = cur_str.resize((n_fig_w, n_fig_h),Image.Resampling.LANCZOS) # update
Many thanks for this very nice tool,
Best
AS
Metadata
Metadata
Assignees
Labels
No labels