liveBook · Manning

Page image

As explained in Retrieval Augmented Generation, The Foundational Ideas

A page image is a rendered visual representation of an entire document page.

A page image preserves visual information that text extraction can lose, especially when an answer lives in a figure, table, or scan. Attach the rendered page to the generation context when only a few pages need visual recovery; use a visual index when parsing fails across the corpus. section 15.6.5

Choose the least costly visual strategy that addresses the failure mode:

  • Parse and rerank by default for strong text retrieval with one vector per chunk. section 15.6.5
  • Attach a page image at query time when visual content may contain the answer and indexing changes are undesirable. section 15.6.5
  • Build a visual index only when parsing failures are widespread, accepting additional maintenance and model constraints. section 15.6.5

Answering from a rendered page

Render a selected PDF page with PyMuPDF, encode the PNG as base64, and send it with a question to an image-capable chat model. A clipped upper portion can target a figure, such as asking which tasks it shows and what input each task uses.

How Retrieval Augmented Generation, The Foundational Ideas covers it

How deep it goes
Explains query-time rendering, clipping, encoding, and visual-index selection, but stops short of visual-index implementation.
Examples
Demonstrates a clipped PDF page containing a figure and questions its tasks and example inputs.
What it assumes
Assumes PDF handling and message construction, while demonstrating page rendering and image attachment directly.
What you can do after
Builds a query-time multimodal message from a selected PDF page using PyMuPDF and base64 encoding.
How it connects
Connects page images with text extraction, reranking, multimodal embeddings, and visual indexes.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Retrieval Augmented Generation, The Foundational Ideas. The section links point to the parts of the book it draws on.