
Image Generation
- 2.3k installs
- 78k repo stars
- Updated July 27, 2026
- bytedance/deer-flow
image-generation is an agent skill that Use this skill when the user requests to generate, create, imagine, or visualize images including characters, scenes, pr.
About
This skill generates high quality images using structured prompts and a Python script The workflow includes creating JSON formatted prompts and executing image generation with optional reference images Create structured JSON prompts for AIGC image generation Support multiple reference images for style composition guidance Generate images through automated Python script execution Handle various image generation scenarios character design scenes products etc When a user requests image generation identify Subject content What should be in the image Style preferences Art style mood color palette Technical specs Aspect ratio composition lighting Reference images Any images to guide generation You don t need to check the folder under mnt user data The image generation skill documents workflows prerequisites and usage patterns grounded in its repository SKILL md Agents should follow the documented steps respect safety and permission notes and cite only capabilities described in the source It triggers on phrases matching the skill description and integrates with the agent toolchain for the tasks outlined in the documentation
- description: Use this skill when the user requests to generate, create, imagine, or visualize images including character
- This skill generates high-quality images using structured prompts and a Python script. The workflow includes creating JS
- - Create structured JSON prompts for AIGC image generation
- See SKILL.md for image-generation operational details.
- See SKILL.md for image-generation operational details.
Image Generation by the numbers
- 2,321 all-time installs (skills.sh)
- +98 installs in the week ending Jul 28, 2026 (Skillselion tracking)
- Ranked #367 of 16,659 AI & Agent Building skills by installs in the Skillselion catalog
- Security screen: CRITICAL risk (skills.sh audit)
- Data as of Jul 28, 2026 (Skillselion catalog sync)
image-generation capabilities & compatibility
- Capabilities
- description: use this skill when the user reques · this skill generates high quality images using s · create structured json prompts for aigc image · see skill.md for image generation operational de
- Use cases
- orchestration
What image-generation says it does
description: Use this skill when the user requests to generate, create, imagine, or visualize images including characters, scenes, products, or any visual content. Supports structured prompts and refe
This skill generates high-quality images using structured prompts and a Python script. The workflow includes creating JSON-formatted prompts and executing image generation with optional reference imag
- Create structured JSON prompts for AIGC image generation
npx skills add https://github.com/bytedance/deer-flow --skill image-generationAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2.3k |
|---|---|
| repo stars | ★ 78k |
| Security audit | 2 / 3 scanners passed |
| Last updated | July 27, 2026 |
| Repository | bytedance/deer-flow ↗ |
What does image-generation help with and when should an agent load it?
Use this skill when the user requests to generate, create, imagine, or visualize images including characters, scenes, products, or any visual content. Supports structured prompts and reference images
Who is it for?
Developers using image-generation as documented in the skill repository.
Skip if: Skip when the task falls outside the image-generation documented scope.
When should I use this skill?
Use this skill when the user requests to generate, create, imagine, or visualize images including characters, scenes, products, or any visual content. Supports structured prompts and reference images
What you get
Agent actions aligned with the image-generation SKILL.md workflow and documented deliverables.
- Generated image files
- Validated reference image pipeline
Files
Image Generation Skill
Overview
This skill generates high-quality images using structured prompts and a Python script. The workflow includes creating JSON-formatted prompts and executing image generation with optional reference images.
Core Capabilities
- Create structured JSON prompts for AIGC image generation
- Support multiple reference images for style/composition guidance
- Generate images through automated Python script execution
- Handle various image generation scenarios (character design, scenes, products, etc.)
Workflow
Step 1: Understand Requirements
When a user requests image generation, identify:
- Subject/content: What should be in the image
- Style preferences: Art style, mood, color palette
- Technical specs: Aspect ratio, composition, lighting
- Reference images: Any images to guide generation
- You don't need to check the folder under
/mnt/user-data
Step 2: Create Structured Prompt
Generate a structured JSON file in /mnt/user-data/workspace/ with naming pattern: {descriptive-name}.json
Step 3: Execute Generation
Call the Python script:
python /mnt/skills/public/image-generation/scripts/generate.py \
--prompt-file /mnt/user-data/workspace/prompt-file.json \
--reference-images /path/to/ref1.jpg /path/to/ref2.png \
--output-file /mnt/user-data/outputs/generated-image.jpg
--aspect-ratio 16:9Parameters:
--prompt-file: Absolute path to JSON prompt file (required)--reference-images: Absolute paths to reference images (optional, space-separated)--output-file: Absolute path to output image file (required)--aspect-ratio: Aspect ratio of the generated image (optional, default: 16:9)
[!NOTE] Do NOT read the python file, just call it with the parameters.
Character Generation Example
User request: "Create a Tokyo street style woman character in 1990s"
Create prompt file: /mnt/user-data/workspace/asian-woman.json
{
"characters": [{
"gender": "female",
"age": "mid-20s",
"ethnicity": "Japanese",
"body_type": "slender, elegant",
"facial_features": "delicate features, expressive eyes, subtle makeup with emphasis on lips, long dark hair partially wet from rain",
"clothing": "stylish trench coat, designer handbag, high heels, contemporary Tokyo street fashion",
"accessories": "minimal jewelry, statement earrings, leather handbag",
"era": "1990s"
}],
"negative_prompt": "blurry face, deformed, low quality, overly sharp digital look, oversaturated colors, artificial lighting, studio setting, posed, selfie angle",
"style": "Leica M11 street photography aesthetic, film-like rendering, natural color palette with slight warmth, bokeh background blur, analog photography feel",
"composition": "medium shot, rule of thirds, subject slightly off-center, environmental context of Tokyo street visible, shallow depth of field isolating subject",
"lighting": "neon lights from signs and storefronts, wet pavement reflections, soft ambient city glow, natural street lighting, rim lighting from background neons",
"color_palette": "muted naturalistic tones, warm skin tones, cool blue and magenta neon accents, desaturated compared to digital photography, film grain texture"
}Execute generation:
python /mnt/skills/public/image-generation/scripts/generate.py \
--prompt-file /mnt/user-data/workspace/cyberpunk-hacker.json \
--output-file /mnt/user-data/outputs/cyberpunk-hacker-01.jpg \
--aspect-ratio 2:3With reference images:
{
"characters": [{
"gender": "based on [Image 1]",
"age": "based on [Image 1]",
"ethnicity": "human from [Image 1] adapted to Star Wars universe",
"body_type": "based on [Image 1]",
"facial_features": "matching [Image 1] with slight weathered look from space travel",
"clothing": "Star Wars style outfit - worn leather jacket with utility vest, cargo pants with tactical pouches, scuffed boots, belt with holster",
"accessories": "blaster pistol on hip, comlink device on wrist, goggles pushed up on forehead, satchel with supplies, personal vehicle based on [Image 2]",
"era": "Star Wars universe, post-Empire era"
}],
"prompt": "Character inspired by [Image 1] standing next to a vehicle inspired by [Image 2] on a bustling alien planet street in Star Wars universe aesthetic. Character wearing worn leather jacket with utility vest, cargo pants with tactical pouches, scuffed boots, belt with blaster holster. The vehicle adapted to Star Wars aesthetic with weathered metal panels, repulsor engines, desert dust covering, parked on the street. Exotic alien marketplace street with multi-level architecture, weathered metal structures, hanging market stalls with colorful awnings, alien species walking by as background characters. Twin suns casting warm golden light, atmospheric dust particles in air, moisture vaporators visible in distance. Gritty lived-in Star Wars aesthetic, practical effects look, film grain texture, cinematic composition.",
"negative_prompt": "clean futuristic look, sterile environment, overly CGI appearance, fantasy medieval elements, Earth architecture, modern city",
"style": "Star Wars original trilogy aesthetic, lived-in universe, practical effects inspired, cinematic film look, slightly desaturated with warm tones",
"composition": "medium wide shot, character in foreground with alien street extending into background, environmental storytelling, rule of thirds",
"lighting": "warm golden hour lighting from twin suns, rim lighting on character, atmospheric haze, practical light sources from market stalls",
"color_palette": "warm sandy tones, ochre and sienna, dusty blues, weathered metals, muted earth colors with pops of alien market colors",
"technical": {
"aspect_ratio": "9:16",
"quality": "high",
"detail_level": "highly detailed with film-like texture"
}
}python /mnt/skills/public/image-generation/scripts/generate.py \
--prompt-file /mnt/user-data/workspace/star-wars-scene.json \
--reference-images /mnt/user-data/uploads/character-ref.jpg /mnt/user-data/uploads/vehicle-ref.jpg \
--output-file /mnt/user-data/outputs/star-wars-scene-01.jpg \
--aspect-ratio 16:9Common Scenarios
Use different JSON schemas for different scenarios.
Character Design:
- Physical attributes (gender, age, ethnicity, body type)
- Facial features and expressions
- Clothing and accessories
- Historical era or setting
- Pose and context
Scene Generation:
- Environment description
- Time of day, weather
- Mood and atmosphere
- Focal points and composition
Product Visualization:
- Product details and materials
- Lighting setup
- Background and context
- Presentation angle
Specific Templates
Read the following template file only when matching the user request.
- Doraemon Comic
Output Handling
After generation:
- Images are typically saved in
/mnt/user-data/outputs/ - Share generated images with user using present_files tool
- Provide brief description of the generation result
- Offer to iterate if adjustments needed
Tips: Enhancing Generation with Reference Images
For scenarios where visual accuracy is critical, use the `image_search` tool first to find reference images before generation.
Recommended scenarios for using image_search tool:
- Character/Portrait Generation: Search for similar poses, expressions, or styles to guide facial features and body proportions
- Specific Objects or Products: Find reference images of real objects to ensure accurate representation
- Architectural or Environmental Scenes: Search for location references to capture authentic details
- Fashion and Clothing: Find style references to ensure accurate garment details and styling
Example workflow: 1. Call the image_search tool to find suitable reference images:
image_search(query="Japanese woman street photography 1990s", size="Large")2. Download the returned image URLs to local files 3. Use the downloaded images as --reference-images parameter in the generation script
This approach significantly improves generation quality by providing the model with concrete visual guidance rather than relying solely on text descriptions.
Providers (Gemini / MiniMax)
This skill auto-selects the provider by environment variables (no CLI change):
GEMINI_API_KEYset → use Gemini (default, unchanged).- Only
MINIMAX_API_KEYset → use MiniMax (/v1/image_generation, modelimage-01). - Force one explicitly with
IMAGE_GENERATION_PROVIDER=gemini|minimax.
MiniMax optional overrides: MINIMAX_API_HOST (default https://api.minimaxi.com), MINIMAX_IMAGE_MODEL (default image-01). Reference images are sent as the MiniMax subject_reference character image. The CLI and --prompt-file / --reference-images / --output-file / --aspect-ratio arguments are identical for both providers.
MiniMax prompt handling (provider-internal). Authoring is provider-agnostic — write the same structured JSON regardless of which provider is active. MiniMax image-01 consumes a single text string, so the MiniMax path itself sends only the JSON prompt field (the other fields such as style / composition / negative_prompt apply to the Gemini path) and enables prompt_optimizer so MiniMax expands it server-side. MiniMax caps that prompt at 1500 characters; if the prompt field is longer, the script returns an error instead of calling the API. The Gemini path receives the full structured JSON.
Notes
- Always use English for prompts regardless of user's language
- JSON format ensures structured, parsable prompts
- Reference images enhance generation quality significantly
- Iterative refinement is normal for optimal results
- For character generation, include the detailed character object plus a consolidated prompt field
import base64
import json
import os
import requests
MINIMAX_DEFAULT_HOST = "https://api.minimaxi.com"
# MiniMax image-01 caps the prompt at 1500 characters and rejects longer requests
# with a generic "invalid params" error, so validate before calling the API.
MINIMAX_PROMPT_MAX_CHARS = 1500
def validate_image(image_path: str) -> bool:
"""Validate if an image file can be opened and is not corrupted."""
from PIL import Image # lazy import: keeps module importable without Pillow
try:
with Image.open(image_path) as image:
image.verify()
with Image.open(image_path) as image:
image.load()
return True
except Exception as exc:
print(f"Warning: Image '{image_path}' is invalid or corrupted: {exc}")
return False
def _resolve_provider(override_env: str, existing_provider: str, has_existing_creds: bool) -> str:
"""Pick the generation provider.
1. Explicit <SKILL>_PROVIDER override wins.
2. Otherwise prefer the existing provider when its credentials are present.
3. Otherwise fall back to MiniMax when MINIMAX_API_KEY is set.
"""
override = os.getenv(override_env)
if override:
return override.strip().lower()
if has_existing_creds:
return existing_provider
if os.getenv("MINIMAX_API_KEY"):
return "minimax"
raise ValueError(
f"No credentials found. Set GEMINI_API_KEY for {existing_provider}, "
f"or MINIMAX_API_KEY for minimax (optionally force with {override_env})."
)
def _minimax_host() -> str:
return os.getenv("MINIMAX_API_HOST", MINIMAX_DEFAULT_HOST).rstrip("/")
def _check_base_resp(payload: dict) -> None:
base = payload.get("base_resp") or {}
if base.get("status_code", 0) != 0:
raise Exception(
f"MiniMax error {base.get('status_code')}: {base.get('status_msg')}"
)
def _guess_mime(image_path: str) -> str:
ext = os.path.splitext(image_path)[1].lower()
return {
".png": "image/png",
".webp": "image/webp",
".gif": "image/gif",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
}.get(ext, "image/jpeg")
def _to_data_url(image_path: str) -> str:
with open(image_path, "rb") as f:
b64 = base64.b64encode(f.read()).decode("utf-8")
return f"data:{_guess_mime(image_path)};base64,{b64}"
def _ensure_output_dir(output_file: str) -> None:
"""Create the output file's parent directory so nested paths don't fail."""
output_dir = os.path.dirname(output_file)
if output_dir:
os.makedirs(output_dir, exist_ok=True)
def _minimax_prompt(raw: str) -> str:
"""Extract the single text prompt MiniMax image-01 expects.
The shared prompt file is structured JSON (a consolidated ``prompt`` plus
Gemini-oriented fields like ``style`` / ``composition`` / ``negative_prompt``),
but MiniMax consumes one string and expands it via ``prompt_optimizer``. The
provider adapts the input itself — the caller never needs to know MiniMax is
active. Use the JSON ``prompt`` field; fall back to the raw text for plain-text
prompt files or JSON without a ``prompt`` field.
"""
text = raw.strip()
try:
data = json.loads(text)
except (ValueError, json.JSONDecodeError):
return text
if isinstance(data, dict):
core = data.get("prompt")
if isinstance(core, str) and core.strip():
return core.strip()
return text
def _generate_image_minimax(
prompt: str, reference_images: list[str], output_file: str, aspect_ratio: str
) -> str:
api_key = os.getenv("MINIMAX_API_KEY")
if not api_key:
return "MINIMAX_API_KEY is not set"
prompt = _minimax_prompt(prompt)
if len(prompt) > MINIMAX_PROMPT_MAX_CHARS:
return (
f"Prompt is {len(prompt)} characters but MiniMax image-01 accepts at most "
f"{MINIMAX_PROMPT_MAX_CHARS}. Shorten the prompt to stay within the limit; "
f"reference images plus a tighter description usually recover the detail."
)
body = {
"model": os.getenv("MINIMAX_IMAGE_MODEL", "image-01"),
"prompt": prompt,
"aspect_ratio": aspect_ratio,
"response_format": "base64",
"n": 1,
"prompt_optimizer": True,
}
if reference_images:
# Reference images are passed as character subjects as-is; unlike the Gemini
# path we do not pre-validate them — invalid files surface as a MiniMax API error.
body["subject_reference"] = [
{"type": "character", "image_file": _to_data_url(p)} for p in reference_images
]
response = requests.post(
f"{_minimax_host()}/v1/image_generation",
headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
json=body,
timeout=60,
)
response.raise_for_status()
payload = response.json()
_check_base_resp(payload)
images = (payload.get("data") or {}).get("image_base64") or []
if not images:
raise Exception("MiniMax returned no image data")
_ensure_output_dir(output_file)
with open(output_file, "wb") as f:
f.write(base64.b64decode(images[0]))
return f"Successfully generated image to {output_file}"
def _generate_image_gemini(
prompt: str, reference_images: list[str], output_file: str, aspect_ratio: str
) -> str:
parts = []
valid_reference_images = []
for ref_img in reference_images:
if validate_image(ref_img):
valid_reference_images.append(ref_img)
else:
print(f"Skipping invalid reference image: {ref_img}")
if len(valid_reference_images) < len(reference_images):
skipped = len(reference_images) - len(valid_reference_images)
print(f"Note: {skipped} reference image(s) were skipped due to validation failure.")
for reference_image in valid_reference_images:
with open(reference_image, "rb") as f:
image_b64 = base64.b64encode(f.read()).decode("utf-8")
parts.append({"inlineData": {"mimeType": "image/jpeg", "data": image_b64}})
api_key = os.getenv("GEMINI_API_KEY")
if not api_key:
return "GEMINI_API_KEY is not set"
response = requests.post(
"https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent",
headers={"x-goog-api-key": api_key, "Content-Type": "application/json"},
json={
"generationConfig": {"imageConfig": {"aspectRatio": aspect_ratio}},
"contents": [{"parts": [*parts, {"text": prompt}]}],
},
)
response.raise_for_status()
data = response.json()
response_parts: list[dict] = data["candidates"][0]["content"]["parts"]
image_parts = [part for part in response_parts if part.get("inlineData", False)]
if len(image_parts) == 1:
base64_image = image_parts[0]["inlineData"]["data"]
_ensure_output_dir(output_file)
with open(output_file, "wb") as f:
f.write(base64.b64decode(base64_image))
return f"Successfully generated image to {output_file}"
raise Exception("Failed to generate image")
def generate_image(
prompt_file: str,
reference_images: list[str],
output_file: str,
aspect_ratio: str = "16:9",
) -> str:
with open(prompt_file, "r", encoding="utf-8") as f:
prompt = f.read()
provider = _resolve_provider(
"IMAGE_GENERATION_PROVIDER", "gemini", bool(os.getenv("GEMINI_API_KEY"))
)
if provider == "minimax":
return _generate_image_minimax(prompt, reference_images, output_file, aspect_ratio)
if provider in ("gemini", "google"):
return _generate_image_gemini(prompt, reference_images, output_file, aspect_ratio)
raise ValueError(f"Unknown image provider: {provider!r} (use 'gemini' or 'minimax')")
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Generate images using Gemini or MiniMax API")
parser.add_argument("--prompt-file", required=True, help="Absolute path to JSON prompt file")
parser.add_argument("--reference-images", nargs="*", default=[],
help="Absolute paths to reference images (space-separated)")
parser.add_argument("--output-file", required=True, help="Output path for generated image")
parser.add_argument("--aspect-ratio", required=False, default="16:9",
help="Aspect ratio of the generated image")
args = parser.parse_args()
try:
print(generate_image(args.prompt_file, args.reference_images,
args.output_file, args.aspect_ratio))
except Exception as e:
print(f"Error while generating image: {e}")
Doraemon 8-Panel Comic Generator
Workflow
1. Extract story context (theme, gadget, conflict, punchline) 2. Map to 8 narrative beats 3. Use the provided prompt template to generate the JSON prompt file
Panel Layout
┌─────────┬─────────┐
│ Panel 1 │ Panel 2 │ Row 1: y=200, height=380
├─────────┼─────────┤
│ Panel 3 │ Panel 4 │ Row 2: y=600, height=380
├─────────┼─────────┤
│ Panel 5 │ Panel 6 │ Row 3: y=1000, height=380
├─────────┼─────────┤
│ Panel 7 │ Panel 8 │ Row 4: y=1400, height=380
└─────────┴─────────┘
Left column: x=90, width=450
Right column: x=540, width=450Characters
- Doraemon
- Nobita
- Shizuka
- Giant
- Suneo
Prompt Template
{
"canvas": {
"width": 1080,
"height": 1920,
"background": { "type": "solid", "color": "#F0F8FF" }
},
"header": {
"title": {
"text": "[Story Title]",
"position": { "x": 540, "y": 100 },
"style": {
"font_family": "Doraemon, sans-serif",
"font_size": 56,
"font_weight": "bold",
"color": "#0095D9",
"text_align": "center",
"stroke": "#FFFFFF",
"stroke_width": 4,
"text_shadow": "3px 3px 0px #FFD700"
}
}
},
"panels": [
{
"id": "panel1",
"position": { "x": 90, "y": 200 },
"size": { "width": 450, "height": 380 },
"border": { "width": 4, "color": "#000000", "radius": 12 },
"background": "#FFFFFF",
"scene": {
"location": "[Location name]",
"characters": [
{
"name": "[Character]",
"position": { "x": 0, "y": 0 },
"expression": "[Expression]",
"pose": "[Pose description]"
}
],
"dialogues": [
{
"speaker": "[Character]",
"text": "[Dialogue text]",
"position": { "x": 0, "y": 0 },
"style": {
"bubble_type": "speech",
"backgroundColor": "#FFFFFF",
"border_color": "#000000",
"font_size": 22,
"text_align": "center"
}
}
],
"props": []
}
}
],
"footer": {
"text": "[Closing note] - Doraemon",
"position": { "x": 540, "y": 1860 },
"style": {
"font_family": "Doraemon, sans-serif",
"font_size": 24,
"color": "#0095D9",
"text_align": "center"
}
},
}Story Pattern
Setup → Problem → Gadget → Misuse → Backfire → Chaos → Consequence → Ironic Punchline
Aspect Ratio
9:16
Related skills
How it compares
Use image-generation for Deer Flow API image creation inside agent workflows; choose dedicated design tools when you need manual pixel editing or brand-system asset management.
FAQ
What is image-generation?
Use this skill when the user requests to generate, create, imagine, or visualize images including characters, scenes, products, or any visual content. Supports structured prompts a
When should I use image-generation?
Use this skill when the user requests to generate, create, imagine, or visualize images including characters, scenes, products, or any visual content. Supports structured prompts a
Is image-generation safe to install?
Review the Security Audits panel on this page before installing in production.