Skip to content

Can't extract images for this PDF #3948

Answered by JorjMcKie
bbfrog asked this question in Q&A
Discussion options

You must be logged in to vote

You can try this script. Or do this:

import pymupdf

doc = pymupdf.open("input.pdf")
for page in doc:
    for i, bbox in enumerate(page.cluster_drawings()):
        pix = page.get_pixmap(clip=bbox, dpi=150)
        pix.save(f"{doc.name}-{page.number}-{i}.png")

Replies: 5 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bbfrog
Comment options

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

@bbfrog
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
not a bug not a bug / user error / unable to reproduce
2 participants
Converted from issue

This discussion was converted from issue #3936 on October 15, 2024 19:57.