Skip to content

Extract an entire image, without splitting it into smaller ones #5120

Closed

Description

@molokanov50

Hello,

To extract images from a PDF, I use the code according to your readme (see Recipes -> Extract all images from a PDF). But instead the entire upper image (see page 4 of the attached file), I receive 15 smaller ones, with various icons and black rectangles being treated as separate images.
In the other attachment, I showed the entire image I would like to extract. Note that the image area has some text layer bboxes. I partially highlighted the text layer to make the situation clear.
Is it possible in PyMuPDF to extract this image entirely and not to add smaller images included in the entire image area to the result? If yes, what code / which options should I use? If not, why?

Image

Externalization.pdf

Activity

  1. JorjMcKie commented on Sep 16, 2026

    @JorjMcKie
    Collaborator

    As the displayed text on the page suggests: there is no such thing as the "entire image" - it is a cognitive artifact created by the mind of the viewer - i.e. by you.
    Technically, there exists a mixture of text, vector graphics and images in that region. And even viewers may have different opinions about what we are looking at: maybe two "images" - each of the yellow regions being a separate one?
    These are all separate pdf objects. There exists no information whatsoever that they semantically belong together.
    If you extract the page with pymupdf4llm you will probably (haven't confirmed it yet) find that its layout function has classified the area as a "figure" and saved it like a screen print using the Pixmap of the area.

  2. JorjMcKie commented on Sep 21, 2026

    @JorjMcKie
    Collaborator

    Moving this Discussions because no library issue is present.

  3. locked and limited conversation to collaborators on Sep 21, 2026
  4. converted this issue into a discussion #5128 on Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    not a bugnot a bug / user error / unable to reproduce

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions