jpskill.com
✍️ ライティング コミュニティ

baoyu-compress-image

画像ファイルをWebP形式に変換し、PNG形式も扱える、クロスプラットフォーム対応の画像圧縮Skillで、システム標準ツールに加え、Sharpも利用して高品質な圧縮を実現するSkill。

📜 元の英語説明(参考)

Cross-platform image compression skill. Converts images to WebP by default with PNG-to-PNG support. Uses system tools (sips, cwebp, ImageMagick) with Sharp fallback.

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

一言でいうと

画像ファイルをWebP形式に変換し、PNG形式も扱える、クロスプラットフォーム対応の画像圧縮Skillで、システム標準ツールに加え、Sharpも利用して高品質な圧縮を実現するSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して baoyu-compress-image.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → baoyu-compress-image フォルダができる
  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
同梱ファイル
2

📖 Skill本文(日本語訳)

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

画像圧縮ツール

WebPをデフォルト出力とし、PNGからPNGへの対応、システムツールを優先し、Sharpをフォールバックとして使用するクロスプラットフォームの画像圧縮ツールです。

スクリプトディレクトリ

重要: すべてのスクリプトは、このスキル内の scripts/ サブディレクトリにあります。

エージェント実行手順:

  1. この SKILL.md ファイルのディレクトリパスを SKILL_DIR として特定します。
  2. スクリプトパス = ${SKILL_DIR}/scripts/<script-name>.ts
  3. このドキュメント内のすべての ${SKILL_DIR} を実際のパスに置き換えます。

スクリプト参照: | スクリプト | 目的 | |--------|---------| | scripts/main.ts | 画像圧縮のためのCLIエントリポイント |

クイックスタート

# WebPに圧縮(デフォルト)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png

# 元の形式を保持(PNG → PNG)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --format png

# カスタム品質
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png -q 75

# ディレクトリを処理
npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/ -r

コマンド

単一ファイルの圧縮

# 基本(WebPに変換し、元のファイルを置き換えます)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png

# カスタム出力パス
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png -o compressed.webp

# 元のファイルを保持
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --keep

# カスタム品質(0-100、デフォルト: 80)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png -q 75

# 元の形式を保持
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png -f png

ディレクトリ処理

# ディレクトリ内のすべての画像を処理
npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/

# 再帰処理
npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/ -r

# カスタム品質で
npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/ -r -q 75

出力形式

# プレーンテキスト(デフォルト)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png

# JSON出力
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --json

オプション

オプション 短縮形 説明 デフォルト
<input> 入力ファイルまたはディレクトリ 必須
--output <path> -o 出力パス 同じパス、新しい拡張子
--format <fmt> -f webp, png, jpeg webp
--quality <n> -q 品質 0-100 80
--keep -k 元のファイルを保持 false
--recursive -r ディレクトリを再帰的に処理 false
--json JSON出力 false
--help -h ヘルプを表示

圧縮ツールの選択

優先順位(自動検出):

  1. sips (macOS内蔵、macOS 11以降でWebPをサポート)
  2. cwebp (Google公式のWebPツール)
  3. ImageMagick (convert コマンド)
  4. Sharp (npmパッケージ、Bunによって自動インストールされます)

このスキルは、利用可能な最適な圧縮ツールを自動的に選択します。

出力形式

テキストモード(デフォルト)

image.png → image.webp (245KB → 89KB, 64% reduction)

JSONモード

{
  "input": "image.png",
  "output": "image.webp",
  "inputSize": 250880,
  "outputSize": 91136,
  "ratio": 0.36,
  "compressor": "sips"
}

ディレクトリJSONモード

{
  "files": [...],
  "summary": {
    "totalFiles": 10,
    "totalInputSize": 2508800,
    "totalOutputSize": 911360,
    "ratio": 0.36,
    "compressor": "sips"
  }
}

単一画像を圧縮

npx -y bun ${SKILL_DIR}/scripts/main.ts photo.png
# photo.png → photo.webp (1.2MB → 340KB, 72% reduction)

カスタム品質で圧縮

npx -y bun ${SKILL_DIR}/scripts/main.ts photo.png -q 60
# photo.png → photo.webp (1.2MB → 280KB, 77% reduction)

元の形式を保持

