Batch Merging Local Images into PDF Documents: Converting Images to PDF with Agent Skill

Foreword

When scanning exam papers, archiving contracts, or organizing mobile photos, a common requirement is to merge multiple images from the same directory into a single PDF. Doing this manually by dragging files into Preview or online tools one by one often scrambles the file order; additionally, photos taken vertically on a phone may carry EXIF orientation data, resulting in rotated pages in the final PDF. While writing your own script can handle batch processing, the cost is too high for scenarios where you “just want to generate a PDF,” as it requires checking libraries and adjusting parameters every time.

Below, we introduce the community Skill from SkillHub, “Batch Merge Local Images into PDF Documents” (本地图片批量合并为 PDF 文档). This allows Agents supporting Skills to perform the merge locally according to a predefined workflow, without the need for separate API Key configuration.

What is this

Batch Merge Local Images into PDF Documents (ID @user_c11cceac/img2pdf, version 1.0.0) is a skill from the SkillHub community, categorized under office-efficiency, and maintained by the publisher user_c11cceac.

The official page positions it as a tool to batch merge local images into a PDF document and labels it with requires_api_key=false, indicating it does not rely on external API keys. SkillHub display page URLs:

  • https://www.skillhub.cn/skills/user_c11cceac/img2pdf
  • API Entry: https://api.skillhub.cn/user_c11cceac/img2pdf

Core Functions

The following capabilities are derived from the official introduction; implementation details not explicitly expanded upon on the page are not speculated upon:

  1. Batch Merge: Combines multiple local images into a single PDF file.
  2. EXIF Orientation Correction: Automatically processes photo orientation information to minimize the issue of vertically shot images appearing sideways in the PDF.
  3. Sort by Filename Number: The merge order is based on numbers within the filenames, suitable for naming conventions like 001.jpg, 002.jpg.
  4. Large Batch Support: The official description states support for processing 200+ images at once.

Common trigger phrases (listed officially): image to PDF, merge images to PDF, combine images into PDF, images to pdf, batch image PDF, exam paper image PDF, photo to PDF, turn images into PDF.

Installation and Activation

Installation follows the SkillHub page and installation documentation: first, ensure the skillhub CLI is available, then install the skill into the skills directory recognizable by the current Agent.

1. Check or Install SkillHub CLI

command -v skillhub && skillhub --version

If not installed, execute the full installation (CLI + Default Skills) via the official installation documentation:

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

To install only the CLI:

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash -s -- --cli-only

Note: When executing the above commands in restricted network environments, access to the installation script and object storage addresses must be allowed.

2. Install this Skill

The official page specifies: Please install @user_c11cceac/img2pdf according to https://skillhub.cn/install/skillhub.md.

When installing the skill, you must use --dir to point to the current Agent’s skills directory; if installed to the default ./skills/ and the Agent is not configured for this path, the skill may fail to load. Common path examples provided in the documentation:

Environment skills Directory (Example)
Cursor ~/.cursor/skills/
Claude Code ~/.claude/skills/
Codex ~/.codex/skills/ or .agents/skills/ under the project

Installation command format (replace <skills directory> with the corresponding path from the table above):

skillhub install user_c11cceac/img2pdf --dir <skills directory>

The ID format can also match the SkillHub page using @user_c11cceac/img2pdf; specific validity depends on the package name format supported by the current skillhub install. After installation, restart or refresh the Agent as required by your client to activate the Skill.

Typical Usage

This Skill is designed for conversational triggering: provided the Agent has loaded this Skill, use natural language to specify the image path and the desired output PDF path or filename, including one of the official trigger words. For example:

  • “Merge images in /path/to/scans into a PDF in order, output to /path/to/output.pdf.”
  • “Batch image PDF: merge these exam paper photos and correct the mobile shooting orientation.”

The Agent will read images locally, sort them, and generate the PDF according to the steps defined within the Skill. Since the page does not disclose a fixed CLI subcommand or script name, it is inappropriate to assume the underlying invocation method; defer to the actual operations performed by the Agent after executing the Skill instructions.

Suggestions before use:

  1. Ensure image filenames contain sortable numbers to match the “Sort by Filename Number” capability.
  2. For large batches (e.g., approaching or exceeding 200 images), pay attention to disk space and generation duration.

Applicable Scenarios & Notes

Who it is for

  • Office scenarios requiring the quick conversion of scans, screenshots, or photo folders into a single PDF (exam paper archiving, document submission, local backup).
  • Users working within clients like Cursor, Claude Code, or Codex that support SkillHub skills and wish to complete the conversion within the same conversational workflow.

Limitations & Precautions

  • The skill processes images on local paths; remote images or resources not downloaded to the local machine must be saved locally first.
  • The merge order depends on filename numbers; if naming is chaotic, the output page order may not match expectations. Sort filenames beforehand.
  • The official introduction does not list supported image formats; if a specific format fails, try common formats (e.g., JPEG, PNG) or check the SKILL.md inside the Skill package (located in the corresponding subpath of the skills directory after installation).
  • Statistics displayed on the SkillHub page (rating, downloads, installations) change over time; at the time of writing, the page data showed a rating of 100000, 2996 downloads, and 49 installations. Refer to the values displayed when you open the page.

Conclusion

“Batch Merge Local Images into PDF Documents” integrates EXIF correction, filename-based sorting, and large-scale batch merging into an Agent Skill. It is suitable for completing image-to-PDF conversion locally without an API Key. To install from the store or view instructions, please visit:

https://www.skillhub.cn/skills/user_c11cceac/img2pdf

Installation Guide: https://skillhub.cn/install/skillhub.md

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye