jpskill.com
📦 その他 コミュニティ

gemini-imagen

GoogleのGemini Imagen APIを活用し、ユーザーがテキストで指示した内容に基づいて、イメージの作成や生成、視覚化を自然な形で行い、要望に沿った画像を生成するSkill。

📜 元の英語説明(参考)

Generate images from text prompts using Google's Gemini Imagen API. This skill should be used when the user requests image creation, generation, or visualization from text descriptions (e.g., "create an image of...", "generate a picture showing...", "make me an image for...").

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

一言でいうと

GoogleのGemini Imagen APIを活用し、ユーザーがテキストで指示した内容に基づいて、イメージの作成や生成、視覚化を自然な形で行い、要望に沿った画像を生成するSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して gemini-imagen.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → gemini-imagen フォルダができる
  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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Gemini Imagen

概要

このスキルは、Google の Gemini Imagen API を使用して、テキストプロンプトから画像を生成できるようにします。API認証、リクエストのフォーマット、レスポンスの処理、および適切なエラー処理による画像の自動保存を処理する再利用可能なスクリプトを提供します。

このスキルを使用する場面

ユーザーが以下を要求する場合に、このスキルを使用します。

  • テキストによる説明から画像を作成または生成する
  • AIによって生成された画像を通じて、コンセプト、シーン、またはオブジェクトを視覚化する
  • 画像コンセプトの複数のバリエーションを生成する
  • 特定のアスペクト比または品質レベルで画像を作成する

リクエストの例:

  • "Generate an image of a sunset over mountains"
  • "Create a logo concept showing a geometric bird"
  • "Make me an image of a futuristic city at night in 16:9 ratio"
  • "Generate 3 variations of a robot painting artwork"

構成

APIキーの設定

Gemini API は、認証に API キーが必要です。Google AI Studio からキーを取得してください。

推奨されるアプローチ: API キーを環境変数として保存します。

export GEMINI_API_KEY="your-api-key-here"

または、スクリプトを呼び出すときにキーを直接渡します(共有環境では安全性が低下します)。

Python の依存関係

このスクリプトには、次の Python パッケージが必要です。

  • requests - API 呼び出し用の HTTP クライアント
  • Pillow - 画像処理ライブラリ

これらは、プロジェクトの共有仮想環境に含まれています。実行する前にアクティブ化してください。

source .venv/bin/activate  # On Windows: .venv\Scripts\activate

画像の生成

基本的な使い方

デフォルト設定で単一の画像を生成するには:

python scripts/generate_image.py "your prompt here" --api-key $GEMINI_API_KEY

スクリプトは以下を行います。

  1. プロンプトを Gemini Imagen API に送信します
  2. 生成された画像を受信してデコードします
  3. タイムスタンプ付きのファイル名で画像を保存します (例: gemini_image_20231123_142530_1.png)
  4. 進行状況とファイルパスを表示します

高度なオプション

モデルの選択

3つの品質/速度の段階から選択します。

# Fast generation (default) - 最速、高品質
--model imagen-4.0-fast-generate-001

# Standard generation - バランスの取れた速度と品質
--model imagen-4.0-generate-001

# Ultra generation - 最高品質、低速
--model imagen-4.0-ultra-generate-001

アスペクト比

さまざまな寸法で画像を生成します。

# Square (default)
--aspect-ratio 1:1

# Portrait orientations
--aspect-ratio 3:4
--aspect-ratio 9:16

# Landscape orientations
--aspect-ratio 4:3
--aspect-ratio 16:9

複数画像

1つのリクエストで最大4つのバリエーションを生成します。

--num 4

出力ディレクトリ

生成された画像の保存場所を指定します。

--output ./generated_images

完全な例

高品質の風景画像を生成する:

python scripts/generate_image.py \
  "Majestic mountain range at golden hour with dramatic clouds" \
  --api-key $GEMINI_API_KEY \
  --model imagen-4.0-ultra-generate-001 \
  --aspect-ratio 16:9 \
  --output ./landscapes

複数のロゴのバリエーションを作成する:

python scripts/generate_image.py \
  "Minimalist geometric logo for tech startup, blue and white" \
  --api-key $GEMINI_API_KEY \
  --num 4 \
  --aspect-ratio 1:1 \
  --output ./logo_concepts

