-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
ValueError: image has no palette
when show GIF
#8921
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
Comments
Hi, I would like to work on this issue! |
@quaeast Why not just call Python 3.12.9 (main, Mar 23 2025, 16:34:48) [Clang 16.0.0 (clang-1600.0.26.6)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>> img = Image.open("435668030-8d16446a-4b29-4a0f-9249-52edfa1532c1.gif")
>>> img.palette
<PIL.ImagePalette.ImagePalette object at 0x10546f740> |
@aclark4life I tried to open it in this way, and it will return the same error. The key of this error is this image has a palette, but pillow tells me it does not have. And I also tried to convert this image to ndarray frame by frame, but when it turns to the 9th frame, it will return from PIL import Image
image = Image.open('435668030-8d16446a-4b29-4a0f-9249-52edfa1532c1.gif')
frames = []
try:
while True:
print(len(frames))
frame = image.copy()
frames.append(frame)
image.seek(image.tell() + 1)
except EOFError:
pass 0
1
2
3
4
5
6
7
Traceback (most recent call last):
File "/Users/fangzidong/git_repo/mmwrastra/plg/image_io_debug.py", line 13, in <module>
frame = image.copy()
File "/Users/fangzidong/miniconda3/envs/torch/lib/python3.10/site-packages/PIL/Image.py", line 1271, in copy
self.load()
File "/Users/fangzidong/miniconda3/envs/torch/lib/python3.10/site-packages/PIL/ImageFile.py", line 400, in load
self.load_end()
File "/Users/fangzidong/miniconda3/envs/torch/lib/python3.10/site-packages/PIL/GifImagePlugin.py", line 480, in load_end
self.im.putpalettealpha(self._frame_transparency, 0)
ValueError: image has no palette |
ValueError: image has no palette
when opening GIF
ValueError: image has no palette
when opening GIFValueError: image has no palette
when show GIF
I can reproduce, but not sure if this is a Pillow bug. Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>>
>>> image = Image.open('435668030-8d16446a-4b29-4a0f-9249-52edfa1532c1.gif')
>>>
>>> frames = []
>>> try:
... while True:
... print(len(frames))
... frame = image.copy()
... frames.append(frame)
... image.seek(image.tell() + 1)
... except EOFError:
... pass
...
0
1
2
3
4
5
6
7
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "/Users/alex.clark/Developer/django-mongodb-cli/.venv/lib/python3.12/site-packages/pillow-11.2.0-py3.12-macosx-15.3-arm64.egg/PIL/Image.py", line 1271, in copy
self.load()
File "/Users/alex.clark/Developer/django-mongodb-cli/.venv/lib/python3.12/site-packages/pillow-11.2.0-py3.12-macosx-15.3-arm64.egg/PIL/ImageFile.py", line 396, in load
self.load_end()
File "/Users/alex.clark/Developer/django-mongodb-cli/.venv/lib/python3.12/site-packages/pillow-11.2.0-py3.12-macosx-15.3-arm64.egg/PIL/GifImagePlugin.py", line 480, in load_end
self.im.putpalettealpha(self._frame_transparency, 0)
ValueError: image has no palette
|
I've created #8924 to resolve this. |
What did you do?
What actually happened?
I got this error when i opening this image:
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: