imagen
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImagen - AI Image Generation Skill
Imagen - AI图像生成Skill
Overview
概述
This skill generates images using Google Gemini's image generation model (). It enables seamless image creation during any Claude Code session - whether you're building frontend UIs, creating documentation, or need visual representations of concepts.
gemini-3-pro-image-previewCross-Platform: Works on Windows, macOS, and Linux.
本Skill使用Google Gemini的图像生成模型()生成图片。你可以在任何Claude Code会话中无缝创建图片,无论是构建前端UI、制作文档,还是需要概念的可视化呈现。
gemini-3-pro-image-preview跨平台:支持Windows、macOS和Linux系统。
When to Use This Skill
适用场景
Automatically activate this skill when:
- User requests image generation (e.g., "generate an image of...", "create a picture...")
- Frontend development requires placeholder or actual images
- Documentation needs illustrations or diagrams
- Visualizing concepts, architectures, or ideas
- Creating icons, logos, or UI assets
- Any task where an AI-generated image would be helpful
满足以下条件时自动激活本Skill:
- 用户请求生成图像(例如:"generate an image of..."、"create a picture...")
- 前端开发需要占位图或实际图片
- 文档需要插图或图表
- 概念、架构或想法的可视化呈现
- 创建图标、logo或UI资产
- 任何AI生成图像能提供帮助的场景
How It Works
工作原理
- Takes a text prompt describing the desired image
- Calls Google Gemini API with image generation configuration
- Saves the generated image to a specified location (defaults to current directory)
- Returns the file path for use in your project
- 接收描述目标图像的文本提示词
- 携带图像生成配置调用Google Gemini API
- 将生成的图像保存到指定位置(默认保存到当前目录)
- 返回文件路径供项目使用
Usage
使用方法
Python (Cross-Platform - Recommended)
Python(跨平台 - 推荐)
bash
undefinedbash
undefinedBasic usage
Basic usage
python scripts/generate_image.py "A futuristic city skyline at sunset"
python scripts/generate_image.py "A futuristic city skyline at sunset"
With custom output path
With custom output path
python scripts/generate_image.py "A minimalist app icon for a music player" "./assets/icons/music-icon.png"
python scripts/generate_image.py "A minimalist app icon for a music player" "./assets/icons/music-icon.png"
With custom size
With custom size
python scripts/generate_image.py --size 2K "High resolution landscape" "./wallpaper.png"
undefinedpython scripts/generate_image.py --size 2K "High resolution landscape" "./wallpaper.png"
undefinedRequirements
依赖要求
- environment variable must be set
GEMINI_API_KEY - Python 3.6+ (uses standard library only, no pip install needed)
- 必须配置环境变量
GEMINI_API_KEY - Python 3.6+(仅使用标准库,无需执行pip install)
Output
输出
Generated images are saved as PNG files. The script returns:
- Success: Path to the generated image
- Failure: Error message with details
生成的图像保存为PNG格式文件。脚本返回:
- 成功:生成图像的路径
- 失败:包含详细信息的错误提示
Examples
示例
Frontend Development
前端开发
User: "I need a hero image for my landing page - something abstract and tech-focused"
-> Generates and saves image, provides path for use in HTML/CSSUser: "I need a hero image for my landing page - something abstract and tech-focused"
-> 生成并保存图片,提供路径供HTML/CSS使用Documentation
文档制作
User: "Create a diagram showing microservices architecture"
-> Generates visual representation, ready for README or docsUser: "Create a diagram showing microservices architecture"
-> 生成可视化示意图,可直接用于README或文档中UI Assets
UI资产制作
User: "Generate a placeholder avatar image for the user profile component"
-> Creates image in appropriate size for component useUser: "Generate a placeholder avatar image for the user profile component"
-> 生成适配组件尺寸的图片