クイックソーシャルメディアグラフィック:

python scripts/generate_image.py \
  "Abstract colorful pattern for social media background" \
  --api-key $GEMINI_API_KEY \
  --aspect-ratio 9:16 \
  --output ./social_media

ワークフローの統合

ユーザーが画像の生成をリクエストした場合:

  1. ユーザーのリクエストからプロンプトを抽出します
  2. コンテキストに基づいてパラメータを決定します。
    • アスペクト比 (ロゴの場合は正方形、プレゼンテーションの場合は 16:9 など)
    • バリエーションの数 (ユーザーがオプションを希望する場合)
    • 品質層 (最終出力の場合はウルトラ、イテレーションの場合は高速)
  3. 適切なパラメータでスクリプトを呼び出します
  4. 生成された画像をユーザーに表示し、ファイルパスを提供します
  5. 必要に応じて、洗練されたプロンプトまたは異なるパラメータで反復します

ベストプラクティス

プロンプトエンジニアリング

  • 具体的かつ記述的にする: スタイル、照明、構成、色に関する詳細を含めます
  • 必要に応じてアートスタイルを指定する: "digital art"、"oil painting"、"photorealistic"、"minimalist"
  • 重要な要素について言及する: オブジェクト、被写体、背景、雰囲気
  • 品質キーワードを含める: "high detail"、"professional"、"award-winning"

良いプロンプトの例:

"A serene Japanese garden with cherry blossoms in full bloom, koi pond in foreground, traditional stone lantern, soft morning light, photorealistic style, high detail"

基本的なプロンプトの例 (機能するが、制御が少ない):

"Japanese garden"

モデルの選択

  • 高速モデル: プロトタイピング、イテレーション、クイックプレビュー、大量生成
  • 標準モデル: 汎用画像、バランスの取れた品質と速度
  • ウルトラモデル: 最終出力、クライアントプレゼンテーション、高リスクのビジュアル

エラー処理

スクリプトは一般的なエラーを処理します。

  • 無効な API キー → API キーの構成を確認してください
  • ネットワークタイムアウト → インターネット接続を確認し、リクエストを再試行してください
  • レート制限 → 待ってから再試行するか、同時リクエストを減らすことを検討してください
  • 無効なパラメータ → モデル名、アスペクト比、および num_images の値を確認してください

出力形式

生成された画像は、次の PNG ファイルとして保存されます。

  • 命名規則: gemini_image_YYYYMMDD_HHMMSS_N.png
  • タイムスタンプ: 実行間で一意のファイル名を保証します
  • 連番: 複数の画像を生成する場合
  • SynthID ウォーターマーク: Imagen API によって自動的に埋め込まれます

リソース

scripts/generate_image.py

以下を処理するメインの画像生成スクリプト:

  • API 認証とリクエストのフォーマット
  • Base64 画像のデコードと PIL 処理
  • タイムスタンプ付きの自動ファイル保存
  • 包括的なエラー処理とユーザーフィードバック
  • すべてのカスタマイズオプションを備えたコマンドラインインターフェース

コマンドラインから直接呼び出すか、より大きなワークフローに統合します。

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

Gemini Imagen

Overview

This skill enables image generation from text prompts using Google's Gemini Imagen API. It provides a reusable script that handles API authentication, request formatting, response processing, and automatic image saving with proper error handling.

When to Use This Skill

Use this skill when the user requests:

  • Creating or generating images from text descriptions
  • Visualizing concepts, scenes, or objects through AI-generated imagery
  • Producing multiple variations of an image concept
  • Creating images with specific aspect ratios or quality levels

Example requests:

  • "Generate an image of a sunset over mountains"
  • "Create a logo concept showing a geometric bird"
  • "Make me an image of a futuristic city at night in 16:9 ratio"
  • "Generate 3 variations of a robot painting artwork"

Configuration

API Key Setup

The Gemini API requires an API key for authentication. Obtain a key from Google AI Studio.

Recommended approach: Store the API key as an environment variable:

export GEMINI_API_KEY="your-api-key-here"

Alternatively, pass the key directly when invoking the script (less secure for shared environments).

Python Dependencies

