image_generation

Original🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected

AI image generation and editing capabilities, implemented based on Nano Banana (Gemini Image) to support text-to-image, image-to-image, and image editing. Suitable for scenarios such as creative design, marketing materials, social media content, and presentation illustrations. Supports multiple styles, high-resolution output (up to 4K), text rendering, and character consistency preservation.

6installs
Added on

NPX Install

npx skill4agent add hxk622/tokendance image_generation

SKILL.md Content (Chinese)

View Translation Comparison →

Capability Overview

AI image generation capabilities allow you to:
  • Text-to-Image: Generate images based on text descriptions
  • Image-to-Image: Generate new images based on reference images
  • Image Editing: Modify specific parts of existing images
  • Style Transfer: Change image styles (realistic, anime, oil painting, etc.)
  • Text Rendering: Generate clear and readable text in images
Powered by Google Gemini's Nano Banana / Nano Banana Pro models.

Workflow

Phase 1: Requirement Understanding

  1. Understand the user's image requirements (theme, style, usage)
  2. Confirm output format (dimensions, resolution, quantity)
  3. If there are reference images, confirm the editing intent

Phase 2: Prompt Construction

  1. Convert user intent into English prompts (better results)
  2. Follow the prompt formula:
    <subject> <action> <scene> <style> <quality>
  3. Supplement necessary detailed descriptions

Phase 3: Image Generation

  1. Call the
    generate_image
    tool
  2. Call the
    edit_image
    tool if editing is needed
  3. Generate multiple candidates (for user selection if required)

Phase 4: Delivery

  1. Display the generated results
  2. Ask if adjustments are needed
  3. Save to the user-specified location

Tool Usage

generate_image

  • Purpose: Generate images based on text descriptions
  • Parameters:
    • prompt
      : Image description (English yields better results)
    • style
      : Style presets (realistic, anime, oil_painting, watercolor, minimal, cinematic)
    • aspect_ratio
      : Aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4)
    • resolution
      : Resolution (1K, 2K, 4K)
    • num_images
      : Number of images to generate (1-4)
  • Example:
    python
    generate_image(
        prompt="A majestic horse galloping through cherry blossoms, golden hour lighting, Chinese New Year festive atmosphere",
        style="realistic",
        aspect_ratio="16:9",
        resolution="2K",
        num_images=2
    )

edit_image

  • Purpose: Edit existing images
  • Parameters:
    • image_path
      : Original image path or URL
    • prompt
      : Editing instructions (e.g., "Change the background to night scene")
    • preserve_subject
      : Whether to keep the subject unchanged (default True)
  • Example:
    python
    edit_image(
        image_path="/workspace/photo.jpg",
        prompt="Add Chinese New Year decorations and red lanterns to the background",
        preserve_subject=True
    )

Prompt Best Practices

Basic Formula

[Subject] + [Action/Pose] + [Scene/Background] + [Style] + [Atmosphere/Lighting]

Style Keywords

  • Realistic: photorealistic, hyperrealistic, 8K, detailed
  • Anime: anime style, Ghibli style, cel shading
  • Oil Painting: oil painting style, impressionist, Van Gogh style
  • Minimalist: minimal, flat design, vector art
  • Cinematic: cinematic, dramatic lighting, movie poster style

Quality Enhancement Words

  • high quality
    ,
    detailed
    ,
    sharp focus
  • professional photography
    ,
    award winning
  • 4K resolution
    ,
    ultra detailed

Avoidance Items

  • ❌ Avoid vague descriptions: "A nice picture"
  • ❌ Avoid contradictory descriptions: "Cartoon in realistic style"
  • ❌ Avoid sensitive content
  • ✅ Be specific, clear, and layered

Application Scenario Templates

Scenario 1: WeChat Red Envelope Cover/Festival Greeting Image

yaml
prompt_template: |
  A {animal} in {pose}, surrounded by {decorations}, 
  Chinese New Year theme, festive red and gold colors, 
  {style} style, high quality, {text_content}
  
variables:
  animal: "majestic horse" # Year of the Horse
  pose: "running gracefully"
  decorations: "cherry blossoms, red lanterns, gold coins"
  style: "elegant illustration"
  text_content: "with Chinese text '恭喜发财' in golden calligraphy"

Scenario 2: Presentation Illustration

yaml
prompt_template: |
  {concept} visualization, professional infographic style,
  clean white background, modern corporate aesthetic,
  subtle gradients, minimalist design

variables:
  concept: "AI workflow automation"

Scenario 3: Social Media Content

yaml
prompt_template: |
  {subject} {action}, {platform} optimized aspect ratio,
  vibrant colors, eye-catching composition, 
  trending aesthetic, shareable content style
  
variables:
  subject: "coffee cup"
  action: "with steam rising"
  platform: "Instagram" # 1:1 or 4:5

Output Format

Generated Result Display

markdown
## 🎨 Image Generation Completed

**Prompt**: [English prompt used]

**Parameters**:
- Style: [style]
- Aspect Ratio: [aspect_ratio]
- Resolution: [resolution]

**Generated Results**:
![Generated Image](path/to/image.png)

**Next Steps**:
- [ ] Satisfied, save to specified location
- [ ] Need to adjust style/color
- [ ] Need to modify specific parts
- [ ] Regenerate

Notes

  1. Copyright Compliance: Generated images have SynthID watermarks
  2. Content Policy: Comply with Google's usage policies, do not generate sensitive content
  3. Commercial Use: Supports commercial use (marketing, products)
  4. Text Rendering: Nano Banana Pro supports multilingual text, but Chinese effects need verification
  5. Character Consistency: Maintaining character features across images requires using the reference image function

Resource References

  • resources/prompt_templates.yaml
    - Preset prompt templates
  • resources/style_presets.md
    - Detailed style presets
  • resources/chinese_new_year_2026.md
    - Year of the Horse exclusive templates