Skip to content

Pixmap not taking /Decode value into account when dealing with /ImageMask images #1191

@chatumao

Description

@chatumao

Please provide all mandatory information!

Describe the bug (mandatory)

I encountered it on a document that had the /Decode value set to [ 1 0 ] instead of the default [ 0 1 ]. After saving the image, it was white on black, but in document it is black on white.

To Reproduce (mandatory)

Snippet:
pdf_file = fitz.open(self.file_path)
for page in pdf_file:
images = pdf_file.get_page_images(page)
for image in images:
pix = fitz.Pixmap(pdf_file, image[0])
pix.invert_irect(pix.irect)
pix.writePNG(image_file_path)
The file in question is sensitive, so I'd rather not send it publicly. I can provide it by request through secure channels.
Not sure about the indentation, is there a way to make it work in this context?

Expected behavior (optional)

Describe what you expected to happen (if not obvious).

Screenshots (optional)

If applicable, add screenshots to help explain your problem.

Your configuration (mandatory)

  • Manjaro (up to date at time of writing), x64
  • Python 3.9.6
  • PyMuPDF 1.18.15 installed by wheel

For example, the output of print(sys.version, "\n", sys.platform, "\n", fitz.__doc__) would be sufficient (for the first two bullets).

Additional context (optional)

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

upstream bugbug outside this packagewontfixno intention to resolve

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions