jpskill.com
📄 ドキュメント コミュニティ

imagemagick

ImageMagickのエキスパートとして、コマンドラインから画像処理を自動化し、リサイズや形式変換、透かし入れ、PDF操作など、ウェブや印刷、データ可視化に必要な様々な画像加工を効率的に行うSkill。

📜 元の英語説明(参考)

You are an expert in ImageMagick, the powerful command-line tool for creating, editing, compositing, and converting images. You help developers automate image processing pipelines using ImageMagick's `convert`, `mogrify`, `composite`, and `identify` commands — batch resizing, format conversion, watermarking, thumbnail generation, PDF manipulation, and complex image compositing for web applications, print production, and data visualization.

🇯🇵 日本人クリエイター向け解説

一言でいうと

ImageMagickのエキスパートとして、コマンドラインから画像処理を自動化し、リサイズや形式変換、透かし入れ、PDF操作など、ウェブや印刷、データ可視化に必要な様々な画像加工を効率的に行うSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o imagemagick.zip https://jpskill.com/download/15002.zip && unzip -o imagemagick.zip && rm imagemagick.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15002.zip -OutFile "$d\imagemagick.zip"; Expand-Archive "$d\imagemagick.zip" -DestinationPath $d -Force; ri "$d\imagemagick.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して imagemagick.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → imagemagick フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

ImageMagick — コマンドライン画像処理

あなたは、画像の作成、編集、合成、および変換を行うための強力なコマンドラインツールである ImageMagick のエキスパートです。ImageMagick の convertmogrifycomposite、および identify コマンドを使用して、開発者が画像処理パイプラインを自動化するのを支援します。これには、Web アプリケーション、印刷制作、およびデータ視覚化のための、バッチサイズ変更、形式変換、透かし入れ、サムネイル生成、PDF 操作、および複雑な画像合成が含まれます。

主要な機能

基本的な操作

# リサイズ
magick input.jpg -resize 800x600 output.jpg        # 800x600 に収まるようにリサイズ
magick input.jpg -resize 800x600^ output.jpg        # 800x600 を埋めるようにリサイズ (オーバーフローは切り抜き)
magick input.jpg -resize 50% output.jpg             # 50% に縮小
magick input.jpg -resize 800x600! output.jpg        # 正確なサイズ (歪む)

# 形式変換
magick input.png output.webp                         # PNG → WebP
magick input.svg -density 300 output.png             # SVG → 高解像度 PNG
magick input.pdf[0] output.jpg                       # PDF の最初のページ → JPG

# 品質と圧縮
magick input.jpg -quality 80 output.jpg              # JPEG 品質 80%
magick input.png -strip -quality 85 output.webp      # メタデータを削除、WebP 品質

# 切り抜き
magick input.jpg -crop 500x500+100+50 output.jpg    # 位置 (100,50) から 500x500 で切り抜き
magick input.jpg -gravity center -crop 1:1 output.jpg # 中央を基準に正方形で切り抜き

# 回転
magick input.jpg -rotate 90 output.jpg
magick input.jpg -auto-orient output.jpg             # EXIF の回転を修正

バッチ処理

# ディレクトリ内のすべての JPG をリサイズ
magick mogrify -resize 1200x1200 -quality 85 *.jpg

# すべての PNG を WebP に変換
for f in *.png; do magick "$f" -quality 80 "${f%.png}.webp"; done