npx -y bun ${SKILL_DIR}/scripts/main.ts screenshot.png -f png --keep
# screenshot.png → screenshot-compressed.png (500KB → 380KB, 24% reduction)

ディレクトリ全体を処理

npx -y bun ${SKILL_DIR}/scripts/main.ts ./screenshots/ -r
# Processed 15 files: 12.5MB → 4.2MB (66% reduction)

スクリプト用のJSONを取得

npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --json | jq '.ratio'

拡張機能のサポート

EXTEND.md を介したカスタム設定。

パスの確認(優先順位):

  1. .baoyu-skills/baoyu-compress-image/EXTEND.md (プロジェクト)
  2. ~/.baoyu-skills/baoyu-compress-image/EXTEND.md (ユーザー)

見つかった場合、ワークフローの前にロードされます。拡張機能の内容はデフォルトを上書きします。

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Image Compressor

Cross-platform image compression with WebP default output, PNG-to-PNG support, preferring system tools with Sharp fallback.

Script Directory

Important: All scripts are located in the scripts/ subdirectory of this skill.

Agent Execution Instructions:

  1. Determine this SKILL.md file's directory path as SKILL_DIR
  2. Script path = ${SKILL_DIR}/scripts/<script-name>.ts
  3. Replace all ${SKILL_DIR} in this document with the actual path

Script Reference: | Script | Purpose | |--------|---------| | scripts/main.ts | CLI entry point for image compression |

Quick Start

# Compress to WebP (default)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png

# Keep original format (PNG → PNG)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --format png

# Custom quality
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png -q 75

# Process directory
npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/ -r

Commands

Single File Compression

# Basic (converts to WebP, replaces original)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png

# Custom output path
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png -o compressed.webp

# Keep original file
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --keep

# Custom quality (0-100, default: 80)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png -q 75

# Keep original format
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png -f png

Directory Processing

# Process all images in directory
npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/

# Recursive processing
npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/ -r

# With custom quality
npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/ -r -q 75

Output Formats

# Plain text (default)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png

# JSON output
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --json

Options

Option Short Description Default
<input> Input file or directory Required
--output <path> -o Output path Same path, new extension
--format <fmt> -f webp, png, jpeg webp
--quality <n> -q Quality 0-100 80
--keep -k Keep original file false
--recursive -r Process directories recursively false
--json JSON output false
--help -h Show help

Compressor Selection

Priority order (auto-detected):

  1. sips (macOS built-in, WebP support since macOS 11)
  2. cwebp (Google's official WebP tool)
  3. ImageMagick (convert command)
  4. Sharp (npm package, auto-installed by Bun)

The skill automatically selects the best available compressor.

Output Format

Text Mode (default)

image.png → image.webp (245KB → 89KB, 64% reduction)

JSON Mode

{
  "input": "image.png",
  "output": "image.webp",
  "inputSize": 250880,
  "outputSize": 91136,
  "ratio": 0.36,
  "compressor": "sips"
}

Directory JSON Mode

{
  "files": [...],
  "summary": {
    "totalFiles": 10,
    "totalInputSize": 2508800,
    "totalOutputSize": 911360,
    "ratio": 0.36,
    "compressor": "sips"
  }
}

Examples

Compress single image

npx -y bun ${SKILL_DIR}/scripts/main.ts photo.png
# photo.png → photo.webp (1.2MB → 340KB, 72% reduction)

Compress with custom quality

npx -y bun ${SKILL_DIR}/scripts/main.ts photo.png -q 60
# photo.png → photo.webp (1.2MB → 280KB, 77% reduction)

Keep original format

npx -y bun ${SKILL_DIR}/scripts/main.ts screenshot.png -f png --keep
# screenshot.png → screenshot-compressed.png (500KB → 380KB, 24% reduction)

Process entire directory

npx -y bun ${SKILL_DIR}/scripts/main.ts ./screenshots/ -r
# Processed 15 files: 12.5MB → 4.2MB (66% reduction)

Get JSON for scripting

npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --json | jq '.ratio'

Extension Support

Custom configurations via EXTEND.md.

Check paths (priority order):

  1. .baoyu-skills/baoyu-compress-image/EXTEND.md (project)
  2. ~/.baoyu-skills/baoyu-compress-image/EXTEND.md (user)

If found, load before workflow. Extension content overrides defaults.

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。