Skip to content

Problem writing PNG #133

@dlobba

Description

@dlobba

Good morning,
I am experiencing an issue on writing a PNG from a PDF page.
I am on Ubuntu 17.10, I compiled manually MuPDF and install PyMuPDF as said in the wiki, and everything went good.
I am able to import fitz, access metadata and so on. But I cannot manage to export PNG, the result gets corrupted (grayscale lines on all the page, all images and text barely readable).
I think is a dependency issue, but I don't know how to solve it. I installed all the dependencies also on the repository to be sure, and I commented the external libraries in setup.py as the wiki said (and I also changed the branch according the mupdf version, 1.12.0).

the following code produce the result explained above:

>>> import fitz
>>> doc = fitz.open("my_fantastic_pdf.pdf")
>>> pix = doc[1].getPixmap()
>>> pix.writeImage("test.png")

The return value of the last method is 0 if can be useful.

Here is an example of the result:

test

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