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
Extracting /FlateDecode images with an image mode of 1 currently fails, probably due to an invalid range loop.
Let's consider the lookup of b'\x00p\xc0\xff\xff\xff' in RGB mode. This should always create two RGB values for further processing ("high" and "low" for image mode 1), but currently only creates one.
Environment
Which environment were you using when you encountered the problem?
Traceback (most recent call last):
File "/home/stefan/temp/run.py", line 15, in <module>
print(page.images[key].indirect_reference)
File "/home/stefan/temp/venv/lib/python3.9/site-packages/pypdf/_page.py", line 2709, in __getitem__
return self.get_function(index)
File "/home/stefan/temp/venv/lib/python3.9/site-packages/pypdf/_page.py", line 558, in _get_image
return self._get_image(ids, cast(DictionaryObject, xobjs[id[0]]))
File "/home/stefan/temp/venv/lib/python3.9/site-packages/pypdf/_page.py", line 547, in _get_image
imgd = _xobj_to_image(cast(DictionaryObject, xobjs[id]))
File "/home/stefan/temp/venv/lib/python3.9/site-packages/pypdf/filters.py", line 781, in _xobj_to_image
img, image_format, extension, invert_color = _handle_flate(
File "/home/stefan/temp/venv/lib/python3.9/site-packages/pypdf/_xobj_image_helpers.py", line 177, in _handle_flate
[
File "/home/stefan/temp/venv/lib/python3.9/site-packages/pypdf/_xobj_image_helpers.py", line 179, in <listcomp>
[
File "/home/stefan/temp/venv/lib/python3.9/site-packages/pypdf/_xobj_image_helpers.py", line 180, in <listcomp>
colors_arr[1 if img.getpixel((x, y)) > 127 else 0]
IndexError: list index out of range
The text was updated successfully, but these errors were encountered:
Extracting
/FlateDecode
images with an image mode of1
currently fails, probably due to an invalid range loop.Let's consider the lookup of
b'\x00p\xc0\xff\xff\xff'
in RGB mode. This should always create two RGB values for further processing ("high" and "low" for image mode1
), but currently only creates one.Environment
Which environment were you using when you encountered the problem?
Code + PDF
This is a minimal, complete example that shows the issue:
An example file is this
Traceback
This is the complete traceback I see:
The text was updated successfully, but these errors were encountered: