Use
Using an LLM with MarkItDown for image descriptions
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:
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:
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)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
| Model | Case | Image | Seconds | Worked | Description starts | Error |
|---|---|---|---|---|---|---|
moondream | default prompt | chart.png | 8.9 | yes | # 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 | |
moondream | default prompt | photo-exif.jpg | 7.9 | yes | # 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 | |
moondream | default prompt | scan-page.png | 7.0 | yes | # 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 | |
moondream | custom prompt | chart.png | 8.1 | yes | # 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 | |
moondream | Spanish prompt | chart.png | 8.8 | yes | # 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 | |
moondream | pptx with a picture | pptx-nested-hidden-picture.pptx | 2.6 | yes | <!-- 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:3b | default prompt | chart.png | 31.9 | yes | # 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:3b | default prompt | photo-exif.jpg | 27.9 | yes | # Description: "Quarterly Revenue Growth: A Sample Chart Showing a Steady Increase from Q1 to Q4" | |
qwen2.5vl:3b | default prompt | scan-page.png | 91.0 | yes | # 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:3b | custom prompt | chart.png | 28.7 | yes | # Description: The image is a bar chart titled "Quarterly revenue (sample chart)" with four bars representing Q1, Q2, Q3, and Q4. | |
qwen2.5vl:3b | Spanish prompt | chart.png | 29.0 | yes | # 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:3b | pptx with a picture | pptx-nested-hidden-picture.pptx | 1.9 | yes | <!-- 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-model | wrong model name | chart.png | 0.0 | no | NotFoundError: Error code: 404 - model 'no-such-model' not found | |
moondream | nothing listening | chart.png | 0.0 | no | APIConnectionError: Connection error. | |
moondream | timeout of 1 ms | chart.png | 0.0 | no | APITimeoutError: Request timed out. |
Our test chart is a bar chart in which the fourth quarter is the tallest bar:
# Description:
"Quarterly revenue (sample chart) shows a significant increase in Q4 compared to the other quarters, indicating a strong performance in the fourth quarter."Description:
"Quarterly revenue (sample chart) shows a significant increase in Q4 compared to the other quarters, indicating a strong performance in the fourth quarter."
# 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.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 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.