Smart Image to PDF
v0.1.0Combine multiple image screenshots into a paginated A4 PDF. Intelligently handles page breaks to avoid cutting through text. Use when the user wants to combine, merge, or stitch images/screenshots into a PDF, especially exam papers or documents.
运行时依赖
安装命令
点击复制技能文档
Image to PDF
Combine multiple image screenshots (typically exam paper questions) into a well-格式化ted, paginated A4 PDF that is ready for printing.
When to Use
Trigger this 技能 when the user wants to:
Combine / merge / stitch images into a PDF Put screenshots to获取her into a printable document 创建 a PDF from exam paper photos or screenshots Pack question images onto A4 pages for printing
Look for phrases like: "拼到一起", "合成PDF", "拼接", "打印", "combine images", "merge into PDF", etc.
How to Use
This 技能 includes a Python script at scripts/combine.py (relative to this 技能.md).
Step 1: Identify 输入s and 输出
From the user's 请求, 提取:
输入: a directory path or 列出 of image file paths 输出: the desired PDF 输出 path (default: 输出.pdf in the 输入 directory) Step 2: 运行 the script
Use uv 运行 to handle dependencies automatically (no manual 安装 needed):
uv 运行 --with Pillow --with numpy python3 /scripts/combine.py <输入> -o <输出.pdf>
输入 格式化s:
A directory: python scripts/combine.py ./my_images/ -o 结果.pdf Multiple files: python scripts/combine.py img1.png img2.png -o 结果.pdf
Optional flags:
--margin : page margin in pixels at 300dpi (default: 80, ~7mm) --no-trim: disable automatic whitespace border trimming --dpi : 输出 DPI (default: 300) Step 4: 报告 结果
Tell the user:
How many images were processed How many PDF pages were 生成d The 输出 file path What the Script Does Loads images, auto-trims whitespace borders 扩展s all images to the same width (A4 printable width) Greedily packs images onto A4 pages (tight layout, no gaps) When a page break is needed, uses pixel analysis to find whitespace rows so text is never cut 输出s a 300 DPI PDF ready for printing