Agent Skills by ALSEL
汎用音声・動画・メディア⭐ リポ 3品質スコア 56/100

convert_pdf_to_images

Anthropicからインポートされたスキル「PDFを画像に変換」です。このスキルを使用することで、PDFファイルを複数の画像ファイルに変換できます。EC事業では商品カタログやマニュアルのPDF形式での資料を、Web表示用の画像形式に効率的に変換する際に活用できます。

description の原文を見る

Imported skill convert_pdf_to_images from anthropic

SKILL.md 本文

convert_pdf_to_images


description: anthropic から インポートされたスキル convert_pdf_to_images name: convert_pdf_to_images signature: 095a0105a718af75ede309cb03f84a20c81d17f1727f7686fd4b294f1f40294f source: /a0/tmp/skills_research/anthropic/skills/pdf/scripts/convert_pdf_to_images.py

import os
import sys

from pdf2image import convert_from_path


# Converts each page of a PDF to a PNG image.


def convert(pdf_path, output_dir, max_dim=1000):
    images = convert_from_path(pdf_path, dpi=200)

    for i, image in enumerate(images):
        # Scale image if needed to keep width/height under `max_dim`
        width, height = image.size
        if width > max_dim or height > max_dim:
            scale_factor = min(max_dim / width, max_dim / height)
            new_width = int(width * scale_factor)
            new_height = int(height * scale_factor)
            image = image.resize((new_width, new_height))
        
        image_path = os.path.join(output_dir, f"page_{i+1}.png")
        image.save(image_path)
        print(f"Saved page {i+1} as {image_path} (size: {image.size})")

    print(f"Converted {len(images)} pages to PNG images")


if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("Usage: convert_pdf_to_images.py [input pdf] [output directory]")
        sys.exit(1)
    pdf_path = sys.argv[1]
    output_directory = sys.argv[2]
    convert(pdf_path, output_directory)

説明

PDFの各ページをPNG画像に変換するスキルです。入力されたPDFファイルの全ページを個別の画像ファイルとして出力ディレクトリに保存します。画像の幅または高さが指定された最大寸法を超える場合は、自動的にスケーリングされます。

ライセンス: MIT(寛容ライセンスのため全文を引用しています) · 原本リポジトリ

詳細情報

作者
bitwikiorg
リポジトリ
bitwikiorg/skills.md
ライセンス
MIT
最終更新
2026/1/20

Source: https://github.com/bitwikiorg/skills.md / ライセンス: MIT

本サイトは GitHub 上で公開されているオープンソースの SKILL.md ファイルをクロール・インデックス化したものです。 各スキルの著作権は原作者に帰属します。掲載に問題がある場合は info@alsel.co.jp または /takedown フォームよりご連絡ください。
原作者: bitwikiorg · bitwikiorg/skills.md · ライセンス: MIT