f2a-dr / mulMoQr

0 stars 0 forks source link

resize error #1

Closed FidaDiego closed 3 hours ago

FidaDiego commented 3 hours ago

Hello, I tried to use the code, but I get the following error in the resize command:

Traceback (most recent call last):
  File "/home/dfida/mulMoQr/qrMaker.py", line 15, in <module>
    logo = logo.resize((basewidth, hsize), Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

The code works replacing line 15 with:

logo = logo.resize((basewidth, hsize), Image.Resampling.LANCZOS)

I think the problem is an incompatibility with the new version of Pillow. Thank you, Diego

f2a-dr commented 3 hours ago

Hi Diego,

Thank you for opening the issue. The Image.ANTIALIAS constant was indeed removed starting from Pillow version 10.0.0, but the Image.Resampling.LANCZOS is not supported by older versions of Pillow (I tested the 9.0.1). For now, I am thinking about using the constant Image.LANCZOS, which is supported by both versions.

In the future, I will switch to the new constant and add Pillow v10.0.0+ as requirement.

I tested this solution with Pillow 11 and it worked, let me know if there are further problems.

Francesco