imagen

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Imagen - AI Image Generation Skill

Imagen - AI图像生成Skill

Overview

概述

This skill generates images using Google Gemini's image generation model (
gemini-3-pro-image-preview
). It enables seamless image creation during any Claude Code session - whether you're building frontend UIs, creating documentation, or need visual representations of concepts.
Cross-Platform: Works on Windows, macOS, and Linux.
本Skill使用Google Gemini的图像生成模型(
gemini-3-pro-image-preview
)生成图片。你可以在任何Claude Code会话中无缝创建图片,无论是构建前端UI、制作文档,还是需要概念的可视化呈现。
跨平台:支持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

工作原理

  1. Takes a text prompt describing the desired image
  2. Calls Google Gemini API with image generation configuration
  3. Saves the generated image to a specified location (defaults to current directory)
  4. Returns the file path for use in your project
  1. 接收描述目标图像的文本提示词
  2. 携带图像生成配置调用Google Gemini API
  3. 将生成的图像保存到指定位置(默认保存到当前目录)
  4. 返回文件路径供项目使用

Usage

使用方法

Python (Cross-Platform - Recommended)

Python(跨平台 - 推荐)

bash
undefined
bash
undefined

Basic 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"
undefined
python scripts/generate_image.py --size 2K "High resolution landscape" "./wallpaper.png"
undefined

Requirements

依赖要求

  • GEMINI_API_KEY
    environment variable must be set
  • 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/CSS
User: "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 docs
User: "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 use
User: "Generate a placeholder avatar image for the user profile component"
-> 生成适配组件尺寸的图片