Agent Skillsmassgen/MassGen › image-generation

image-generation

GitHub

MassGen平台图像生成与编辑指南,支持文本转图像、图像编辑及多后端(OpenAI/Gemini等)自动选择与切换。

massgen/skills/image-generation/SKILL.md massgen/MassGen

Trigger Scenarios

创建新图片 编辑现有图片 比较不同图像生成后端 批量生成图像

Install

npx skills add massgen/MassGen --skill image-generation -g -y
More Options

Non-standard path

npx skills add https://github.com/massgen/MassGen/tree/main/massgen/skills/image-generation -g -y

Use without installing

npx skills use massgen/MassGen@image-generation

指定 Agent (Claude Code)

npx skills add massgen/MassGen --skill image-generation -a claude-code -g -y

安装 repo 全部 skill

npx skills add massgen/MassGen --all -g -y

预览 repo 内 skill

npx skills add massgen/MassGen --list

SKILL.md

Frontmatter
{
    "name": "image-generation",
    "description": "Guide to image generation and editing in MassGen. Use when creating images, editing existing images, iterating on image designs, or choosing between image backends (OpenAI, Google Gemini\/Imagen, Grok, OpenRouter)."
}

Image Generation

Generate images using generate_media with mode="image". The system auto-selects the best backend based on available API keys.

Quick Start

# Simple text-to-image (auto-selects backend)
generate_media(prompt="A cat in space", mode="image")

# Specify backend and quality
generate_media(prompt="A logo for a coffee shop", mode="image",
               backend_type="openai", quality="high")

# Batch generation (parallel)
generate_media(prompts=["sunset over ocean", "mountain landscape", "city at night"],
               mode="image", max_concurrent=3)

Backend Comparison

Backend Default Model Strengths API Key
Google (priority 1) gemini-3.1-flash-image-preview (Nano Banana 2) Fast, flexible sizes, image editing, multi-turn GOOGLE_API_KEY or GEMINI_API_KEY
OpenAI (priority 2) gpt-5.4 High quality, transparent backgrounds, continuation via response ID OPENAI_API_KEY
Grok (priority 3) grok-imagine-image 1k resolution, continuation via stored data URI XAI_API_KEY
OpenRouter (priority 4) google/gemini-3.1-flash-image-preview Access to multiple models via single API OPENROUTER_API_KEY

Key Parameters

Parameter Description Example
prompt Text description of the image "A watercolor painting of mountains"
backend_type Force a specific backend "google", "openai", "grok", "openrouter"
model Override default model "gemini-3-pro-image-preview" for studio quality
quality Image quality (OpenAI) "low", "medium", "high", "auto"
size Image dimensions See backends reference
aspect_ratio Aspect ratio "16:9", "1:1", "4:5"
input_images Source images for image-to-image editing ["photo.jpg"]
continue_from Continuation ID for multi-turn editing result["continuation_id"]

Image-to-Image Editing

Transform existing images by providing input_images:

generate_media(
    prompt="Make it look like a watercolor painting",
    mode="image",
    input_images=["photo.jpg"]
)

Supported backends for image-to-image: Google (Gemini), OpenAI, Grok. The system auto-selects if your current backend doesn't support it.

Multi-Turn Editing (Continuation)

Iteratively refine images using continue_from:

# First generation
result = generate_media(prompt="A logo for a coffee shop", mode="image")

# Refine using the continuation ID
result2 = generate_media(
    prompt="Make the text larger and add a cup icon",
    mode="image",
    continue_from=result["continuation_id"]
)

Each backend uses a different continuation mechanism:

  • OpenAI: Passes previous_response_id (stateless)
  • Google Gemini: In-memory chat store (LRU, 50 items)
  • Grok: In-memory data URI store (LRU, 50 items)

Continuation only works for single image generation (not batch).

Google: Gemini vs Imagen

Google supports two API paths. Gemini (Nano Banana 2) is the default and recommended for most use cases. Imagen is only needed for advanced reference-image editing features.

  • Gemini models (gemini-*): generate_content() — text-to-image, image editing via input_images, multi-turn continuation
  • Imagen models (imagen-*): generate_images() / edit_image() — text-to-image with negative_prompt/seed/guidance_scale, plus style transfer, control editing, and subject consistency via reference images

For studio-quality precision and text rendering, use: model="gemini-3-pro-image-preview" (Pro-tier).

Need More Control?

Version History

  • 007bd85 Current 2026-08-20 15:35

Same Skill Collection

massgen/skills/audio-generation/SKILL.md
massgen/skills/backend-integrator/SKILL.md
massgen/skills/evolving-skill-creator/SKILL.md
massgen/skills/file-search/SKILL.md
massgen/skills/massgen-config-creator/SKILL.md
massgen/skills/massgen-develops-massgen/SKILL.md
massgen/skills/massgen-log-analyzer/SKILL.md
massgen/skills/massgen-release-documenter/SKILL.md
massgen/skills/massgen/SKILL.md
massgen/skills/model-registry-maintainer/SKILL.md
massgen/skills/multimedia-backend-integrator/SKILL.md
massgen/skills/pr-checks/SKILL.md
massgen/skills/release-prep/SKILL.md
massgen/skills/semtools/SKILL.md
massgen/skills/serena/SKILL.md
massgen/skills/skill-organizer/SKILL.md
massgen/skills/textual-ui-developer/SKILL.md
massgen/skills/video-generation/SKILL.md

Metadata

Files
0
Version
007bd85
Hash
8048c687
Indexed
2026-08-20 15:35

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-24 20:44
浙ICP备14020137号-1 $방문자$