Use

Using an LLM with MarkItDown for image descriptions

Updated 2026-11-16·Upstream source ↗
Markdown view

MarkItDown can ask a vision model to describe a picture, so an image or a slide picture comes out as text instead of an empty placeholder. You pass it a client that speaks the OpenAI chat format and a model name, from Python. We tested this with two small local models and no key; we did not test any hosted service.

Short answer

From Python, with a local Ollama server:

Configdescribe_image.py
from openai import OpenAI
from markitdown import MarkItDown

client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
md = MarkItDown(llm_client=client, llm_model="qwen2.5vl:3b")
print(md.convert("chart.png").markdown)

The command line has no option for a client. Small models differ a lot: in our runs qwen2.5vl:3b described a chart correctly and moondream described it wrongly.

Tested with markitdown 0.1.9 · Python Ollama 0.40 on a 4-core CPU-only GitHub runner with moondream and qwen2.5vl:3b; no hosted model, no API key (T10) · 2026-11-16 · evidence: llm-providers.csv, llm-providers.json, qwen2.5vl-default-prompt-chart.md

How the call works

MarkItDown sends the image, as a data URI, together with a prompt to client.chat.completions.create(...) and puts the reply under a # Description: heading. The shape of the call is visible with a stand-in client that prints what it receives:

Pythonapi-llm-stub.py
from markitdown import MarkItDown

class Message:  # the minimum shape of an OpenAI-style response
    def __init__(self, text): self.content = text
class Choice:
    def __init__(self, text): self.message = Message(text)
class Reply:
    def __init__(self, text): self.choices = [Choice(text)]
class Completions:
    def create(self, model, messages, **kw):
        print("model:", model)
        parts = messages[0]["content"]
        print("prompt:", parts[0]["text"])
        print("image part:", parts[1]["type"], parts[1]["image_url"]["url"][:22] + "...")
        return Reply("A bar chart of quarterly revenue.")
class Chat: completions = Completions()
class StubClient: chat = Chat()

md = MarkItDown(llm_client=StubClient(), llm_model="any-model", llm_prompt="Describe the image in one sentence.")
print(md.convert("samples/chart.png").markdown)
Output · markitdown 0.1.9 · Python 3.13.18 · 2026-11-15
model: any-model
prompt: Describe the image in one sentence.
image part: image_url data:image/png;base64,...

# Description:
A bar chart of quarterly revenue.

captured result · A stand-in client that records what MarkItDown sends. Real providers are covered on the LLM page.

llm_prompt replaces the default prompt. Pictures inside a PowerPoint file are described the same way (PowerPoint).

Two local models, same images

Description cases on a 4-core CPU runner
ModelCaseImageSecondsWorkedDescription startsError
moondreamdefault promptchart.png8.9yes# Description: The image features a bar graph that displays the quarterly revenue of a company. The graph is divided into four bars, each representing a quarter of the year. The bars are colored in red, with the first ba
moondreamdefault promptphoto-exif.jpg7.9yes# Description: The image features a bar graph that displays quarterly revenue (Q4) for a company. The graph is divided into four bars, each representing a quarter of the year. The bars are colored in red, with the first
moondreamdefault promptscan-page.png7.0yes# Description: The image shows a page of a document that has been marked as "scanned" and "field station Alpha". The page is white and has a gray border. The text on the page is in black, and it appears to be a list of i
moondreamcustom promptchart.png8.1yes# Description: The image features a bar graph that displays the quarterly revenue of a company. The graph is divided into four bars, each representing a quarter of the year. The bars are colored in red, with the first ba
moondreamSpanish promptchart.png8.8yes# Description: The image features a bar graph that displays the quarterly revenue of a company. The graph is divided into four bars, each representing a quarter of the year. The height of each bar indicates the revenue g
moondreampptx with a picturepptx-nested-hidden-picture.pptx2.6yes<!-- Slide number: 1 --> # Nested bullets Level 0 Level 1 Level 2 Level 3 <!-- Slide number: 2 --> # Hidden slide <!-- Slide number: 3 --> # Picture without alt text ![The image features a bar graph that displays quar
qwen2.5vl:3bdefault promptchart.png31.9yes# Description: "Quarterly revenue (sample chart) shows a significant increase in Q4 compared to the other quarters, indicating a strong performance in the fourth quarter."
qwen2.5vl:3bdefault promptphoto-exif.jpg27.9yes# Description: "Quarterly Revenue Growth: A Sample Chart Showing a Steady Increase from Q1 to Q4"
qwen2.5vl:3bdefault promptscan-page.png91.0yes# Description: "Field Station Alpha: A Milestone in Environmental Monitoring - Rainfall Surges by 12% Year-on-Year, Highlighting the Precision and Reliability of Our Sensor Uptime, Which Reached an Exceptional 99.2%."
qwen2.5vl:3bcustom promptchart.png28.7yes# Description: The image is a bar chart titled "Quarterly revenue (sample chart)" with four bars representing Q1, Q2, Q3, and Q4.
qwen2.5vl:3bSpanish promptchart.png29.0yes# Description: Esta imagen muestra un gráfico de barras que representa los ingresos trimestrales (Q1, Q2, Q3, Q4) de una empresa, con Q4 mostrando el mayor ingreso.
qwen2.5vl:3bpptx with a picturepptx-nested-hidden-picture.pptx1.9yes<!-- Slide number: 1 --> # Nested bullets Level 0 Level 1 Level 2 Level 3 <!-- Slide number: 2 --> # Hidden slide <!-- Slide number: 3 --> # Picture without alt text !["Quarterly revenue chart showing a significant in
no-such-modelwrong model namechart.png0.0noNotFoundError: Error code: 404 - model 'no-such-model' not found
moondreamnothing listeningchart.png0.0noAPIConnectionError: Connection error.
moondreamtimeout of 1 mschart.png0.0noAPITimeoutError: Request timed out.
Description cases on a 4-core CPU runner Source: Test T10 · markitdown 0.1.9 · 2026-11-15 · llm-providers.csv · Download CSV

Our test chart is a bar chart in which the fourth quarter is the tallest bar:

qwen2.5vl:3b
# Description:
"Quarterly revenue (sample chart) shows a significant increase in Q4 compared to the other quarters, indicating a strong performance in the fourth quarter."
qwen2.5vl-default-prompt-chart.md · 171 bytes output (.md)
moondream
# Description:
The image features a bar graph that displays the quarterly revenue of a company. The graph is divided into four bars, each representing a quarter of the year. The bars are colored in red, with the first bar being the tallest and the last one being the shortest. The graph is set against a white background, making the colors of the bars stand out. The text "Quarterly revenue (sample chart)" is written above the graph, indicating that the graph is a sample chart representing the company's quarterly revenue.
moondream-default-prompt-chart.md · 524 bytes output (.md)

moondream was faster (about 8 seconds an image against 28 to 91) but wrote that the fourth bar was the shortest, which is wrong, and it gave the same long answer for a custom one-sentence prompt and for a Spanish prompt. qwen2.5vl:3b followed both. Check a model on your own images before trusting its descriptions.

What goes wrong

From the failure cases we provoked, all raised as Python exceptions from the client library:

  • A wrong model name: NotFoundError: Error code: 404 - model 'no-such-model' not found
  • No server listening: APIConnectionError: Connection error.
  • A timeout set too low: APITimeoutError: Request timed out.

Hosted models and Azure

We did not test OpenAI, Anthropic, Azure or any other hosted model, so we give no cost, speed or quality figures for them. Anything that exposes an OpenAI-compatible chat endpoint should be passable as the client, but we only verified Ollama.

Text inside images

A description is not a transcription. For text in scans, see OCR.