Skip to content

how to save a pdf page to png bytes with typing [pyright issue] #3849

Closed Answered by JorjMcKie
jaredmcqueen asked this question in Looking for help
Discussion options

You must be logged in to vote

"Saving" to memory is just as simple:

pix = page.get_text()
pngbytes = pix.tobytes("png")

Looking in help():

import pymupdf
help(pymupdf.Pixmap.tobytes)
Help on function tobytes in module pymupdf:

tobytes(self, output='png', jpg_quality=95)
    Convert to binary image stream of desired type.

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@JorjMcKie
Comment options

Answer selected by jaredmcqueen
@JorjMcKie
Comment options

@jaredmcqueen
Comment options

@JorjMcKie
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants