-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception using "seek" on GIF that contains frames with different modes #6571
Comments
I implemented a small hardcoded fix, though am not sure its the best way to solve this issue, it works for me. I added the following code (in Pillow 9.2.0): if self.im.mode != frame_im.mode:
if self.im.bands > frame_im.bands:
frame_im = frame_im.convert(self.im.mode)
else:
self.im = self.im.convert(frame_im.mode) Immediately before the following block in "GifImagePlugin.py": if frame_im.mode == "RGBA":
self.im.paste(frame_im, self.dispose_extent, frame_im)
else:
self.im.paste(frame_im, self.dispose_extent) Either way, the current behavior seems like a bug, even though this might not adhere to animated GIF's spec, it's probably worth a fix. |
Could you upload a copy of the image, and simple code that triggers the error? |
I've created PR #6576 to resolve this. |
Great, thanks. I’ll patch my local version accordingly. What release do you expect this to be included in? |
Pillow 9.3.0 was due for release on 2022-10-15, but will be delayed a few days due to the delay with the Python 3.11 release. The current estimate is 2022-10-25, you can watch #6460 for updates. |
Great. Thanks! |
I have an animated GIF that has about 60 frames, some of the frames are encoded in 'L' mode and others are in 'RGB' mode. Many actions, including a simple "seek" command" fail with a "ValueError: images do not match" exception when
self.im.paste(frame_im, self.dispose_extent)
is issued in GifImagePlugin.py. This happens when "self.im" and "frame_im" have different modes.This might be a protection technique for not being able to process such files with Pillow.
The text was updated successfully, but these errors were encountered: