Skip to main content
A minimal guide to inspecting what Cognee extracts from an image. Run it against a screenshot, a scanned page, or a dense chart to see exactly which text would reach the knowledge graph — before spending an ingestion run on it.

Before You Start

  • Complete Quickstart to understand basic operations
  • Ensure you have LLM Providers configured with a vision-capable LLM_MODEL — the transcription step calls it
  • Install the OCR engine: pip install "cognee[rapidocr]"
  • Read Loaders for how Cognee picks a loader per file and for the full set of image environment variables
  • Have an image file on disk. The script reads revenue_chart.png from the example’s multimedia_audio_image_processing_example_data/ directory in the Cognee repo — download it from there to reproduce the run exactly, or point image_path at your own file to check that one instead

Code in Action

What Just Happened

Step 1: Enable Extraction and OCR

ImageLoader is the loader remember() would pick for an image, imported directly here so you can call it on its own. IMAGE_EXTRACTION_ENABLED asks the vision model for entities, relationships, and verbatim text rather than a short caption; IMAGE_OCR_ENABLED adds a local OCR pass on top. Both are read when the image loads, and setdefault leaves any value you already set in the environment or .env untouched.

Step 2: Point at an Image File

The path is resolved relative to the script so the example runs from any working directory. Swap in a path to your own screenshot or scan to check what Cognee makes of it.

Step 3: Load the Image and Print the Text

load() runs the transcription and, when OCR is on, appends the recognized text to it. persist=False returns that text directly; the default persist=True writes it into Cognee’s data directory and returns the file path instead — useful in a pipeline, unhelpful when you just want to read the result.

Advanced Usage

The vision transcription comes first. If the OCR pass recognized anything, it follows under an [OCR extracted text] heading, so you can tell which half produced which text. OCR output is truncated at 8000 characters, and a failing OCR pass is logged and skipped rather than raising — so a result with no [OCR extracted text] block means OCR found nothing, was disabled, or failed.
To see what each stage contributes, run the script twice. IMAGE_OCR_ENABLED="false" gives the vision transcription alone; IMAGE_EXTRACTION_ENABLED="false" restores the legacy short-caption prompt. Both flags, and the transcription prompt and token-cap settings around them, are documented in Loaders.
Nothing here writes to memory. Once the extracted text looks right, pass the same image path to remember() — it selects ImageLoader for you and reads the same environment variables, so the text you just printed is the text that gets chunked and turned into graph memory.

Loaders

See every format Cognee reads and each image transcription setting

Remember

Ingest the image once its extracted text looks right