Skip to content

Image extraction faulty PNG image. #3912

Description

@HenrikNilssonCode

Extracting a PNG image from a PDF results in broken output, almost looking like a misinterpreting of colour value range. No exception is thrown.

Environment

Which environment were you using when you encountered the problem?

$ python -m platform
Linux-6.17.0-29-generic-x86_64-with-glibc2.39

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

Code + PDF

This is a minimal, complete example that shows the issue:

from pypdf import PdfReader

reader = PdfReader("1:10000.pdf")
image = reader.pages[0].images[0]
image.image.save("out.png")

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!

1:10000.pdf

Traceback

This is the complete traceback I see:
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions