File contents PDF转图片Skill
任务目标
本Skill用于:将PDF文件的每一页转换为独立的图片文件
能力包含:PDF文件解析、图片格式转换(PNG/JPG)、可调分辨率输出
触发条件:用户需要将PDF转换为图片、提取PDF页面、图片化PDF内容等场景
前置准备
依赖说明:scripts脚本所需的依赖包及版本pymupdf>=1.23.0
操作步骤
标准流程:
准备PDF文件
确认PDF文件路径(使用 ./ 表示当前工作目录)
例如:./document.pdf
执行转换
查看输出
图片文件保存在指定的输出目录中
文件命名格式:page_001.png、page_002.png...
可选择是否生成ZIP压缩包
资源索引
必要脚本:见 scripts/convert_pdf_to_images.py(用途与参数:PDF转图片脚本)
注意事项
输入PDF文件必须存在且可读
输出目录必须具有写入权限
PDF页数限制 :暂支持100页以内的PDF文件,超过100页请拆分后转换
大型PDF文件转换可能需要较长时间,请耐心等待
故障排查
脚本找不到错误 :确保在Skill目录下执行,或使用相对路径 scripts/xxx.py
Python版本问题 :确保使用Python 3.6或更高版本
依赖缺失 :执行 pip install pymupdf>=1.23.0 安装依赖
页数超限错误 :PDF文件超过100页,请使用PDF工具拆分为多个小文件
使用示例
示例1:基本转换(PNG格式)
python scripts/convert_pdf_to_images.py \
--input ./report.pdf \
--output-dir ./images
示例2:使用JPG格式
python scripts/convert_pdf_to_images.py \
--input ./document.pdf \
--output-dir ./images \
--image-format jpg
示例3:高分辨率输出
python scripts/convert_pdf_to_images.py \
--input ./document.pdf \
--output-dir ./images \
--dpi 300
示例4:生成ZIP压缩包
python scripts/convert_pdf_to_images.py \
--input ./document.pdf \
--output-dir ./images \
--zip \
--zip-output ./images.zip
示例5:完整配置
python scripts/convert_pdf_to_images.py \
--input ./report.pdf \
--output-dir ./images \
--image-format jpg \
--dpi 200 \
--zip
1 --- 2 name: pdf-to-image-preview 3 description: Pdf To Image Preview 4 --- 5 6 # PDF转图片Skill 7 8 ## 任务目标 9 - 本Skill用于:将PDF文件的每一页转换为独立的图片文件 10 - 能力包含:PDF文件解析、图片格式转换(PNG/JPG)、可调分辨率输出 11 - 触发条件:用户需要将PDF转换为图片、提取PDF页面、图片化PDF内容等场景 12 13 ## 前置准备 14 - 依赖说明:scripts脚本所需的依赖包及版本 15 ``` 16 pymupdf>=1.23.0 17 ``` 18 19 ## 操作步骤 20 - 标准流程: 21 1. **准备PDF文件** 22 - 确认PDF文件路径(使用 `./` 表示当前工作目录) 23 - 例如:`./document.pdf` 24 25 2. **执行转换** 26 - 调用脚本将PDF文件的每一页转换为图片 27 - 命令示例: 28 ```bash 29 python scripts/convert_pdf_to_images.py \ 30 --input ./document.pdf \ 31 --output-dir ./images 32 ``` 33 - 可选参数: 34 - `--image-format`: 图片格式,支持 `png` 或 `jpg`,默认为 `png` 35 - `--dpi`: 图片分辨率(DPI),默认为 `200` 36 - `--zip`: 生成ZIP压缩包 37 - `--zip-output`: ZIP压缩包输出路径(默认:images.zip) 38 39 3. **查看输出** 40 - 图片文件保存在指定的输出目录中 41 - 文件命名格式:`page_001.png`、`page_002.png`... 42 - 可选择是否生成ZIP压缩包 43 44 ## 资源索引 45 - 必要脚本:见 [scripts/convert_pdf_to_images.py](scripts/convert_pdf_to_images.py)(用途与参数:PDF转图片脚本) 46 47 ## 注意事项 48 - 输入PDF文件必须存在且可读 49 - 输出目录必须具有写入权限 50 - **PDF页数限制**:暂支持100页以内的PDF文件,超过100页请拆分后转换 51 - 大型PDF文件转换可能需要较长时间,请耐心等待 52 53 ## 故障排查 54 - **脚本找不到错误**:确保在Skill目录下执行,或使用相对路径 `scripts/xxx.py` 55 - **Python版本问题**:确保使用Python 3.6或更高版本 56 - **依赖缺失**:执行 `pip install pymupdf>=1.23.0` 安装依赖 57 - **页数超限错误**:PDF文件超过100页,请使用PDF工具拆分为多个小文件 58 59 ## 使用示例 60 61 ### 示例1:基本转换(PNG格式) 62 ```bash 63 python scripts/convert_pdf_to_images.py \ 64 --input ./report.pdf \ 65 --output-dir ./images 66 ``` 67 68 ### 示例2:使用JPG格式 69 ```bash 70 python scripts/convert_pdf_to_images.py \ 71 --input ./document.pdf \ 72 --output-dir ./images \ 73 --image-format jpg 74 ``` 75 76 ### 示例3:高分辨率输出 77 ```bash 78 python scripts/convert_pdf_to_images.py \ 79 --input ./document.pdf \ 80 --output-dir ./images \ 81 --dpi 300 82 ``` 83 84 ### 示例4:生成ZIP压缩包 85 ```bash 86 python scripts/convert_pdf_to_images.py \ 87 --input ./document.pdf \ 88 --output-dir ./images \ 89 --zip \ 90 --zip-output ./images.zip 91 ``` 92 93 ### 示例5:完整配置 94 ```bash 95 python scripts/convert_pdf_to_images.py \ 96 --input ./report.pdf \ 97 --output-dir ./images \ 98 --image-format jpg \ 99 --dpi 200 \ 100 --zip 101 ```
wuchubuzai2018/expert-skills-hub/tree/main/skills/pdf-to-image-preview commit 411e2d4c29
Frequently asked questions How do I install the PDF To Image Preview skill? Run npx skillmds@latest add wuchubuzai2018/pdf-to-image-preview in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the PDF To Image Preview skill do? Pdf To Image Preview It is listed under Docs & Writing on SkillMD.
Is PDF To Image Preview safe to use? This skill has not completed SkillMD's automated safety review yet. Capability flags: executes scripts. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with PDF To Image Preview? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is PDF To Image Preview free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published PDF To Image Preview? wuchubuzai2018 (@wuchubuzai2018) published this skill. Their other Agent Skills are listed on their SkillMD profile.