Skip to content

CMYK image with filter_type equal to flate_decode return "not enough image data" error #2321

@jianfan123

Description

@jianfan123

try to extract image from this PDF file . page 6 image return "not enough image data page " page 9 and page 11 's images get extracted from this PDF file

Environment

Which environment were you using when you encountered the problem?

$ python -m platform
Linux-4.18.0-477.27.1.el8_8.x86_64-x86_64-with-glibc2.2.5

$ python -c "import pypdf;print(pypdf._debug_versions)"
# pypdf==3.17.1, crypt_provider=('local_crypt_fallback', '0.0.0'), PIL=10.0.0

## Code + PDF
[Addressing_Adversarial_Attacks.pdf](https://github.com/py-pdf/pypdf/files/13501846/Addressing_Adversarial_Attacks.pdf)


```python
from pypdf import PdfReader
doc= PdfReader("./Addressing_Adversarial_Attacks.pdf")
for page_idx, page in enumerate(doc.pages):
     count = 0
     for image_file_object in page.images:
         
         with open(str(count) + image_file_object.name, "wb") as fp:
              fp.write(image_file_object.data)
               count += 1

Share here the PDF file(s) that cause the issue. The smaller they are, the
better. Let us know if we may add them to our tests!

Traceback

This is the complete traceback I see:

# TODO: Your traceback goes here (if applicable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions