imagen
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImagen - AI Image Generation Skill
Imagen - AI图像生成技能
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.
本技能使用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
在以下场景自动激活此技能:
- 用户请求生成图片(例如:“生成一张……的图片”、“创建一幅图画……”)
- 前端开发需要占位图或实际图片
- 文档需要插图或图表
- 将概念、架构或想法可视化
- 创建图标、标志或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
基础用法
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
自定义输出路径
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
自定义尺寸
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安装依赖)
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"
-> Generates and saves image, provides path for use in HTML/CSSDocumentation
文档编写
User: "Create a diagram showing microservices architecture"
-> Generates visual representation, ready for README or docsUser: "Create a diagram showing microservices architecture"
-> Generates visual representation, ready for README or docsUI 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"
-> Creates image in appropriate size for component use