Skip to content
Discussion options

You must be logged in to vote

To make an image of a page, you must first take "picture", which is called "pixmap": pix = page.get_pixmap(). You can influence many properties of that pixmap, like resolution, whether gray or RGB, rotation or flipping.
Once you have that, either use

  • pix.save(...) which can only produce PNG, PNM and a handful of other formats, or
  • pix.pil_save() which uses pillow with an additional internal step. This allows JPEG output among others.

With .pil_save() you have the full abilities of pillow output available: the method arguments are those of pillow, which you therefore must lookup. Simple example:

page = doc[0]
pix = page.get_pixmap(dpi=300)  # RGB with a high resolution
pix.pil_save("page-…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@JorjMcKie
Comment options

Answer selected by JorjMcKie
Comment options

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

@YushuoGuan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1647 on March 21, 2022 10:43.