Formats

Images in MarkItDown: keep them, extract them, or describe them

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

By default MarkItDown keeps a placeholder for each picture, not the picture. What you can get instead depends on which of three things you need: the image data, the images as files, or a description in words.

Short answer

  • Keep the image data: the --keep-data-uris option.
Command
markitdown report.docx --keep-data-uris -o report.md
  • Save images as files: not built in; a tested script is below.
  • Describe images in words: configure an LLM client (setup and cost); results from two local models are below.
  • Text inside the images (screenshots, scans): OCR.

Tested with markitdown 0.1.9 · Python 3.13 · markitdown[all] 0.1.9 · ExifTool 12.76 · Linux lab; descriptions by two local vision models on a CPU-only runner (T10) · 2026-11-15 · evidence: office-features.csv, llm-providers.csv, images-features.jsonl, img-I10-exiftool.md

What happens to pictures by default

Pictures by source, one test file each, markitdown 0.1.9 (the keep_data_uris effect is in the note)
SourceResultWhat came outNote
DOCX picture without alt textchangedBefore↵↵![](data:image/png;base64...)↵↵AfterPlaceholder with the data cut off after base64. With keep_data_uris: 44 to 11246 characters.
DOCX picture with alt textchanged![A bar chart of quarterly revenue](data:image/png;base64...)Alt text kept; data cut off. With keep_data_uris: 61 to 11263 characters.
PPTX pictureschanged<!-- Slide number: 1 -->↵# Pictures↵↵![A bar chart of quarterly revenue](Picture2.jpg)↵↵![chart.png](Picture3.jpg)An image reference to a file name that is never written; the alt text or the original file name is the label. With keep_data_uris: 114 to 22542 characters.
XLSX picturelost## Sheet↵| Quarter | Revenue |↵| --- | --- |↵| Q1 | 10 |↵| Q2 | 14 |↵| Q3 | 9 |Pictures in workbooks are not output at all.
PDF picturelostText above a picture↵↵Text below the picture↵↵Pictures in PDFs are not output.
HTML inline data-URI imagechanged# Page↵↵Text↵↵![A chart](data:image/png;base64...)![Remote](https://example.org/remote.png)The inline image is truncated like Office images; the remote image keeps its URL and is not fetched. With keep_data_uris: 91 to 11293 characters.
EPUB imagechanged**Title:** Image book↵**Language:** en↵**Identifier:** x↵↵# Chapter↵↵Text before.↵↵![A chart](chart.png)See the excerpt for how the image reference looks.
PNG file on its ownchangedImageSize: 640x360↵With ExifTool installed: the size only. Without ExifTool the output is empty (row I10).
JPEG file on its ownchangedImageSize: 640x360↵Artist: MarkItDown pilot↵With ExifTool installed: the metadata fields it finds, no description of the picture.
JPEG without and with ExifToolchangedwithout: (empty) | with: ImageSize: 640x360↵Artist: MarkItDown pilot↵ExifTool 12.76; without ExifTool the output is empty.
GIF filelostUnsupportedFormatException: Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported.No converter.
BMP filelostUnsupportedFormatException: Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported.No converter.
TIFF filelostUnsupportedFormatException: Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported.No converter.
WEBP filelostUnsupportedFormatException: Could not convert stream to Markdown. No converter attempted a conversion, suggesting that the filetype is simply not supported.No converter.
SVG filechanged<svg xmlns="http://www.w3.org/2000/svg" width="40" height="20"><rect width="40" height="20" fill="red"/></svg>Echoed as XML source.
Pictures by source, one test file each, markitdown 0.1.9 (the keep_data_uris effect is in the note) Source: Test T07 · Linux lab · 2026-11-15 · office-features.csv · Download CSV

In short: Word, HTML and EPUB give an image reference, with the data cut off for Word and HTML; PowerPoint gives a reference to a file that is never written; Excel and PDF give nothing.

Why you see data:image/png;base64...

The ellipsis is deliberate truncation: the picture was in the file and was cut to save tokens. A Word file with one picture came out as 44 characters by default and 11,246 characters with the data kept:

DOCX picture, default
Before↵↵![](data:image/png;base64...)↵↵After
img-I01.md · 52 bytes output (.md)

Keep images in the output

The command-line flag and the Python keyword are the same option; the output of a Word file then starts like this (the flag is shown above):

