Use the included script to generate or edit images viaByteDanceimage generation models:
- Doubao Seedream (Jimeng / Dreamina) series of image generation models
- Supports text-to-image, image-to-image, and multi-image reference editing
Default version:4.5 → corresponds to doubao-seedream-4-5-251128.
Default size:2K。
Model performance recommendations
- Performance ranking:
4.5>5.0>4.0 - It is recommended to prioritize the
4.5version for the best results
Aspect ratio
- The aspect ratio must be explicitly specified in the image generation prompt, for example: "Generate a cute puppy, 9:16 vertical ratio"
Text-to-image
uv run {baseDir}/scripts/generate_image.py --prompt "你的图片描述" --filename "可爱小狗.jpg"
Using a YAML configuration file
You can write all image generation parameters into a YAML configuration file, then use it via the --config parameter:
Text-to-image configuration example (text2image.yaml):
prompt: 一只可爱的小狗在草地上,9:16竖屏比例
filename: 可爱小狗.jpg
size: 2K
version: 4.5
Image-to-image configuration example (with a reference image list,image2image.yaml):
prompt: 将图1的服装换为图2的服装
filename: 换装女孩.jpg
images:
- https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png
- https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png
size: 2K
version: 4.5
Local reference image configuration example (local_images.yaml):
prompt: 多图融合成一张插画
filename: 多图融合插画.jpg
images:
- /path/to/参考图1.jpg
- /path/to/参考图2.png
size: 2K
version: 4.5
Usage:
uv run {baseDir}/scripts/generate_image.py --config image2image.yaml
Mix configuration files and command-line parameters (command-line parameters take higher priority):
uv run {baseDir}/scripts/generate_image.py --config prompt.yaml --filename "自定义文件名.jpg"
All parameters supported by the YAML configuration file:
prompt: image descriptionfilename: output file nameimages: list of reference images (can be URLs or local file paths)size: output size (such as "2K", "4K")version: Seedream version (such as "4.5")model: full model name (advanced option)api_key: API key
Image-to-image / reference images (multiple images: URLs or local files)
uv run {baseDir}/scripts/generate_image.py \
--prompt "将图1的服装换为图2的服装" \
--filename "换装女孩.jpg" \
-i "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png" \
-i "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png" \
--size 2K \
--version 4.5
Local reference images (multiple local files)
uv run {baseDir}/scripts/generate_image.py \
--prompt "多图融合成一张插画" \
--filename "多图融合插画.jpg" \
-i "/path/to/参考图1.jpg" \
-i "/path/to/参考图2.png" \
--size 2K \
--version 4.5
Notes
API key
- You should first automatically detect whether there is a
ARK_API_KEYenvironment variable; if not, you need to ask the user for it or have the user apply for it on Volcano Engine
Version options
4.0→doubao-seedream-4-0-2508284.5(default) →doubao-seedream-4-5-2511285.0→doubao-seedream-5-0-260128- Advanced options: the default mapping can still be overridden via parameters such as
--model doubao-seedream-5-0-lite-260128.
Size options (by version)
4.0:1K,2K,4K4.5:2K,4K5.0:2K,3K
File name suggestions (for the caller's reference)
- Do not include implementation details such as "seedream" in the file name.
- The file name language should be consistent with the user's Prompt language; for example, for a Chinese Prompt use a short Chinese file name (such as
可爱小狗.jpg)。 - The name should be semantic but as short as possible; avoid overly long sentences.
Keyword hints (for search discovery)
- "doubao", "豆包", "即梦", "Seedream", "dreamina"
- "ByteDance image model", "字节跳动生图模型"
- "text-to-image", "image-to-image", "reference image", "image generation", "image generation", "outfit swap", "image editing"