mcpField
S
seedream-image

seedream-image

github.com/refly-ai创意与媒体20450 次安装38 周前更新
代码仓库

关于 seedream-image

这是一个使用 ByteDance Seedream 4.5 生成和编辑图像的 Refly 技能,可通过文本提示或参考图输入,并设置尺寸、数量和安全检查。

主要功能

  1. 01文本生成图像
  2. 02基于参考图编辑
  3. 03风格迁移
  4. 04设置图像尺寸和数量
  5. 05可选安全检查

适用场景

  1. 01根据文字描述创作图像
  2. 02为参考图应用特定风格
  3. 03按指定尺寸生成图像

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/refly-ai/refly-skills --skill seedream-image

安装后在 Claude Code 中输入/seedream-image确认已加载。

附带文件README.md

详细介绍

Seedream Image

使用 ByteDance Seedream 4.5 生成 AI 图像。适用于以下场景:(1) 根据文本描述创建图像,(2) 通过风格迁移变换图像,或 (3) 生成高质量的艺术风格或写实图像。

输入

以 JSON 格式提供输入:

{
  "prompt": "Text description of the image you want to generate or edit",
  "image_size": "Image size: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9, auto_2K, auto_4K (default: auto_2K)",
  "num_images": "Number of images to generate (1-10, default: 1)",
  "reference_image": "<file-id>",
  "enable_safety_checker": "Enable safety checker (true/false, default: true)"
}

关于文件输入的说明:

  • reference_image 为可选项;如果提供,则需要使用文件 ID(格式:df-xxxxx)
  • 获取文件 ID 的方法:
    1. 使用 refly file upload <file-path> 将参考图像上传到 Refly
    2. 从上传响应中复制返回的文件 ID
    3. 在输入 JSON 中使用此文件 ID
  • 纯文本生成图像时,请省略 reference_image
  • 使用图像到图像编辑时,请提供 reference_image(最多支持 10 张图像)

API 请求结构

此技能使用 Seedream 4.5 API,结构如下:

文本生成图像
{
  "prompt": "Your prompt here",
  "image_size": "auto_2K",
  "num_images": 1,
  "max_images": 1,
  "enable_safety_checker": true
}
图像到图像(带参考图像)
{
  "prompt": "Edit instructions here",
  "image_size": "auto_4K",
  "num_images": 1,
  "max_images": 1,
  "enable_safety_checker": true,
  "image_urls": [
    "URL_of_reference_image_1",
    "URL_of_reference_image_2"
  ]
}

说明:

  • 当 image_urls 为空或未提供时 → 文本生成图像模式
  • 当提供 image_urls 时 → 图像到图像模式
  • 最多支持 10 张输入图像
  • 输入和输出图像总数不得超过 15 张
  • image_size 选项:square_hd、square、portrait_4_3、portrait_16_9、landscape_4_3、landscape_16_9、auto_2K、auto_4K

执行(模式 A:生成文件)

步骤 0(可选):上传参考图像
# Upload a reference image for image-to-image generation
REF_RESULT=$(refly file upload /path/to/reference.jpg)
REF_FILE_ID=$(echo "$REF_RESULT" | jq -r '.payload.fileId')
echo "Reference image file ID: $REF_FILE_ID"
步骤 1:运行技能并获取运行 ID

示例 1:文本生成图像

RESULT=$(refly skill run --id skpi-m56jo9am75xgijga62hd7t8g --input '{
  "prompt": "A beautiful mountain landscape at sunset with vibrant colors",
  "image_size": "landscape_16_9",
  "num_images": 1,
  "enable_safety_checker": true
}')
RUN_ID=$(echo "$RESULT" | jq -r '.payload.workflowExecutions[0].id')

示例 2:图像到图像编辑

# Use the REF_FILE_ID from Step 0
RESULT=$(refly skill run --id skpi-m56jo9am75xgijga62hd7t8g --input '{
  "prompt": "Transform this into anime style with vibrant colors and dramatic lighting",
  "reference_image": "'"$REF_FILE_ID"'",
  "image_size": "auto_4K",
  "num_images": 1,
  "enable_safety_checker": true
}')
RUN_ID=$(echo "$RESULT" | jq -r '.payload.workflowExecutions[0].id')
步骤 2:在浏览器中打开工作流并等待完成
open "https://refly.ai/workflow/c-i51ssnvhcjdou7l0h3ote7d9"
refly workflow status "$RUN_ID" --watch --interval 30000
步骤 3:下载并显示结果
# Get files from this run
FILES=$(refly workflow toolcalls "$RUN_ID" --files --latest | jq -r '.payload.files[]')

# Download and open each file
echo "$FILES" | jq -c '.' | while read -r file; do
  FILE_ID=$(echo "$file" | jq -r '.fileId')
  FILE_NAME=$(echo "$file" | jq -r '.name')
  if [ -n "$FILE_ID" ] && [ "$FILE_ID" != "null" ]; then
    refly file download "$FILE_ID" -o "$HOME/Desktop/${FILE_NAME}"
    open "$HOME/Desktop/${FILE_NAME}"
  fi
done

预期输出

  • 类型:图像
  • 格式:.png/.jpg 图像文件
  • 位置:~/Desktop/
  • 操作:自动打开以向用户展示

规则

遵循基础技能工作流:~/.claude/skills/refly/SKILL.md

评论

支持 Markdown