semuconsulting / PyGPSClient

Python Graphical GPS Client Application supporting NMEA, UBX, RTCM3, NTRIP & SPARTN Protocols
BSD 3-Clause "New" or "Revised" License
517 stars 103 forks source link

PIL.Image has no attribute ANTIALIAS #109

Closed japs386 closed 9 months ago

japs386 commented 9 months ago

Describe the bug

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

Additional context

pygnssutils-1.0.17, but all versions will see the error.

The problem and the solution is described here: https://stackoverflow.com/questions/76616042/attributeerror-module-pil-image-has-no-attribute-antialias

The following change in site-packages/pygpsclient/ solves the problem: Out: Image.open(IMG_WORLD).resize((w, h), Image.ANTIALIAS) In: Image.open(IMG_WORLD).resize((w, h), Image.LANCZOS)

Problem started with upgrade from Pillow-9.5.0 to pillow-10.2.0 ANTIALIAS was removed in Pillow 10.0.0 (after being deprecated through many previous versions).

semuadmin commented 9 months ago

Hi @japs386

Sorry but I’m unclear where exactly you’re seeing this error. The pygnssutils library doesn’t use Pillow and as far as I’m aware PyGPSClient no longer uses the ANTIALIAS flag. Can you clarify which version of PyGPSClient you’re seeing this in and provide the FULL error traceback please. Thanks

japs386 commented 9 months ago

PyGPSClient: 1.3.25

[japs@japspc ~]$ pygpsclient Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib64/python3.9/tkinter/init.py", line 1892, in call return self.func(*args) File "/usr/local/lib/python3.9/site-packages/pygpsclient/app.py", line 556, in on_gnss_read self.process_data(raw_data, parsed_data) File "/usr/local/lib/python3.9/site-packages/pygpsclient/app.py", line 669, in process_data frm.update_frame() File "/usr/local/lib/python3.9/site-packages/pygpsclient/map_frame.py", line 108, in update_frame self._draw_static_map(lat, lon) File "/usr/local/lib/python3.9/site-packages/pygpsclient/map_frame.py", line 128, in _draw_static_map Image.open(IMG_WORLD).resize((w, h), Image.ANTIALIAS) AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

semuadmin commented 9 months ago

You’re using a very old version - the issue you’re referring to was addressed back in 1.3.28. I strongly recommend upgrading to the latest version 1.4.8.

python3 -m pip install —upgrade pygpsclient

If you’re able, I also recommend installing Python 3.12, which offers some worthwhile performance improvements.

japs386 commented 9 months ago

I just did a few minutes ago, but pygpsclient/map_frame.py still contains Image.open(IMG_WORLD).resize((w, h)) # , Image.ANTIALIAS) It may give rise to some confusion. Anyway problem solved.

semuadmin commented 9 months ago

Not sure why a comment would cause confusion, but happy to remove it in next release.

Assuming you’ve upgraded, are you happy to close the issue?