You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have generated a mostly empty version of the document reproducing this issue: redacted.pdf
Traceback
This is the complete traceback I see:
Traceback (most recent call last):
File "/home/stefan/temp/analyze.py", line 17, in <module>
for image in page.images:
File "/home/stefan/temp/pypdf/pypdf/_page.py", line 2604, in __iter__
yield self[i]
File "/home/stefan/temp/pypdf/pypdf/_page.py", line 2600, in __getitem__
return self.get_function(lst[index])
File "/home/stefan/temp/pypdf/pypdf/_page.py", line 522, in _get_image
imgd = _xobj_to_image(cast(DictionaryObject, xobjs[id]))
File "/home/stefan/temp/pypdf/pypdf/filters.py", line 892, in _xobj_to_image
img, image_format, extension = _handle_flate(
File "/home/stefan/temp/pypdf/pypdf/filters.py", line 804, in _handle_flate
img.putpalette(lookup.get_data())
File "/home/stefan/temp/venv/lib64/python3.9/site-packages/PIL/Image.py", line 1914, in putpalette
raise ValueError("illegal image mode")
ValueError: illegal image mode
The text was updated successfully, but these errors were encountered:
I am trying to extract the images from a PDF file, which fails with "illegal image mode"
Environment
Which environment were you using when you encountered the problem?
$ python -m platform Linux-5.14.21-150400.24.69-default-x86_64-with-glibc2.31 $ python -c "import pypdf;print(pypdf.__version__)" 3.13.0
Code + PDF
This is a minimal, complete example that shows the issue:
I have generated a mostly empty version of the document reproducing this issue: redacted.pdf
Traceback
This is the complete traceback I see:
The text was updated successfully, but these errors were encountered: