Skip to content

Inverted image colors in svg starting from 1.26.6 #4846

@ASTimch

Description

@ASTimch

Description of the bug

Starting from v 1.26.6 page.get_svg_image() generates svg with inverted colors in jpeg.

How to reproduce the bug

Here simple code

def pdf_to_svg(pdf_path, output_svg_path):

    with fitz.open(pdf_path) as doc:
        page = doc[0]
        svg_content = page.get_svg_image()
        with open(output_svg_path, "w", encoding="utf-8") as f:
            f.write(svg_content)


if __name__ == "__main__":
    pdf_to_svg("test1.pdf", "test1.svg")

Test pdf and results for different versions attached.

test1.pdf

svg from v1.25.5
Image

svg from v1.25.6
Image

svg from v1.25.7
Image

PyMuPDF version

1.26.6

Operating system

Windows

Python version

3.11

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions