Feature Request: Save embedded images from PDFs as separate files with relative Markdown links

未关闭
#2,049 1 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #2056 来自 @theherrovn-sys —— 已关闭,未合并

评估

难度
5/5
预计耗时
一周以上
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
python

调研方向

从 MarkItDown 构造函数和 issue 中所示的入口点 convert("document.pdf") 开始,然后跟踪 PDF 转换路径和 CLI 命令。当两个接口都支持所请求的图像输出目录,并生成包含指向已提取图像文件的相对链接的 Markdown 时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Problem

When converting PDFs with embedded images to Markdown, markitdown currently either:

  • Truncates base64 data (showing ![](data:image/png;base64...)), or
  • Preserves full base64 inline (which makes the Markdown file very large and unsuitable for RAG/indexing)

For full-context RAG pipelines and document archival, I need:

  1. Embedded images extracted and saved as separate files (e.g. images/page3-figure1.png)
  2. Markdown references using relative paths: ![description](images/page3-figure1.png)
  3. Optional: image metadata/captions in front matter or inline comments
Use case
  • Converting technical documentation, datasheets, and PDFs with diagrams for AI/LLM ingestion
  • Preserving full document context including visual information
  • Keeping Markdown files lightweight and portable while still referencing images
Proposed behavior

Add a CLI flag and Python API option, for example:

markitdown document.pdf --extract-images --output-dir ./output
from markitdown import MarkItDown
md = MarkItDown(extract_images=True, output_dir="./output")
result = md.convert("document.pdf")
# result.markdown includes: 
# Actual image files saved to ./output/images/
Alternatives considered
  • Full base64 inline: makes files too large for indexing/LLM pipelines
  • Image descriptions only: loses visual context for diagrams, charts, schematics
  • Manual extraction: error-prone and not reproducible
Additional context
  • Related to issue #162 (closed) and PR #1140 (base64 preservation added)
  • Complements issue #1346 (LLM image descriptions for RAG)
  • Would benefit users working with schematics, datasheets, research papers, and technical documentation
Environment
  • markitdown version: 0.1.6
  • Python version: 3.11+
  • OS: macOS
主要语言
Python
星标
198k
派生
15k
平均合并
2 小时 16 分钟
30 天内合并 PR
9

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/markitdown 的其他 Issue

查看 microsoft/markitdown 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。