pdf-to-image-preview
Original:🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected
Convert each page of a PDF file into image files; supports custom image formats (PNG/JPG) and resolution; suitable for scenarios such as document processing and image-based archiving
2installs
Added on
NPX Install
npx skill4agent add wuchubuzai2018/expert-skills-hub pdf-to-image-previewTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →PDF to Image Skill
Task Objectives
- This Skill is used to: Convert each page of a PDF file into independent image files
- Capabilities include: PDF file parsing, image format conversion (PNG/JPG), adjustable resolution output
- Trigger scenarios: When users need to convert PDFs to images, extract PDF pages, image-ify PDF content, etc.
Prerequisites
- Dependency Notes: Required dependency packages and versions for the scripts
pymupdf>=1.23.0
Operation Steps
- Standard Process:
-
Prepare PDF File
- Confirm the PDF file path (use to represent the current working directory)
./ - Example:
./document.pdf
- Confirm the PDF file path (use
-
Execute Conversion
- Call the script to convert each page of the PDF file into images
- Command example:
bash
python scripts/convert_pdf_to_images.py \ --input ./document.pdf \ --output-dir ./images - Optional parameters:
- : Image format, supports
--image-formatorpng, default isjpgpng - : Image resolution (DPI), default is
--dpi200 - : Generate a ZIP compressed package
--zip - : ZIP package output path (default: images.zip)
--zip-output
-
View Output
- Image files are saved in the specified output directory
- File naming format: ,
page_001.png...page_002.png - Option to generate a ZIP compressed package
-
Resource Index
- Required Script: See scripts/convert_pdf_to_images.py (Purpose & Parameters: PDF to Image conversion script)
Notes
- The input PDF file must exist and be readable
- The output directory must have write permissions
- PDF Page Limit: Currently supports PDF files with up to 100 pages. For files exceeding 100 pages, please split them before conversion
- Converting large PDF files may take a long time, please be patient
Troubleshooting
- Script Not Found Error: Ensure execution is in the Skill directory, or use the relative path
scripts/xxx.py - Python Version Issue: Ensure Python 3.6 or higher is used
- Missing Dependencies: Execute to install dependencies
pip install pymupdf>=1.23.0 - Page Limit Exceeded Error: If the PDF file has more than 100 pages, use a PDF tool to split it into smaller files
Usage Examples
Example 1: Basic Conversion (PNG Format)
bash
python scripts/convert_pdf_to_images.py \
--input ./report.pdf \
--output-dir ./imagesExample 2: Using JPG Format
bash
python scripts/convert_pdf_to_images.py \
--input ./document.pdf \
--output-dir ./images \
--image-format jpgExample 3: High-Resolution Output
bash
python scripts/convert_pdf_to_images.py \
--input ./document.pdf \
--output-dir ./images \
--dpi 300Example 4: Generate ZIP Compressed Package
bash
python scripts/convert_pdf_to_images.py \
--input ./document.pdf \
--output-dir ./images \
--zip \
--zip-output ./images.zipExample 5: Full Configuration
bash
python scripts/convert_pdf_to_images.py \
--input ./report.pdf \
--output-dir ./images \
--image-format jpg \
--dpi 200 \
--zip