SuperAPI AI Directory

Geek-skills-seedream-imagegen

Design & creation

View repository

Updated 10-16 06:52

About this skill

Seedream 4.0 Image Generation Skill

This Skill provides a complete workflow for generating professional-grade AI images using the ByteDance Seedream 4.0 API.

Core Features

  • High-Resolution Generation: Supports 2K (2048x2048) and 4K (4096x4096) resolutions
  • Flexible Aspect Ratios: Supports multiple ratios such as 1:1, 16:9, 9:16, 4:3, 3:2, 21:9, etc.
  • Batch Generation: Generate up to 15 images in a single request
  • Reference Image Guidance: Supports up to 3 reference images to control style and composition
  • Excellent Text Rendering: Can generate clear text content in images
  • Sequential Batch Generation: Generate a series of images with consistent style

Workflow

1. Gather User Requirements

Before starting generation, be sure to ask the user for the following information:

Required Information

  • Image Description: What kind of image does the user want to generate?
    • Ask: "Please describe the image content you want to generate"
    • Tip: Encourage the user to provide a detailed description, including subject, style, atmosphere, etc.

Recommended Information to Ask

  • Size Requirements:

    • Ask: "What size image do you need? (2K standard quality or 4K high-definition quality)"
    • Default: 2K
    • Note: 2K is suitable for most purposes, 4K is suitable for printing or scenarios requiring high clarity
  • Aspect Ratio:

    • Ask: "What aspect ratio image do you need?"
    • Common options and uses:
      • 1:1 (Square) - Social media, avatars
      • 16:9 (Horizontal widescreen) - Web banners, video thumbnails
      • 9:16 (Vertical) - Phone wallpapers, Stories
      • 4:3 (Standard horizontal) - Presentations, printing
    • Default: 1:1
  • Quantity:

    • Ask: "How many images do you need to generate? (1-15 images)"
    • Default: 1
    • Note: Generating multiple images provides more choices

2. Optimize the Prompt

Based on the user's description, optimize the generation prompt. Refer to references/prompt_engineering.md for detailed guidance.

Prompt Optimization Principles:

  • Use structured description: [Subject] + [Style] + [Details] + [Quality modifiers]
  • Add lighting and atmosphere descriptions
  • Include specific style keywords
  • For images that need text, clearly specify the text content and font style

Example Transformation:

User input: "A cat"

Optimized prompt:

"A fluffy orange tabby cat sitting on a wooden windowsill, 
golden hour lighting streaming through lace curtains, 
cozy home interior, warm color palette, soft focus background, 
professional photography, highly detailed fur texture"

3. Choose Appropriate Parameters

Choose parameters based on user needs and image type:

Purpose and Parameter Reference Table

Purpose size aspect_ratio max_images
Social Media Images 2K 1:1 or 9:16 1-3
Web Banners 2K 16:9 or 21:9 1
Print Posters 4K 4:3 or custom 1-2
Product Images 2K 3:2 or 4:3 3-5
Concept Design 2K 16:9 5-10
Marketing Materials 2K-4K Depending on the medium 3-5

4. Execute Image Generation

Use the scripts/generate_image.py script to generate images:

Command-line method:

python scripts/generate_image.py \
  --prompt "优化后的提示词" \
  --size 2K \
  --aspect-ratio 16:9 \
  --max-images 1 \
  --api-key YOUR_API_KEY \
  --output-dir ./outputs

Python code method:

from scripts.generate_image import SeedreamImageGenerator

generator = SeedreamImageGenerator(api_key="YOUR_API_KEY")

paths = generator.generate(
    prompt="优化后的提示词",
    size="2K",
    aspect_ratio="16:9",
    max_images=1,
    output_dir="./outputs"
)

print(f"生成的图像: {paths}")

5. Processing results

  • Images will be saved in the specified output directory (default ./outputs)
  • Filename format: seedream_YYYYMMDD_HHMMSS_提示词前缀.png
  • If multiple images are generated, numbered suffixes will be added automatically

6. Iterative optimization

If the user is not satisfied with the result:

  1. Ask what specifically needs to be adjusted
  2. Optimize the prompt based on feedback:
    • Add more detailed descriptions
    • Adjust style keywords
    • Modify lighting or atmosphere descriptions
  3. Consider adjusting technical parameters:
    • Increase resolution (2K → 4K)
    • Change aspect ratio
    • Generate more variants to choose from

Advanced features

Use reference images

When a specific style or brand consistency is needed:

generator.generate(
    prompt="提示词",
    image_input=[
        "https://example.com/reference1.jpg",
        "https://example.com/reference2.jpg"
    ],
    size="2K",
    output_dir="./outputs"
)

Reference image uses:

  • Guide the artistic style
  • Maintain brand visual consistency
  • Provide composition reference

Sequential batch generation

Generate a series of images with a consistent style:

generator.generate(
    prompt="系列图像的统一描述",
    max_images=5,
    sequential=True,  # 启用顺序生成
    output_dir="./outputs"
)

Applicable scenarios:

  • Product series images
  • Storyboard
  • Brand asset kit
  • Social media series content

Custom size

For special size requirements:

generator.generate(
    prompt="提示词",
    size="custom",
    width=3000,
    height=2000,
    output_dir="./outputs"
)

API configuration

Set the API key

Method 1: Environment variable (recommended)

export SEGMIND_API_KEY="your_api_key_here"

Method 2: Pass directly

generator = SeedreamImageGenerator(api_key="your_api_key_here")

Get the API key

  1. Visit Segmind
  2. Register an account
  3. Generate an API key in account settings

Reference documentation

When more detailed information is needed, refer to the following documentation:

  • API detailed description: references/api_reference.md

    • Complete API parameter description
    • Request examples
    • Error handling
    • Performance metrics
  • Prompt engineering: references/prompt_engineering.md

    • Prompt structure guide
    • Style keyword library
    • Use case examples
    • Best practices

Quick reference for common scenarios

Scenario 1: Social media images

generator.generate(
    prompt="优化的社交媒体内容描述",
    size="2K",
    aspect_ratio="1:1",
    max_images=3,  # 生成多个供选择
    output_dir="./outputs/social_media"
)

Scenario 2: Marketing posters

generator.generate(
    prompt="专业的营销海报描述,包含标题文字",
    size="4K",  # 高清晰度
    aspect_ratio="4:3",
    max_images=1,
    output_dir="./outputs/marketing"
)

Scenario 3: Product concept images

generator.generate(
    prompt="详细的产品描述和风格要求",
    size="2K",
    aspect_ratio="3:2",
    max_images=5,  # 多角度探索
    output_dir="./outputs/product_concepts"
)

Scenario 4: Brand series design

generator.generate(
    prompt="统一的品牌风格描述",
    size="2K",
    max_images=10,
    sequential=True,  # 保持一致性
    image_input=["品牌logo_url", "色卡_url"],
    output_dir="./outputs/brand_series"
)

Troubleshooting

Issue: API returns a 401 error

  • Check whether the API key is set correctly
  • Confirm that the API key is valid and has sufficient quota

Issue: The generated image quality is not ideal

  • Optimize the prompt and add more details
  • Try using a reference image
  • Increase the resolution to 4K
  • Generate multiple images for comparison and selection

Issue: Generation takes too long

  • 4K images take longer (4-6 seconds)
  • Batch generation increases the total time
  • Check the network connection

Issue: Text in the image is unclear

  • Explicitly specify the font style in the prompt
  • Increase the resolution
  • Add keywords such as "high contrast", "bold typography"

Notes

  • API quota: Each generation consumes quota, so monitor the remaining quota
  • Generation time: about 1.8 seconds for 2K, about 4-6 seconds for 4K
  • Batch limit: up to 15 images per request
  • Reference image limit: up to 3 reference images
  • Prompt length: 200-300 words or fewer is recommended

Best practices

  1. Always optimize prompts: do not directly use the user's brief description
  2. Ask about the requirements clearly: understanding the image's purpose helps choose the correct parameters
  3. Provide multiple options: for important projects, generate 3-5 for selection
  4. Use reference images: use reference images when a specific style is needed
  5. Iterative optimization: continuously improve prompts and parameters based on feedback
  6. Save successful cases: record effective prompt templates for later use