Imagen 4 Image Generator
Generate images from text prompts using Imagen 4 on Vertex AI, save to CC Pages, and send to Discord.
Usage
Call the generation script directly:
~/.claude/scripts/imagen-generate.sh "your prompt here"
Options
# Basic generation (1 image, 1:1 aspect ratio, fast model)
~/.claude/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
~/.claude/scripts/imagen-generate.sh "TPU pod in a datacenter" --aspect 16:9
# Multiple images (1-4)
~/.claude/scripts/imagen-generate.sh "neural network visualization" --count 2
# Model tier: fast (default, $0.02), standard ($0.04), ultra ($0.06)
~/.claude/scripts/imagen-generate.sh "detailed architecture diagram" --model standard
# High resolution (2K/4K, only standard and ultra models)
~/.claude/scripts/imagen-generate.sh "landscape photo" --model standard --resolution 2048x2048
# Custom output filename
~/.claude/scripts/imagen-generate.sh "logo design" --output my-logo
# Disable prompt rewriter (use exact prompt)
~/.claude/scripts/imagen-generate.sh "minimal line drawing" --no-rewrite
# Combine options
~/.claude/scripts/imagen-generate.sh "B200 GPU rack in datacenter, photorealistic" --aspect 16:9 --model standard --count 2
Output
- Images saved to
/var/www/cc/assets/imagen/ as PNG
- Returns the public URL:
https://cc.higcp.com/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/scripts/imagen-generate.sh "your prompt" --aspect 16:9)
# 2. Send to Discord
~/.claude/scripts/send-to-discord.sh --plain "$URL"
Or just run the script — it prints the URL which you can share.
Models
imagen-4.0-fast-generate-001 (default) — Fast, $0.02/image, 1K resolution, 150 QPM
imagen-4.0-generate-001 (standard) — Best quality, $0.04/image, up to 4K resolution, 75 QPM
imagen-4.0-ultra-generate-001 (ultra) — Highest quality, $0.06/image, up to 4K resolution, 30 QPM
Supported Aspect Ratios
All models: 1:1, 3:4, 4:3, 16:9, 9:16
Supported Resolutions
- fast: 1024x1024, 896x1280, 1280x896, 768x1408, 1408x768
- standard/ultra: Above + 2048x2048, 1792x2560, 2560x1792, 1536x2816, 2816x1536
Prompt Tips
- Be specific and descriptive: "a red sports car on a mountain road at sunset, photorealistic" > "car"
- Imagen 4 has a built-in prompt rewriter that enhances your prompt (enabled by default)
- Supports Chinese prompts natively (simplified & traditional)
- For technical diagrams, add style keywords: "technical illustration", "blueprint style", "infographic"
- To disable prompt enhancement, use
--no-rewrite
Prerequisites
google-genai Python SDK (already installed for STT)
- GCP project with Vertex AI API enabled
- Application Default Credentials configured
Files
~/.claude/scripts/
└── imagen-generate.sh # Image generation script
/var/www/cc/assets/imagen/ # Generated images (web-accessible)
1---2name: imagen-generator-23description: Generate images using Google Imagen 4 on Vertex AI. Use when the user says "生成图片", "画一张", "generate image", "帮我画", "生成一张图", "create an image", "图片生成", or when you need to create visual content to explain concepts.4---56# Imagen 4 Image Generator78Generate images from text prompts using Imagen 4 on Vertex AI, save to CC Pages, and send to Discord.910## Usage1112Call the generation script directly:1314```bash15~/.claude/scripts/imagen-generate.sh "your prompt here"16```1718### Options1920```bash21# Basic generation (1 image, 1:1 aspect ratio, fast model)22~/.claude/scripts/imagen-generate.sh "a cute cat sitting on a GPU server"2324# Custom aspect ratio: 1:1, 3:4, 4:3, 16:9, 9:1625~/.claude/scripts/imagen-generate.sh "TPU pod in a datacenter" --aspect 16:92627# Multiple images (1-4)28~/.claude/scripts/imagen-generate.sh "neural network visualization" --count 22930# Model tier: fast (default, $0.02), standard ($0.04), ultra ($0.06)31~/.claude/scripts/imagen-generate.sh "detailed architecture diagram" --model standard3233# High resolution (2K/4K, only standard and ultra models)34~/.claude/scripts/imagen-generate.sh "landscape photo" --model standard --resolution 2048x20483536# Custom output filename37~/.claude/scripts/imagen-generate.sh "logo design" --output my-logo3839# Disable prompt rewriter (use exact prompt)40~/.claude/scripts/imagen-generate.sh "minimal line drawing" --no-rewrite4142# Combine options43~/.claude/scripts/imagen-generate.sh "B200 GPU rack in datacenter, photorealistic" --aspect 16:9 --model standard --count 244```4546### Output4748- Images saved to `/var/www/cc/assets/imagen/` as PNG49- Returns the public URL: `https://cc.higcp.com/assets/imagen/{filename}.png`50- When called from Discord context, send the URL using `send-to-discord.sh --plain`5152### Workflow for Discord5354```bash55# 1. Generate image56URL=$(~/.claude/scripts/imagen-generate.sh "your prompt" --aspect 16:9)5758# 2. Send to Discord59~/.claude/scripts/send-to-discord.sh --plain "$URL"60```6162Or just run the script — it prints the URL which you can share.6364## Models6566- **`imagen-4.0-fast-generate-001`** (default) — Fast, $0.02/image, 1K resolution, 150 QPM67- **`imagen-4.0-generate-001`** (standard) — Best quality, $0.04/image, up to 4K resolution, 75 QPM68- **`imagen-4.0-ultra-generate-001`** (ultra) — Highest quality, $0.06/image, up to 4K resolution, 30 QPM6970## Supported Aspect Ratios7172All models: `1:1`, `3:4`, `4:3`, `16:9`, `9:16`7374## Supported Resolutions7576- **fast**: 1024x1024, 896x1280, 1280x896, 768x1408, 1408x76877- **standard/ultra**: Above + 2048x2048, 1792x2560, 2560x1792, 1536x2816, 2816x15367879## Prompt Tips8081- Be specific and descriptive: "a red sports car on a mountain road at sunset, photorealistic" > "car"82- Imagen 4 has a built-in prompt rewriter that enhances your prompt (enabled by default)83- Supports Chinese prompts natively (simplified & traditional)84- For technical diagrams, add style keywords: "technical illustration", "blueprint style", "infographic"85- To disable prompt enhancement, use `--no-rewrite`8687## Prerequisites8889- `google-genai` Python SDK (already installed for STT)90- GCP project with Vertex AI API enabled91- Application Default Credentials configured9293## Files9495```96~/.claude/scripts/97└── imagen-generate.sh # Image generation script9899/var/www/cc/assets/imagen/ # Generated images (web-accessible)100```