SkillsGrove
SkillsGrove/Офисные документы/crazynomad/skills/pdf-to-images

pdf-to-images

Установка

$npx skills add https://github.com/crazynomad/skills --skill pdf-to-images
$git clone --depth 1 https://github.com/crazynomad/skills.git /tmp/skills && mkdir -p ~/.claude/skills && cp -r /tmp/skills/pdf-to-images ~/.claude/skills/pdf-to-images
Пожалуйста, установи для меня этот Agent Skill: https://github.com/crazynomad/skills/tree/2bc470fc08b47b63af8c1721058672ad0678ab78/pdf-to-images — сначала прочитай его SKILL.md и скрипты и устанавливай в мою папку навыков только после того, как убедишься, что он безопасен.

Кратко

Исходное описание · MITConvert PDF files into a series of images (PNG/JPG) using ImageMagick
Приведённый ниже SKILL.md воспроизведён из crazynomad/skills (коммит 2bc470f) под лицензией MIT. Текст не изменён; опущены только метаданные заголовка файла, изображения показаны как ссылки, а очень длинные файлы сокращены. Авторские права: 2026 Burn Wang. Лицензия: LICENSE. Показан только файл с инструкциями; скрипты смотрите в исходном репозитории.

PDF to Images Converter

Convert PDF files into a series of images using ImageMagick.

Description

A simple yet powerful tool that converts PDF documents into individual PNG images, one per page. Useful for extracting slides from presentations, creating image previews, or processing PDF content for further analysis.

When to Use

Use this skill when users:

  • Want to convert PDF to images
  • Need to extract slides from PDF presentations
  • Mention "PDF 转图片", "拆解 PDF", "PDF to PNG"
  • Want to create image previews from PDF documents
  • Need individual page images from multi-page PDFs

Features

  • ImageMagick Powered: Industry-standard image processing
  • Configurable DPI: Adjust output resolution (default: 150 DPI)
  • Multiple Formats: Support PNG, JPG, TIFF output
  • Batch Processing: Handles multi-page PDFs automatically
  • Sequential Naming: Output files named with page numbers (slide-00, slide-01, etc.)

Usage

Basic Syntax

python scripts/pdf_to_images.py "PDF_FILE" [-o OUTPUT_DIR] [-d DPI] [-f FORMAT]

Common Scenarios

Convert PDF to PNG images (default):

python scripts/pdf_to_images.py "presentation.pdf"

Specify output directory:

python scripts/pdf_to_images.py "document.pdf" -o ./output-images

High resolution output (300 DPI):

python scripts/pdf_to_images.py "document.pdf" -d 300

Output as JPEG:

python scripts/pdf_to_images.py "document.pdf" -f jpg -q 90

Arguments

  • pdf_file (required): Path to the PDF file
  • -o, --output: Output directory (default: same directory as PDF, with -slides suffix)
  • -d, --dpi: Resolution in DPI (default: 150)
  • -f, --format: Output format: png, jpg, tiff (default: png)
  • -q, --quality: JPEG quality 1-100 (default: 85, only for jpg format)
  • -p, --prefix: Output filename prefix (default: slide)

Dependencies

Requires ImageMagick installed on the system:

macOS:

brew install imagemagick

Ubuntu/Debian:

sudo apt-get install imagemagick

Windows: Download from https://imagemagick.org/script/download.php

Output Structure

output-directory/
├── slide-00.png    # Page 1
├── slide-01.png    # Page 2
├── slide-02.png    # Page 3
└── ...

Claude Integration

When user requests PDF to images conversion:

  1. Check ImageMagick availability:

    which magick || which convert
    
  2. Execute conversion:

    python /mnt/skills/user/pdf-to-images/scripts/pdf_to_images.py \
      "USER_PDF_FILE" -o /mnt/user-data/outputs -d 150
    
  3. Present files to user:

    present_files(["/mnt/user-data/outputs/..."])
    

How It Works

Workflow

  1. Validation: Check PDF file exists and ImageMagick is available
  2. Create Output Directory: Create output folder if not exists
  3. Convert: Use ImageMagick to convert each page to image
  4. Report: Display generated files and total count

ImageMagick Command

The script uses:

magick -density {DPI} "{input.pdf}" "{output_dir}/{prefix}-%02d.{format}"

Or for older ImageMagick (v6):

convert -density {DPI} "{input.pdf}" "{output_dir}/{prefix}-%02d.{format}"

Limitations

  • Requires ImageMagick installed on system
  • Large PDFs may take time to process
  • Memory usage depends on PDF complexity and DPI setting
  • Some secured PDFs may not be convertible

Common Issues

Q: Getting "convert: not authorized" error? A: Edit ImageMagick policy file to allow PDF reading:

sudo sed -i 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/' /etc/ImageMagick-*/policy.xml

Q: Output images are too small/large? A: Adjust DPI with -d flag. 150 DPI is good for screen, 300 DPI for print.

Q: Conversion is slow? A: Lower DPI reduces processing time. Try -d 100 for faster conversion.

Example Conversation

User: "帮我把这个 PDF 拆解成图片: presentation.pdf"

Claude:

# Check ImageMagick
which magick || which convert

# Convert PDF to images
python /mnt/skills/user/pdf-to-images/scripts/pdf_to_images.py \
  "presentation.pdf" \
  -o ./presentation-slides \
  -d 150

# Present files
present_files(["./presentation-slides/slide-00.png", ...])

Version History

v1.0 (Current)

  • ImageMagick-based PDF conversion
  • Configurable DPI and format
  • Automatic output directory creation
  • Support for PNG, JPG, TIFF formats

License

Personal use tool. Respects PDF document copyrights.

Полный текст лицензии (MIT)
MIT License

Copyright (c) 2026 Burn Wang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.