Octolapse logs error in snapshot.py

Im seeing the following recurring error in Octolapse -

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_octolapse/snapshot.py", line 351, in process
self.create_thumbnail()
File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_octolapse/snapshot.py", line 496, in create_thumbnail
raise SnapshotError(
octoprint_octolapse.snapshot.SnapshotError: snapshot-thumbnail-create-error: Create Thumbnail - An unexpected exception occurred while creating a snapshot thumbnail for the Logitech C922 camera. Check the log file (plugin_octolapse.log) for details. - Inner Exception: module 'PIL.Image' has no attribute 'ANTIALIAS'

And so it repeats.

Im no genius programmer so I put this into Google Bard which responded thus -

"This error message indicates that the Image.ANTIALIAS attribute is not available in the PIL.Image module. This is because the ANTIALIAS attribute was deprecated in Pillow 8.3.0 and removed in Pillow 10.0.0. Instead, you should use the Image.LANCZOS or Image.Resampling.LANCZOS attribute for antialiasing."

Also suggested this as the fix -
"To fix the error, you need to replace Image.ANTIALIAS with Image.LANCZOS or Image.Resampling.LANCZOS in the create_thumbnail function of the octoprint_octolapse/snapshot.py file. Here's the updated code:"

def create_thumbnail(self, filename, size=(250, 188), quality=95): img = Image.open(filename) wpercent = (basewidth / float(img.size[0])) hsize = int((float(img.size[1]) * float(wpercent))) img = img.resize((basewidth, hsize), Image.LANCZOS) img.save(filename, quality=quality)

Im using the new Camera Stack 1.9.3 with octopi 1.0.0

Not seeing any timelapse preview while printing but do get a finished rendered timelapse at the end.

Hopefully this will make sense to somebody !

Thanks

For anybody else finding this the fix is actually fairly simple and can be read about on the Octolapse github page here -

Timelapse previews not generated with Pillow 10.0.0 · Issue #917 · FormerLurker/Octolapse (github.com)

1 Like