The script requires these Python packages:

  • requests - HTTP client for API calls
  • Pillow - Image processing library

These are included in the project's shared virtual environment. Activate it before running:

source .venv/bin/activate  # On Windows: .venv\Scripts\activate

Generating Images

Basic Usage

To generate a single image with default settings:

python scripts/generate_image.py "your prompt here" --api-key $GEMINI_API_KEY

The script will:

  1. Send the prompt to the Gemini Imagen API
  2. Receive and decode the generated image(s)
  3. Save images with timestamped filenames (e.g., gemini_image_20231123_142530_1.png)
  4. Display progress and file paths

Advanced Options

Model Selection

Choose from three quality/speed tiers:

# Fast generation (default) - quickest, good quality
--model imagen-4.0-fast-generate-001

# Standard generation - balanced speed and quality
--model imagen-4.0-generate-001

# Ultra generation - highest quality, slower
--model imagen-4.0-ultra-generate-001

Aspect Ratios

Generate images in different dimensions:

# Square (default)
--aspect-ratio 1:1

# Portrait orientations
--aspect-ratio 3:4
--aspect-ratio 9:16

# Landscape orientations
--aspect-ratio 4:3
--aspect-ratio 16:9

Multiple Images

Generate up to 4 variations in a single request:

--num 4

Output Directory

Specify where to save generated images:

--output ./generated_images

Complete Examples

Generate a high-quality landscape image:

python scripts/generate_image.py \
  "Majestic mountain range at golden hour with dramatic clouds" \
  --api-key $GEMINI_API_KEY \
  --model imagen-4.0-ultra-generate-001 \
  --aspect-ratio 16:9 \
  --output ./landscapes

Create multiple logo variations:

python scripts/generate_image.py \
  "Minimalist geometric logo for tech startup, blue and white" \
  --api-key $GEMINI_API_KEY \
  --num 4 \
  --aspect-ratio 1:1 \
  --output ./logo_concepts

Quick social media graphic:

python scripts/generate_image.py \
  "Abstract colorful pattern for social media background" \
  --api-key $GEMINI_API_KEY \
  --aspect-ratio 9:16 \
  --output ./social_media

Workflow Integration

When a user requests image generation:

  1. Extract the prompt from the user's request
  2. Determine parameters based on context:
    • Aspect ratio (square for logos, 16:9 for presentations, etc.)
    • Number of variations (if user wants options)
    • Quality tier (ultra for final outputs, fast for iteration)
  3. Invoke the script with appropriate parameters
  4. Show the generated images to the user and provide file paths
  5. Iterate if needed with refined prompts or different parameters

Best Practices

Prompt Engineering

  • Be specific and descriptive: Include details about style, lighting, composition, colors
  • Specify art style if desired: "digital art", "oil painting", "photorealistic", "minimalist"
  • Mention important elements: Objects, subjects, background, atmosphere
  • Include quality keywords: "high detail", "professional", "award-winning"

Example good prompt:

"A serene Japanese garden with cherry blossoms in full bloom, koi pond in foreground, traditional stone lantern, soft morning light, photorealistic style, high detail"

Example basic prompt (works but less controlled):

"Japanese garden"

Model Selection

  • Fast model: Prototyping, iteration, quick previews, high-volume generation
  • Standard model: General-purpose images, balanced quality and speed
  • Ultra model: Final outputs, client presentations, high-stakes visuals

Error Handling

The script handles common errors:

  • Invalid API keys → Check API key configuration
  • Network timeouts → Verify internet connection, retry request
  • Rate limiting → Wait and retry, consider reducing simultaneous requests
  • Invalid parameters → Review model name, aspect ratio, and num_images values

Output Format

Generated images are saved as PNG files with:

  • Naming convention: gemini_image_YYYYMMDD_HHMMSS_N.png
  • Timestamp: Ensures unique filenames across runs
  • Sequential numbering: When generating multiple images
  • SynthID watermark: Automatically embedded by Imagen API

Resources

scripts/generate_image.py

The main image generation script that handles:

  • API authentication and request formatting
  • Base64 image decoding and PIL processing
  • Automatic file saving with timestamps
  • Comprehensive error handling and user feedback
  • Command-line interface with all customization options

Invoke directly from the command line or integrate into larger workflows.