Files
membank/.trae/skills/image-tools/SKILL.md

81 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: image-tools
description: 阿里云万相2.7图生图工具用于AI生成产品主图、场景图、电商素材。Invoke when user needs to generate product images, e-commerce visuals, or AI image editing.
---
# Image Tools - 万相2.7 AI图生图
使用阿里云百炼 **wan2.7-image-pro** 模型进行 AI 图生图处理,支持文生图、图生图、图片编辑。
## 前提条件
环境变量 `DASHSCOPE_API_KEY` 已配置默认使用内置Key
## 基本用法
```bash
python wan_image_edit.py <提示词> <输入图片> [输出路径] [尺寸]
```
**参数说明**
- `提示词`: 描述想要的效果,支持中英文
- `输入图片`: 产品图片路径PNG/JPG留空则为文生图
- `输出路径`: 输出文件名(可选,默认 wan_output.png
- `尺寸`: 1K 或 2K可选默认 2K
## 示例
```bash
# 白底产品图
python wan_image_edit.py "keep the product, pure white background, professional e-commerce photo" "product.png" "output.png"
# 场景图
python wan_image_edit.py "place product on modern desk, cozy home office" "product.png" "scene.png"
# 高性能风格
python wan_image_edit.py "cyberpunk gaming setup with RGB lights, benchmark scores" "product.png" "gaming.png" "2K"
# 文生图(无输入图片)
python wan_image_edit.py "futuristic NAS server in data center" "" "t2i.png"
# 直接在图上添加文字
python wan_image_edit.py "keep product, add bold text: 千兆高速传输, professional tech background" "product.png" "with_text.png"
```
## 可用尺寸
| 尺寸 | 分辨率 | 适用场景 |
|-----|-------|---------|
| 1K | 1024x1024 | 快速预览、轮播图 |
| 2K | 2048x2048 | 主图、海报(推荐)|
## 代码调用
```python
from wan_image_edit import wan_image_edit
# 基础调用
wan_image_edit(
prompt="keep the product, white background",
image_path="product.png",
output_path="output.png",
size="2K"
)
# 批量生成多张
styles = [
("white bg", "product.png", "white.png"),
("cyberpunk", "product.png", "cyber.png"),
("data center", "product.png", "datacenter.png"),
]
for prompt, img, out in styles:
wan_image_edit(prompt, img, out)
```
## 提示词技巧
- **保持产品**: "keep the product", "retain the original product"
- **背景**: "white background", "modern office", "data center"
- **风格**: "cyberpunk", "minimalist", "professional"
- **氛围**: "dramatic lighting", "warm tones", "neon lights"
- **添加文字**: "add bold text: 千兆高速传输"