ModelScope Image Generation and Editing
Quick Start
1. Configure Token
export MODELSCOPE_SDK_TOKEN="your_token_here"
Get Token:https://www.modelscope.cn/my/myaccesstoken
2. Generate Image
cd /workspace/skills/modelscope-image-create
python scripts/generate_image.py --prompt "A cute golden cat sitting on a cloud"
3. Edit Image
python scripts/edit_image.py --image outputs/result_image_xxx.png --prompt "Change background to sunset"
Image Generation
Quick Commands
| Feature |
Command |
| Basic Generation |
python scripts/generate_image.py --prompt "描述" |
| Specify Model |
python scripts/generate_image.py --prompt "描述" --model Qwen/Qwen-Image |
| Specify Size |
python scripts/generate_image.py --prompt "描述" --size 1024x1024 |
| Negative Prompt |
python scripts/generate_image.py --prompt "描述" --negative-prompt "模糊,低质量" |
| Specify Output |
python scripts/generate_image.py --prompt "描述" --output ./result.png |
Full Example
python scripts/generate_image.py \
--prompt "A magical forest with glowing mushrooms" \
--model "Tongyi-MAI/Z-Image-Turbo" \
--size "1024x1024" \
--negative-prompt "low quality, blurry" \
--seed 12345 \
--steps 40 \
--guidance 4.5 \
--output "./result.png"
Text-to-Image Models
| Model |
Description |
Tongyi-MAI/Z-Image-Turbo |
ZaoXiang Turbo - Fast generation (Default) |
MAILAND/majicflus_v1 |
MaiJing ChaoRan - Artistic style |
Qwen/Qwen-Image |
Tongyi Wanxiang - Strong overall capability |
MusePublic/489_ckpt_FLUX_1 |
FLUX.1-dev - High quality |
Image Editing
Supported Inputs
- Local file:
--image input.png(automatically Base64 encoded)
- Online URL:
--image "https://example.com/photo.jpg"
Quick Commands
| Feature |
Command |
| Edit Local Image |
python scripts/edit_image.py --image photo.png --prompt "编辑描述" |
| Use Online Image |
python scripts/edit_image.py --image "https://example.com/photo.jpg" --prompt "描述" |
Full Example
python scripts/edit_image.py \
--image "my_photo.png" \
--prompt "Change to Studio Ghibli anime style" \
--model "FireRedTeam/FireRed-Image-Edit-1.1" \
--negative-prompt "low quality" \
--output "./edited_photo.png"
Editing Models
| Model |
Description |
FireRedTeam/FireRed-Image-Edit-1.1 |
FireRed Edit Version (Default) |
Qwen/Qwen-Image-Edit-2511 |
Qwen Latest Version |
Qwen/Qwen-Image-Edit-2509 |
Qwen Stable Version |
Model List Query
# 列出热门模型
python scripts/list_models.py
# 搜索特定模型
python scripts/list_models.py --search "flux"
⚠️ Note:list_models.py The models shown inmay not all support API calls. It is recommended to use the default models recommended by this skill, as they have been verified to support API calls.
Parameter Description
General Parameters
| Parameter |
Required |
Description |
Example |
--prompt |
✅ |
Positive prompt (English recommended) |
"A girl walking down the corridor" |
--model |
❌ |
Model ID (uses environment variable default) |
"Tongyi-MAI/Z-Image-Turbo" |
--negative-prompt |
❌ |
Negative prompt |
"lowres, blurry" |
--seed |
❌ |
Random seed [0, 2^31-1] |
12345 |
--steps |
❌ |
Sampling steps [1, 100] |
40 |
--guidance |
❌ |
Prompt guidance scale [1.5, 20] |
4.5 |
--output |
❌ |
Output file path |
./result.png |
Generation Parameters
| Parameter |
Required |
Description |
Example |
--size |
❌ |
Image size |
"1024x1024" |
Editing Parameters
| Parameter |
Required |
Description |
Example |
--image |
✅ |
Input image (local path or URL) |
"photo.png" |
Resolution Range
| Model Series |
Supported Range |
| SD Series |
64x64 ~ 2048x2048 |
| FLUX |
64x64 ~ 1024x1024 |
| Qwen-Image |
64x64 ~ 1664x1664 |
| Z-Image-Turbo |
512x512 ~ 2048x2048 |
Best Practices
Prompt Structure
[主体描述] + [风格/光线] + [质量要求]
Example:
A cute golden cat sitting on a soft cloud,
watercolor painting style,
warm afternoon sunlight,
high detail, 8K, professional artwork
Negative Prompt
low quality, blurry, watermark, signature,
bad anatomy, extra fingers, text, error
Environment Variable Configuration
# ~/.bashrc 或 ~/.zshrc
export MODELSCOPE_SDK_TOKEN="your_token_here"
export MODELSCOPE_DEFAULT_MODEL="Tongyi-MAI/Z-Image-Turbo"
export MODELSCOPE_EDIT_MODEL="FireRedTeam/FireRed-Image-Edit-1.1"
Free Quota
| Item |
Limit |
| Daily call count |
2000 times |
| Daily calls per model |
500 times |
| Reset time |
Daily at 00:00 |
Related Files