Skip to content
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

Colorspace /DeviceRGB not supported #2023

Closed
stefan6419846 opened this issue Jul 26, 2023 · 2 comments · Fixed by #2026
Closed

Colorspace /DeviceRGB not supported #2023

stefan6419846 opened this issue Jul 26, 2023 · 2 comments · Fixed by #2026
Assignees

Comments

@stefan6419846
Copy link
Collaborator

Explanation

At the moment, support for the /DeviceRGB color mode seems to be missing:

File "/home/user/lib/python3.6/site-packages/pypdf/_page.py", line 2604, in __iter__
    yield self[i]
  File "/home/user/lib/python3.6/site-packages/pypdf/_page.py", line 2600, in __getitem__
    return self.get_function(lst[index])
  File "/home/user/lib/python3.6/site-packages/pypdf/_page.py", line 533, in _get_image
    return self._get_image(ids, cast(DictionaryObject, xobjs[id[0]]))
  File "/home/user/lib/python3.6/site-packages/pypdf/_page.py", line 522, in _get_image
    imgd = _xobj_to_image(cast(DictionaryObject, xobjs[id]))
  File "/home/user/lib/python3.6/site-packages/pypdf/filters.py", line 877, in _xobj_to_image
    "",
  File "/home/user/lib/python3.6/site-packages/pypdf/filters.py", line 693, in _get_imagemode
    mode_map.get(color_space)  # type: ignore
TypeError: unhashable type: 'ArrayObject'

Debugging the value of color_space reveals ['/DeviceRGB'].

Code Example

from pypdf import PdfReader

reader = PdfReader('file.pdf')
for page in reader.pages:
    for image in reader.images:
        print(image)
@pubpub-zz pubpub-zz added the needs-pdf The issue needs a PDF file to show the problem label Jul 26, 2023
@stefan6419846
Copy link
Collaborator Author

can you please confirm you are on the latest release

commit 11ee6480a3f795d770da89944f32a977e3c110e2 (HEAD -> main, origin/main, origin/HEAD)
Author: pubpub-zz <4083478+pubpub-zz@users.noreply.github.com>
Date:   Tue Jul 25 22:09:06 2023 +0200

then please provide the pdf for analysis

Sent to Martin due to privacy reasons.

@pubpub-zz
Copy link
Collaborator

thanks for the report and the file:
here is a test file showing the same issue for test:
pypdf_with_arr_deviceRGB.pdf

pubpub-zz added a commit to pubpub-zz/pypdf that referenced this issue Jul 26, 2023
@pubpub-zz pubpub-zz removed the needs-pdf The issue needs a PDF file to show the problem label Jul 27, 2023
@py-pdf py-pdf deleted a comment from pubpub-zz Jul 27, 2023
@py-pdf py-pdf deleted a comment from pubpub-zz Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants