bailian-image-gen

Alibaba Cloud Bailian Qwen Image 2.0 image generation. Supports text-to-image and image-to-image (reference image + text). For product promotion image generation, e-commerce image editing, marketing material creation. Provides Python API, CLI tool, and ComfyUI custom nodes.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "bailian-image-gen" with this command: npx skills add navygo/bailian-image-gen

Alibaba Cloud Bailian Image Generation

Based on Alibaba Cloud Bailian platform's qwen-image-2.0 model, providing high-quality text-to-image and image-to-image capabilities.

Features

  • Text-to-Image - Generate high-quality images from text descriptions
  • Image-to-Image - Generate new images from reference image + text description
  • ComfyUI Integration - Complete ComfyUI custom nodes
  • Auto Compression - Automatically handle reference image size limits
  • Synchronous Calls - No async task waiting, instant results

Use Cases

  • C-end App product promotion image generation
  • E-commerce product image style transfer and background replacement
  • Marketing material batch generation
  • Creative image editing

Quick Start

Environment Setup

  1. Install dependencies:

    pip install requests Pillow
    
  2. Configure API Key (two methods):

    Method 1: .env file (recommended)

    cp .env.example .env
    # Edit .env file
    DASHSCOPE_API_KEY=your-api-key-here
    

    Method 2: Environment variable

    export DASHSCOPE_API_KEY=your-api-key
    

    Get API Key from bailian.console.aliyun.com

Command Line Usage

# Text-to-Image
python scripts/bailian_image_gen.py --mode t2i --prompt "A cute orange cat, high quality" --output cat.png

# Image-to-Image
python scripts/bailian_image_gen.py --mode i2i --prompt "Modern minimalist living room scene, warm lighting" --reference-image product.jpg --output result.png

Python API

from scripts.bailian_image_gen import QwenImageGenerator

# Initialize
client = QwenImageGenerator()

# Text-to-Image
result = client.text_to_image(
    prompt="A cute orange cat, high quality",
    size="1024*1024"
)
url = client.extract_image_url(result)
client.download_image(url, "output.png")

# Image-to-Image
result = client.image_to_image(
    prompt="Modern minimalist living room scene, warm lighting",
    reference_image_path="product.jpg"
)
url = client.extract_image_url(result)
client.download_image(url, "output.png")

ComfyUI Integration

Install Nodes

  1. Copy files to ComfyUI:

    cp scripts/bailian_image_gen.py /path/to/ComfyUI/custom_nodes/
    cp scripts/comfyui_bailian_node.py /path/to/ComfyUI/custom_nodes/
    
  2. Configure API Key in ComfyUI directory:

    echo "DASHSCOPE_API_KEY=your-api-key" > /path/to/ComfyUI/.env
    
  3. Restart ComfyUI

Available Nodes

Search "Bailian" in ComfyUI to find these nodes:

BailianText2Image

  • Inputs: prompt (STRING), size (COMBO), seed (INT)
  • Output: image (IMAGE)

BailianImage2Image

  • Inputs: image (IMAGE), prompt (STRING), size (COMBO), seed (INT)
  • Output: image (IMAGE)

Workflow Example

Import assets/comfyui_workflow.json for product promotion image generation example.

Typical workflow:

[Load Image] --> [BailianImage2Image] --> [Save Image]
                      ^
                prompt: "Modern minimalist living room, warm lighting"

Parameters

ParameterTypeDescriptionDefault
--modestringt2i=text-to-image, i2i=image-to-imageRequired
--promptstringPrompt textRequired
--reference-imagestringReference image path (i2i mode)None
--sizestringImage size1024*1024
--seedintRandom seedRandom
--outputstringOutput pathRequired

Supported Image Sizes

  • 1024*1024 - Square (recommended)
  • 1024*768 - Landscape
  • 768*1024 - Portrait
  • 2048*2048 - High resolution

Prompt Tips

Product Promotion Template

[Product] placed in [Scene], [Style], [Lighting], [Quality requirements]

Examples:

  • "Smartwatch placed on minimalist white marble desktop, Nordic minimalist style, natural light, product photography quality"
  • "Sneakers placed on wooden floor, city skyline background, fashion magazine style, soft side lighting"
  • "Cosmetics placed on dressing table, surrounded by flowers and perfume bottles, luxury style, warm lighting"

File Structure

bailian-image-gen/
├── .env.example              # API Key config example
├── README.md                 # Detailed documentation
├── requirements.txt          # Dependencies
├── SKILL.md                  # This file
├── assets/
│   └── comfyui_workflow.json # ComfyUI workflow example
└── scripts/
    ├── bailian_image_gen.py      # Core script
    └── comfyui_bailian_node.py   # ComfyUI nodes

Notes

  1. API Key - Requires Alibaba Cloud Bailian platform account and API Key
  2. Image Compression - Reference images are automatically compressed to meet API limits
  3. Network Requirements - Requires access to Alibaba Cloud dashscope service
  4. Synchronous Calls - qwen-image-2.0 uses synchronous calls, no async task waiting

Error Handling

Common errors and solutions:

ErrorCauseSolution
API Key errorNot configured or incorrectCheck .env file or environment variable
Image too largeReference image exceeds limitScript auto-compresses, if still fails use smaller image
Network errorCannot access Alibaba CloudCheck network connection

References

  • [Alibaba Cloud Bailian Console]
  • [OpenClaw Documentation]
  • [ComfyUI GitHub]

Author

@navygo

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Smart Model Switcher V3

Universal Smart Model Switcher V3 - Multi-Provider, Multi-Model intelligent switching. Automatically selects the best model from ALL your purchased API plans...

Registry SourceRecently Updated
3251Profile unavailable
General

ComfyUI Skill

Generate high-quality images using a local ComfyUI instance. Use when the user wants private, powerful image generation via their own hardware and custom wor...

Registry SourceRecently Updated
9053Profile unavailable
General

Ollama Herd

Ollama multimodal model router for Llama, Qwen, DeepSeek, Phi, and Mistral — plus mflux image generation, speech-to-text, and embeddings. Self-hosted Ollama...

Registry SourceRecently Updated
2380Profile unavailable
General

Ollama Ollama Herd

Ollama Ollama Herd — multimodal Ollama model router that herds your Ollama LLMs into one smart Ollama endpoint. Route Ollama Llama, Qwen, DeepSeek, Phi, Mist...

Registry SourceRecently Updated
1542Profile unavailable