jpskill.com
🎨 画像AI コミュニティ

gemini-imagegen

テキストから画像を生成したり、既存の画像を編集したり、複数の参照画像から新しい画像を構成したりするSkill。

📜 元の英語説明(参考)

This skill should be used when generating and editing images using the Gemini API (Nano Banana Pro). It applies when creating images from text prompts, editing existing images, applying style transfers, generating logos with text, creating stickers, product mockups, or any image generation/manipulation task. Supports text-to-image, image editing, multi-turn refinement, and composition from multiple reference images.

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

一言でいうと

テキストから画像を生成したり、既存の画像を編集したり、複数の参照画像から新しい画像を構成したりするSkill。

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

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

🎯 この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-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

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

Gemini 画像生成 (Nano Banana Pro)

Google の Gemini API を使用して画像を生成および編集します。環境変数 GEMINI_API_KEY を設定する必要があります。

デフォルトモデル

モデル 解像度 最適な用途
gemini-3-pro-image-preview 1K-4K すべての画像生成 (デフォルト)

注: 常にこの Pro モデルを使用してください。明示的に要求された場合にのみ、別のモデルを使用してください。

クイックリファレンス

デフォルト設定

  • モデル: gemini-3-pro-image-preview
  • 解像度: 1K (デフォルト、オプション: 1K, 2K, 4K)
  • アスペクト比: 1:1 (デフォルト)

利用可能なアスペクト比

1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9

利用可能な解像度

1K (デフォルト), 2K, 4K

コア API パターン

import os
from google import genai
from google.genai import types

client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])

# Basic generation (1K, 1:1 - defaults)
response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=["Your prompt here"],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
    ),
)

for part in response.parts:
    if part.text:
        print(part.text)
    elif part.inline_data:
        image = part.as_image()
        image.save("output.png")

カスタム解像度とアスペクト比

from google.genai import types

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=[prompt],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
        image_config=types.ImageConfig(
            aspect_ratio="16:9",  # Wide format
            image_size="2K"       # Higher resolution
        ),
    )
)

解像度の例

# 1K (default) - Fast, good for previews
image_config=types.ImageConfig(image_size="1K")

# 2K - Balanced quality/speed
image_config=types.ImageConfig(image_size="2K")

# 4K - Maximum quality, slower
image_config=types.ImageConfig(image_size="4K")

アスペクト比の例

# Square (default)
image_config=types.ImageConfig(aspect_ratio="1:1")

# Landscape wide
image_config=types.ImageConfig(aspect_ratio="16:9")

# Ultra-wide panoramic
image_config=types.ImageConfig(aspect_ratio="21:9")

# Portrait
image_config=types.ImageConfig(aspect_ratio="9:16")

# Photo standard
image_config=types.ImageConfig(aspect_ratio="4:3")

画像の編集

既存の画像をテキストプロンプトとともに渡します。

from PIL import Image

img = Image.open("input.png")
response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=["Add a sunset to this scene", img],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
    ),
)

マルチターンでの洗練

チャットを使用して反復的な編集を行います。

from google.genai import types

chat = client.chats.create(
    model="gemini-3-pro-image-preview",
    config=types.GenerateContentConfig(response_modalities=['TEXT', 'IMAGE'])
)

response = chat.send_message("Create a logo for 'Acme Corp'")
# Save first image...

response = chat.send_message("Make the text bolder and add a blue gradient")
# Save refined image...

プロンプトのベストプラクティス

写真のようなシーン

レンズの種類、照明、角度、ムードなど、カメラの詳細を含めます。

"A photorealistic close-up portrait, 85mm lens, soft golden hour light, shallow depth of field"

スタイライズされたアート

スタイルを明示的に指定します。

"A kawaii-style sticker of a happy red panda, bold outlines, cel-shading, white background"

画像内のテキスト

フォントスタイルと配置を明示的に指定します。

"Create a logo with text 'Daily Grind' in clean sans-serif, black and white, coffee bean motif"

製品モックアップ

照明設定と表面を記述します。

"Studio-lit product photo on polished concrete, three-point softbox setup, 45-degree angle"

高度な機能

Google 検索グラウンディング

リアルタイムデータに基づいて画像を生成します。

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=["Visualize today's weather in Tokyo as an infographic"],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
        tools=[{"google_search": {}}]
    )
)

複数の参照画像 (最大 14 枚)

複数のソースから要素を組み合わせます。

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=[
        "Create a group photo of these people in an office",
        Image.open("person1.png"),
        Image.open("person2.png"),
        Image.open("person3.png"),
    ],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
    ),
)

重要: ファイル形式とメディアタイプ

重要: Gemini API はデフォルトで JPEG 形式で画像を返します。保存する際は、メディアタイプの不一致を避けるため、常に .jpg 拡張子を使用してください。

# CORRECT - Use .jpg extension (Gemini returns JPEG)
image.save("output.jpg")

# WRONG - Will cause "Image does not match media type" errors
image.save("output.png")  # Creates JPEG with PNG extension!

PNG への変換 (必要な場合)

PNG 形式が特に必要な場合:

from PIL import Image

# Generate with Gemini
for part in response.parts:
    if part.inline_data:
        img = part.as_image()
        # Convert to PNG by saving with explicit format
        img.save("output.png", format="PNG")

画像形式の確認

file コマンドで実際の形式と拡張子を確認します。

