agentleFS
yangwhaleyangwhale/CloseCrab/skills/imagen-generator/SKILL.md

imagen-generator

Skill5 starsChanged 3 months agoApache-2.0View on GitHub

Generate or edit images using Gemini 3 Pro Image (Nano Banana) on Vertex AI. Use for text-to-image ("生成图片", "画一张", "generate image", "帮我画", "create an image", "图片生成") and image-to-image editing ("修图", "P图", "改图", "edit image", "在这张图上加 ...", "基于这张图 ...", "保持风格生成 ...").

  • Installs packages

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Call the generation script directly:

    line 16
  2. Very specific:

    When called from Discord context, send the URL using send-to-discord.sh --plain

    line 82

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Gemini Image Generator (Nano Banana)

Generate or edit images using Gemini 3 Pro Image (gemini-3-pro-image) on Vertex AI, save to CC Pages, and share.

Two modes:

  • Text-to-image — pure prompt, model invents from scratch
  • Image-to-image (修图) — pass --image <path> one or more times; model treats them as visual baselines and the text prompt as the editing instruction (preserve / add / remove / restyle)

Usage

Call the generation script directly:

~/.claude/skills/imagen-generator/scripts/imagen-generate.sh "your prompt here"

Options

# Basic generation (1 image, 1:1 aspect ratio, 1K resolution)
~/.claude/skills/imagen-generator/scripts/imagen-generate.sh "a cute cat sitting on a GPU server"

# Custom aspect ratio: 1:1, 3:4, 4:3, 16:9, 9:16, 3:2, 2:3, 4:5, 5:4, 21:9, 4:1, 1:4, 8:1, 1:8
~/.claude/skills/imagen-generator/scripts/imagen-generate.sh "TPU pod in a datacenter" --aspect 16:9

# Multiple images (1-4, generated sequentially)
~/.claude/skills/imagen-generator/scripts/imagen-generate.sh "neural network visualization" --count 2

# Resolution: 1K (default), 2K, 4K
~/.claude/skills/imagen-generator/scripts/imagen-generate.sh "landscape photo" --resolution 2K

# Custom output filename
~/.claude/skills/imagen-generator/scripts/imagen-generate.sh "logo design" --output my-logo

# Override model (default: gemini-3-pro-image)
~/.claude/skills/imagen-generator/scripts/imagen-generate.sh "photo" --model gemini-3.1-flash-image

# Combine options
~/.claude/skills/imagen-generator/scripts/imagen-generate.sh "B200 GPU rack in datacenter, photorealistic" --aspect 16:9 --resolution 2K --count 2

Image-to-Image (修图)

Pass --image <path> to provide a visual baseline. The text prompt becomes the editing instruction (what to keep, what to add, what to change). Repeat --image for multiple references — first one is the primary baseline.

# 在一张图上加元素,保持原风格
~/.claude/skills/imagen-generator/scripts/imagen-generate.sh \
  "Keep the cyberpunk style unchanged. Add a glowing holographic dashboard in the upper-left corner showing 4 floating cards." \
  --image ~/CloseCrab/crab-with-claude-code-inside.png \
  --aspect 4:5 --resolution 2K --output poster-with-cards

# 多参考图:第一张是主 baseline,后面是风格/元素参考
~/.claude/skills/imagen-generator/scripts/imagen-generate.sh \
  "Combine subject of first image with the lighting and color palette of second image" \
  --image subject.png --image style_ref.png \
  --aspect 16:9 --resolution 2K

# 改 aspect 重构图(recompose)— 模型会保留主体,重新构图填满目标比例
~/.claude/skills/imagen-generator/scripts/imagen-generate.sh \
  "Same subject, recompose for vertical poster, keep cinematic mood" \
  --image hero.png --aspect 9:16 --resolution 2K

Prompt 写法建议(修图):

  • 明确写"KEEP UNCHANGED:"列出要保留的元素(风格、材质、灯光、构图)
  • 明确写"ADD:" / "CHANGE:" / "REMOVE:" 列出要修改的元素
  • 最后强调"this must still look like the same artwork",否则模型可能跑偏成纯文生图
  • 改 aspect 时加"recompose for ... aspect, keep [subject] as dominant element"

支持的图片格式:.png, .jpg, .jpeg, .webp, .gif

Output

  • Images saved to $CC_PAGES_WEB_ROOT/assets/imagen/ as PNG
  • Returns the public URL: $CC_PAGES_URL_PREFIX/assets/imagen/{filename}.png
  • When called from Discord context, send the URL using send-to-discord.sh --plain

Workflow for Discord

# 1. Generate image
URL=$(~/.claude/skills/imagen-generator/scripts/imagen-generate.sh "your prompt" --aspect 16:9)

# 2. Send to Discord
~/.claude/scripts/send-to-discord.sh --plain "$URL"

Model

  • gemini-3-pro-image (default) — Gemini 3 Pro Image, best quality, supports text+image generation
  • gemini-3.1-flash-image — Nano Banana 2, faster, good price-performance

Supported Aspect Ratios

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

Supported Resolutions

1K (default), 2K, 4K (512 不被模型支持,会返回 400)

Prompt Tips

  • Be specific and descriptive: "a red sports car on a mountain road at sunset, photorealistic" > "car"
  • Supports Chinese prompts natively (simplified & traditional)
  • For technical diagrams, add style keywords: "technical illustration", "blueprint style", "infographic"
  • Gemini models can also generate text within images (e.g., signs, labels, infographics)

Prerequisites

  • google-genai Python SDK (pip install google-genai)
  • Application Default Credentials configured (gcloud auth application-default login)
  • Vertex AI API enabled on the GCP project
  • CC Pages (GCS-backed via $CC_PAGES_WEB_ROOT)

Files

~/.claude/skills/imagen-generator/scripts/
├── imagen-generate.sh                  # Entry point (exec wrapper)
└── imagen-generate.py                  # Core logic (google-genai SDK)

$CC_PAGES_WEB_ROOT/assets/imagen/      # Generated images (web-accessible)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.