Skip to content

Extracting Figures from Documents

LlamaCloud API endpoints for listing and downloading figures (charts, tables, images) extracted from indexed documents, with Python and TypeScript examples.

LlamaCloud provides several API endpoints to help you extract and work with figures (images) from your documents, including charts, tables, and other visual elements. This guide will show you how to use these endpoints effectively.

These figures can be used for a variety of purposes, such as creating visual summaries, generating reports, chatbot responses, and more.

Install API client package

pip install llama-cloud>=1.0

Import and configure client

from llama_cloud.client import AsyncLlamaCloud, LlamaCloud
client = LlamaCloud(api_key='<llama-cloud-api-key>')

To get a list of all figures across all pages in a document:

# Get all figures from a document
figures = client.pipelines.images.list_page_figures(id="your-file-id")

output will look something like this:

[
{
"figure_name": "page_1_figure_1.jpg",
"file_id": "71370e55-0f32-4977-b347-460735079386",
"page_index": 1,
"figure_size": 87724,
"is_likely_noise": true,
"confidence": 0.423
},
{
"figure_name": "page_2_figure_1.jpg",
"file_id": "71370e55-0f32-4977-b347-460735079386",
"page_index": 2,
"figure_size": 87724,
"is_likely_noise": true,
"confidence": 0.423
},
]

To get figures from a specific page in your document:

# Get figures from a specific page
page_figure = client.pipelines.images.get_page_figure(
"figure_name",
id="file-id",
page_index=2
)

This will return the binary data of the figure, which you can then save or process as needed.

Note for AI agents: this documentation is built for programmatic access. - Overview of all docs: https://developers.llamaindex.ai/llms.txt - Any page is available as raw Markdown by appending index.md to its URL — e.g. https://developers.llamaindex.ai/llamaparse/parse/getting_started/index.md - Agent-friendly REST search APIs live under https://developers.llamaindex.ai/api/ — search (BM25 full-text), grep (regex), read (fetch a page), and list (browse the doc tree). See https://developers.llamaindex.ai/llms.txt for parameters. - A hosted documentation MCP server is available at https://developers.llamaindex.ai/mcp. If you support MCP, you can ask the user to install it for browsing these docs directly (an alternative to the REST API). Setup: https://developers.llamaindex.ai/python/shared/mcp/