markitdown 0.1.9 · Ubuntu 24.04 runner · Python 3.13 · 2026-11-15
$ markitdown docx-images-no-alt.docx --keep-data-uris
[exit 0] 1.10s  stdin=none
--- stdout (34508 bytes, first 2000)
# Images

![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAFoCAIAAABIUN0GAAAgmUlEQVR4nO3dd1yV5f/H8QsPIgii4g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EPDz9vODYx8VGN2g2cXdwPHzmWZQOatMTsi79z565LtVrOLu7nL1w0nH9SUlLN2g2dXdz3HziUaZQxbaIv749bt6bN+Fg3cf2GzUe/Oz4q6orh4kzaAIwv42lu3b597PhvhQoV6tI5iz5KTk5e+uPPPXr1r+nxUlU3j2Yt2vUfOHzFytUPHvypn8a8jfDqtejxE6c2atq6qptH0+ZtZ376+Z9//qWUSk9P37DRp7fXoFp1GlWvWb+316ADBw8/bSZRUVfGTZiim0njZi+/P/2j27fvGLPWOW83naCgM+MmTGne6hVX97p1GzTt3qvfgoVLnhZpxmwAOd+jG7zUwpjduVixYi+3bpmamurnz1Ww/MxSugABv504pfuHZ5csvtT0unp2XuW9JjU19UxwSJuXW5mxoC9mf7Nm3YaMQy5fjrx8OXLLFv+N672rV3cz/MjJU6cnT/0gOTlZ92NaWtp/LiU9Pf3/Zs1evmK1fkhKSsqZ4LNngs/6+Qeu/WW5nZ2dGUspU6a0Z5dOgdt2rFm34asvZ2Ua67c1IDHxUeXKlV5u3fI/K8xmicYU7+Tk2LpVi0OHj2728a0988NMc96xc09CYmLZsmXatmltdpsEnw2ZNmOm/jet2Li4bdt3HTp8LMBvo5ubqzErmCUzuiaT47+eUEq5ulYz/E3xyZMn/QYOCw0N1w/549atP27dOnHy1LlzF+Z9O0c30IyN8FTQmYyddev27ZWrfjl2/LdtW30mTZm2fcdu/ZRngs++PvKdpUsWeHbp
--- stderr

raw log

We confirmed the option on Word, PowerPoint and HTML. PDFs and workbooks have no pictures in the output to keep. Whether a Markdown viewer renders a data: image is a property of the viewer; we did not test any.

Save images as files with relative links

There is no built-in option in 0.1.9 (the command line has no such flag: CLI reference).

Our tested route

Convert with the data kept, decode each image, write it into an images folder and rewrite the link. This ran on a Word file, a PowerPoint file and an HTML page; it does nothing for EPUB, which already gives a file name, and we did not run it on the whole corpus:

Pythonapi-extract-images.py
import base64, re
from pathlib import Path
from markitdown import MarkItDown

def extract_images(source: str, out_dir: str = "images") -> str:
    """Convert with the image data kept, write every data: image to out_dir and point the Markdown at the files."""
    markdown = MarkItDown().convert(source, keep_data_uris=True).markdown
    Path(out_dir).mkdir(exist_ok=True)
    stem = Path(source).stem
    count = 0
    def save(match):
        nonlocal count
        count += 1
        ext = {"jpeg": "jpg", "svg+xml": "svg"}.get(match.group("kind"), match.group("kind"))
        name = f"{out_dir}/{stem}-{count}.{ext}"
        Path(name).write_bytes(base64.b64decode(match.group("data")))
        return f"![{match.group('alt')}]({name})"
    return re.sub(r"!\[(?P<alt>[^\]]*)\]\(data:image/(?P<kind>[a-z0-9.+-]+);base64,(?P<data>[A-Za-z0-9+/=]+)\)", save, markdown)

for source in ("samples/docx-image-alt.docx", "samples/pptx-pictures.pptx", "samples/img-inline.html"):
    result = extract_images(source)
    print(source, "->", [line for line in result.splitlines() if "images/" in line])
print(sorted(p.name for p in Path("images").iterdir()))
Output · markitdown 0.1.9 · Python 3.13.18 · 2026-11-15
samples/docx-image-alt.docx -> ['![A bar chart of quarterly revenue](images/docx-image-alt-1.png)']
samples/pptx-pictures.pptx -> ['![A bar chart of quarterly revenue](images/pptx-pictures-1.png)', '![chart.png](images/pptx-pictures-2.png)']
samples/img-inline.html -> ['![A chart](images/img-inline-1.png)![Remote](https://example.org/remote.png)']
['docx-image-alt-1.png', 'img-inline-1.png', 'pptx-pictures-1.png', 'pptx-pictures-2.png']

captured result

Pulling images straight from the file

Office files are ZIP archives and the pictures are in a media folder. This extracts them with standard tools, but there is no link from the Markdown to the image:

Pythonapi-extract-media.py
import zipfile

# Word, PowerPoint and Excel files are ZIP archives; the pictures are in a media folder
for name in ("samples/docx-image-alt.docx", "samples/pptx-pictures.pptx"):
    with zipfile.ZipFile(name) as z:
        print(name, [n for n in z.namelist() if "/media/" in n])
Output · markitdown 0.1.9 · Python 3.13.18 · 2026-11-15
samples/docx-image-alt.docx ['word/media/image1.png']
samples/pptx-pictures.pptx ['ppt/media/image1.png']

captured result

Plugins and the image hook

Since release 0.1.8 the DOCX, PPTX and XLSX converters expose an image hook that plugins can override; the OCR plugin uses it. We did not test a plugin that writes image files.

PDF images

MarkItDown does not extract them, and we did not test an external route.

Describe images with an LLM

It applies to JPEG and PNG files and to pictures in PowerPoint. The default prompt asks for a detailed description and you can pass your own. For an image file the description comes under a # Description: heading; in PowerPoint it is merged with the alt text inside the image reference (PowerPoint page). If the call fails the conversion raises an error (release 0.1.8 and later).

We ran two small vision models served by Ollama on a four-core CPU-only machine. No key, no hosted service:

qwen2.5vl:3b on the chart PNG, 32 seconds
# 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 on the chart PNG, 9 seconds
# 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)
The same image, default and custom prompts, two local models
ModelPromptSecondsDescription starts
moondreamdefault prompt8.9# 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
moondreamcustom prompt8.1# 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 prompt8.8# 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
qwen2.5vl:3bdefault prompt31.9# 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:3bcustom prompt28.7# Description: The image is a bar chart titled "Quarterly revenue (sample chart)" with four bars representing Q1, Q2, Q3, and Q4.
qwen2.5vl:3bSpanish prompt29.0# 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.
no-such-modelwrong model name0.0
moondreamnothing listening0.0
moondreamtimeout of 1 ms0.0
The same image, default and custom prompts, two local models Source: Test T10 · run 43763286968 · llm-providers.csv · Download CSV

Setup, providers and cost: the LLM page. Hosted models are not tested by us.

Converting a JPEG or PNG on its own

  • Without ExifTool and without an LLM client: exit code 0 and an empty output, for a PNG and for a JPEG with EXIF data.
  • With ExifTool installed: Field: value lines of the metadata ExifTool finds:
photo-exif.jpg with ExifTool
ImageSize: 640x360
Artist: MarkItDown pilot
img-I10-exiftool.md · 44 bytes output (.md)
  • ExifTool version: versions older than 12.24 are refused with an error that names CVE-2021-22204.

Reproduced by us

ImageConverter threw RuntimeError with message: ExifTool version 12.16 is vulnerable to CVE-2021-22204. Please upgrade to version 12.24 or later.

MarkItDown refuses to run an ExifTool older than 12.24.

Affected: 0.1.3 and later with ExifTool older than 12.24 · last reproduced 2026-11-15 · Upstream report

  • Installing it, and telling MarkItDown where it is with EXIFTOOL_PATH (a wrong path gave Failed to invoke exiftool at …; environment variables):
Command
winget install --id OliverBetz.ExifTool --exact
  • With an LLM client: the metadata plus the description.
  • Other image types: GIF, BMP, TIFF and WebP raise UnsupportedFormatException; convert them to PNG first (Pillow does it in one line). SVG is echoed as its XML source. We did not test HEIC. We did not test a file with GPS data, but ExifTool's output is printed as it comes, so check your files before sharing the Markdown.

Which route for which job

GoalRouteEffect on output
Archive a document with its picturesKeep data URIs, or extract the files with the scriptOutput grows, from 44 to 11,246 characters for one small picture
Feed a language model text onlyThe defaultPlaceholders only
Feed a multimodal modelExtract the files, send them separatelyText plus images
Make charts searchableAn LLM description, or PowerPoint charts (they become data tables)Text, at 9 to 90 seconds per image on a CPU
Scanned pagesOCRText from the image