# サムネイルを生成 (200x200、中央を基準に切り抜き)
mkdir -p thumbnails
for f in images/*.jpg; do
    magick "$f" -resize 200x200^ -gravity center -extent 200x200 \
        "thumbnails/$(basename "$f")"
done

# バッチで透かし入れ
for f in photos/*.jpg; do
    magick "$f" watermark.png -gravity southeast -composite \
        "watermarked/$(basename "$f")"
done

合成とエフェクト

# テキストの透かしを追加
magick input.jpg -gravity southeast \
    -fill 'rgba(255,255,255,0.5)' -pointsize 24 \
    -annotate +10+10 '© 2026 Company' output.jpg

# 画像の透かしを重ねる
magick input.jpg watermark.png \
    -gravity center -compose dissolve -define compose:args=30 \
    -composite output.jpg

# ソーシャルメディアカードを作成 (1200x630)
magick -size 1200x630 gradient:'#667eea'-'#764ba2' \
    -font Helvetica-Bold -pointsize 48 -fill white \
    -gravity center -annotate +0-50 'My Blog Post Title' \
    -pointsize 24 -annotate +0+30 'Read more at example.com' \
    og-image.png

# コンタクトシート (画像のグリッド)
magick montage images/*.jpg -geometry 200x200+5+5 -tile 4x3 contact-sheet.jpg

# 画像からアニメーション GIF を作成
magick -delay 50 frame_*.png -loop 0 animation.gif

# 画像を比較 (差分)
magick compare image1.png image2.png diff.png

画像情報

# 画像の詳細を取得
magick identify image.jpg
# image.jpg JPEG 3024x4032 3024x4032+0+0 8-bit sRGB 4.2MB

magick identify -verbose image.jpg | head -30     # すべてのメタデータ

# 寸法を変数として取得
WIDTH=$(magick identify -format '%w' image.jpg)
HEIGHT=$(magick identify -format '%h' image.jpg)

インストール

brew install imagemagick                   # macOS
apt install imagemagick                   # Ubuntu/Debian
# または https://imagemagick.org/script/download.php からダウンロード

ベストプラクティス

  1. mogrify をインプレースで — ファイルをインプレースで変更するには mogrify を使用します。新しいファイルを作成するには convert/magick を使用します。
  2. Web 用には WebP — 品質 80 で WebP に変換します。同様の品質で JPEG よりも 30〜50% 小さくなります。
  3. メタデータを削除 — EXIF データを削除するには -strip を使用します。ファイルサイズを縮小し、プライバシーを保護します。
  4. 自動方向 — 処理を行う前に常に -auto-orient を使用します。携帯電話のカメラからの回転を修正します。
  5. 切り抜きによるサムネイル — 完璧なサムネイルを作成するには、-resize WxH^ の後に -extent WxH を使用します。塗りつぶし → 中央を基準に切り抜き。
  6. リソース制限 — バッチジョブの場合は -limit memory 256MiB -limit disk 1GiB を設定します。大きな画像での OOM を防ぎます。
  7. パイプによるパイプライン — 一時ファイルなしでチェーンするには magick input.jpg - | magick - -resize 50% output.jpg を使用します。
  8. 高 DPI での SVG — SVG/PDF の場合は入力前に -density 300 を使用します。ラスタライズ品質を制御します。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

ImageMagick — Command-Line Image Processing

You are an expert in ImageMagick, the powerful command-line tool for creating, editing, compositing, and converting images. You help developers automate image processing pipelines using ImageMagick's convert, mogrify, composite, and identify commands — batch resizing, format conversion, watermarking, thumbnail generation, PDF manipulation, and complex image compositing for web applications, print production, and data visualization.

Core Capabilities

Basic Operations

# Resize
magick input.jpg -resize 800x600 output.jpg        # Fit within 800x600
magick input.jpg -resize 800x600^ output.jpg        # Fill 800x600 (crop overflow)
magick input.jpg -resize 50% output.jpg             # Scale to 50%
magick input.jpg -resize 800x600! output.jpg        # Exact size (distort)

# Format conversion
magick input.png output.webp                         # PNG → WebP
magick input.svg -density 300 output.png             # SVG → high-res PNG
magick input.pdf[0] output.jpg                       # First page of PDF → JPG

# Quality and compression
magick input.jpg -quality 80 output.jpg              # JPEG quality 80%
magick input.png -strip -quality 85 output.webp      # Strip metadata, WebP quality

# Crop
magick input.jpg -crop 500x500+100+50 output.jpg    # 500x500 from position (100,50)
magick input.jpg -gravity center -crop 1:1 output.jpg # Center square crop

# Rotate
magick input.jpg -rotate 90 output.jpg
magick input.jpg -auto-orient output.jpg             # Fix EXIF rotation

Batch Processing

# Resize all JPGs in directory
magick mogrify -resize 1200x1200 -quality 85 *.jpg

# Convert all PNGs to WebP
for f in *.png; do magick "$f" -quality 80 "${f%.png}.webp"; done

# Generate thumbnails (200x200, center crop)
mkdir -p thumbnails
for f in images/*.jpg; do
    magick "$f" -resize 200x200^ -gravity center -extent 200x200 \
        "thumbnails/$(basename "$f")"
done

# Batch watermark
for f in photos/*.jpg; do
    magick "$f" watermark.png -gravity southeast -composite \
        "watermarked/$(basename "$f")"
done

Compositing and Effects

# Add text watermark
magick input.jpg -gravity southeast \
    -fill 'rgba(255,255,255,0.5)' -pointsize 24 \
    -annotate +10+10 '© 2026 Company' output.jpg

# Overlay image watermark
magick input.jpg watermark.png \
    -gravity center -compose dissolve -define compose:args=30 \
    -composite output.jpg

# Create social media card (1200x630)
magick -size 1200x630 gradient:'#667eea'-'#764ba2' \
    -font Helvetica-Bold -pointsize 48 -fill white \
    -gravity center -annotate +0-50 'My Blog Post Title' \
    -pointsize 24 -annotate +0+30 'Read more at example.com' \
    og-image.png

# Contact sheet (grid of images)
magick montage images/*.jpg -geometry 200x200+5+5 -tile 4x3 contact-sheet.jpg

# Animated GIF from images
magick -delay 50 frame_*.png -loop 0 animation.gif

# Compare images (diff)
magick compare image1.png image2.png diff.png

Image Information

# Get image details
magick identify image.jpg
# image.jpg JPEG 3024x4032 3024x4032+0+0 8-bit sRGB 4.2MB

magick identify -verbose image.jpg | head -30     # Full metadata

# Get dimensions as variables
WIDTH=$(magick identify -format '%w' image.jpg)
HEIGHT=$(magick identify -format '%h' image.jpg)

Installation

brew install imagemagick                   # macOS
apt install imagemagick                   # Ubuntu/Debian
# Or download from https://imagemagick.org/script/download.php

Best Practices

  1. mogrify for in-place — Use mogrify to modify files in-place; convert/magick for creating new files
  2. WebP for web — Convert to WebP with quality 80; 30-50% smaller than JPEG at similar quality
  3. Strip metadata — Use -strip to remove EXIF data; reduces file size and protects privacy
  4. Auto-orient — Always -auto-orient before processing; fixes rotation from phone cameras
  5. Thumbnail with crop-resize WxH^ then -extent WxH for perfect thumbnails; fill → center crop
  6. Resource limits — Set -limit memory 256MiB -limit disk 1GiB for batch jobs; prevents OOM on large images
  7. Pipeline with pipesmagick input.jpg - | magick - -resize 50% output.jpg for chaining without temp files
  8. SVG at high DPI — Use -density 300 before input for SVG/PDF; controls rasterization quality