file image.png
# If output shows "JPEG image data" - rename to .jpg!

注意事項

  • 生成されたすべての画像には SynthID ウォーターマークが含まれます
  • Gemini はデフォルトで JPEG 形式を返します - 常に .jpg 拡張子を使用してください
  • 画像のみモード (responseModalities: ["IMAGE"]) は Google 検索グラウンディングでは機能しません
  • 編集の場合、変更点を会話形式で記述してください。モデルはセマンティックマスキングを理解します
  • 速度のためにデフォルトで 1K 解像度を使用し、2K/4K を使用します

(原文がここで切り詰められています)

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

Gemini Image Generation (Nano Banana Pro)

Generate and edit images using Google's Gemini API. The environment variable GEMINI_API_KEY must be set.

Default Model

Model Resolution Best For
gemini-3-pro-image-preview 1K-4K All image generation (default)

Note: Always use this Pro model. Only use a different model if explicitly requested.

Quick Reference

Default Settings

  • Model: gemini-3-pro-image-preview
  • Resolution: 1K (default, options: 1K, 2K, 4K)
  • Aspect Ratio: 1:1 (default)

Available Aspect Ratios

1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9

Available Resolutions

1K (default), 2K, 4K

Core API Pattern

import os
from google import genai
from google.genai import types

client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])

# Basic generation (1K, 1:1 - defaults)
response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=["Your prompt here"],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
    ),
)

for part in response.parts:
    if part.text:
        print(part.text)
    elif part.inline_data:
        image = part.as_image()
        image.save("output.png")

Custom Resolution & Aspect Ratio

from google.genai import types

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=[prompt],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
        image_config=types.ImageConfig(
            aspect_ratio="16:9",  # Wide format
            image_size="2K"       # Higher resolution
        ),
    )
)

Resolution Examples

# 1K (default) - Fast, good for previews
image_config=types.ImageConfig(image_size="1K")

# 2K - Balanced quality/speed
image_config=types.ImageConfig(image_size="2K")

# 4K - Maximum quality, slower
image_config=types.ImageConfig(image_size="4K")

Aspect Ratio Examples

# Square (default)
image_config=types.ImageConfig(aspect_ratio="1:1")

# Landscape wide
image_config=types.ImageConfig(aspect_ratio="16:9")

# Ultra-wide panoramic
image_config=types.ImageConfig(aspect_ratio="21:9")

# Portrait
image_config=types.ImageConfig(aspect_ratio="9:16")

# Photo standard
image_config=types.ImageConfig(aspect_ratio="4:3")

Editing Images

Pass existing images with text prompts:

from PIL import Image

img = Image.open("input.png")
response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=["Add a sunset to this scene", img],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
    ),
)

Multi-Turn Refinement

Use chat for iterative editing:

from google.genai import types

chat = client.chats.create(
    model="gemini-3-pro-image-preview",
    config=types.GenerateContentConfig(response_modalities=['TEXT', 'IMAGE'])
)

response = chat.send_message("Create a logo for 'Acme Corp'")
# Save first image...

response = chat.send_message("Make the text bolder and add a blue gradient")
# Save refined image...

Prompting Best Practices

Photorealistic Scenes

Include camera details: lens type, lighting, angle, mood.

"A photorealistic close-up portrait, 85mm lens, soft golden hour light, shallow depth of field"

Stylized Art

Specify style explicitly:

"A kawaii-style sticker of a happy red panda, bold outlines, cel-shading, white background"

Text in Images

Be explicit about font style and placement:

"Create a logo with text 'Daily Grind' in clean sans-serif, black and white, coffee bean motif"

Product Mockups

Describe lighting setup and surface:

"Studio-lit product photo on polished concrete, three-point softbox setup, 45-degree angle"

Advanced Features

Google Search Grounding

Generate images based on real-time data:

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=["Visualize today's weather in Tokyo as an infographic"],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
        tools=[{"google_search": {}}]
    )
)

Multiple Reference Images (Up to 14)

Combine elements from multiple sources:

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents=[
        "Create a group photo of these people in an office",
        Image.open("person1.png"),
        Image.open("person2.png"),
        Image.open("person3.png"),
    ],
    config=types.GenerateContentConfig(
        response_modalities=['TEXT', 'IMAGE'],
    ),
)

Important: File Format & Media Type

CRITICAL: The Gemini API returns images in JPEG format by default. When saving, always use .jpg extension to avoid media type mismatches.

# CORRECT - Use .jpg extension (Gemini returns JPEG)
image.save("output.jpg")

# WRONG - Will cause "Image does not match media type" errors
image.save("output.png")  # Creates JPEG with PNG extension!

Converting to PNG (if needed)

If you specifically need PNG format:

from PIL import Image

# Generate with Gemini
for part in response.parts:
    if part.inline_data:
        img = part.as_image()
        # Convert to PNG by saving with explicit format
        img.save("output.png", format="PNG")

Verifying Image Format

Check actual format vs extension with the file command:

file image.png
# If output shows "JPEG image data" - rename to .jpg!

Notes

  • All generated images include SynthID watermarks
  • Gemini returns JPEG format by default - always use .jpg extension
  • Image-only mode (responseModalities: ["IMAGE"]) won't work with Google Search grounding
  • For editing, describe changes conversationally—the model understands semantic masking
  • Default to 1K resolution for speed; use 2K/4K when quality is critical