sofunny-image

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

sofunny-image

sofunny-image

何时使用

When to Use

在以下场景使用本 skill:
  • 用户要生成图片,而当前客户端主模型并不适合直接承担图片输出
  • 用户要上传一张或多张参考图,再结合文本生成新图片
  • 用户要通过
    New-API
    的 Gemini 原生接口出图,而不是直连 Google 官方 API
  • 用户希望优先复用:
    • 进程环境变量
    • ~/.sofunny-image.env
如果只是普通文本问答、代码生成或工具调用,不要使用本 skill。
Use this skill in the following scenarios:
  • The user wants to generate images, but the current client's main model is not suitable for direct image output
  • The user wants to upload one or more reference images and generate new images combined with text
  • The user wants to generate images via New-API's native Gemini interface instead of directly connecting to Google's official API
  • The user prefers to reuse:
    • Process environment variables
    • ~/.sofunny-image.env
Do not use this skill for ordinary text Q&A, code generation, or tool calls.

配置来源

Configuration Sources

脚本按以下顺序读取配置:
  1. ~/.sofunny-image.env
  2. 当前 shell 的环境变量
命令行参数
--base-url
--api-key
--model
会覆盖以上配置。
如果没有检测到
~/.sofunny-image.env
,脚本会提示你创建该文件并写入所需变量模板。
优先使用这些变量:
  • SOFUNNY_BASE_URL
  • SOFUNNY_API_KEY
  • SOFUNNY_MODEL
默认期望值:
  • SOFUNNY_BASE_URL=http://127.0.0.1:3000
  • SOFUNNY_MODEL=gemini-3.1-flash-image-preview
The script reads configurations in the following order:
  1. ~/.sofunny-image.env
  2. Current shell environment variables
Command-line parameters
--base-url
,
--api-key
,
--model
will override the above configurations.
If
~/.sofunny-image.env
is not detected, the script will prompt you to create the file and write the required variable template.
Prioritize using these variables:
  • SOFUNNY_BASE_URL
  • SOFUNNY_API_KEY
  • SOFUNNY_MODEL
Default expected values:
  • SOFUNNY_BASE_URL=http://127.0.0.1:3000
  • SOFUNNY_MODEL=gemini-3.1-flash-image-preview

安装与执行入口

Installation and Execution Entry

  • 推荐将仓库目录软链接到:
    • ${CLAUDE_PLUGIN_ROOT}/skills/sofunny-image
  • 可执行脚本入口:
    • ${CLAUDE_PLUGIN_ROOT}/skills/sofunny-image/scripts/sofunny-image.js
  • It is recommended to create a soft link of the repository directory to:
    • ${CLAUDE_PLUGIN_ROOT}/skills/sofunny-image
  • Executable script entry:
    • ${CLAUDE_PLUGIN_ROOT}/skills/sofunny-image/scripts/sofunny-image.js

快速用法

Quick Usage

文本生图:
bash
node ${CLAUDE_PLUGIN_ROOT}/skills/sofunny-image/scripts/sofunny-image.js \
  --prompt "生成一张 16:9 的极简香蕉海报,不要任何文字。"
参考图编辑:
bash
node ${CLAUDE_PLUGIN_ROOT}/skills/sofunny-image/scripts/sofunny-image.js \
  --prompt "保持主体不变,把背景改成晨雾中的山谷。" \
  --input /absolute/path/to/ref-1.png \
  --input /absolute/path/to/ref-2.jpg
指定输出、比例和分辨率:
bash
node ${CLAUDE_PLUGIN_ROOT}/skills/sofunny-image/scripts/sofunny-image.js \
  --prompt "生成一张赛博朋克风格香蕉图标。" \
  --aspect-ratio 1:1 \
  --image-size 2K \
  --output /tmp/banana-icon.png
Text-to-image generation:
bash
node ${CLAUDE_PLUGIN_ROOT}/skills/sofunny-image/scripts/sofunny-image.js \
  --prompt "Generate a minimalist 16:9 banana poster without any text."
Reference image editing:
bash
node ${CLAUDE_PLUGIN_ROOT}/skills/sofunny-image/scripts/sofunny-image.js \
  --prompt "Keep the subject unchanged and change the background to a valley in morning fog." \
  --input /absolute/path/to/ref-1.png \
  --input /absolute/path/to/ref-2.jpg
Specify output, aspect ratio, and resolution:
bash
node ${CLAUDE_PLUGIN_ROOT}/skills/sofunny-image/scripts/sofunny-image.js \
  --prompt "Generate a cyberpunk-style banana icon." \
  --aspect-ratio 1:1 \
  --image-size 2K \
  --output /tmp/banana-icon.png

参数说明

Parameter Description

  • --prompt
    :必填,图片生成或编辑指令
  • --input
    :可重复传入,一张或多张参考图
  • --output
    :可选,输出文件路径
  • --aspect-ratio
    :可选,默认
    16:9
  • --image-size
    :可选,默认
    1K
  • --model
    :可选,默认读取配置,兜底为
    gemini-3.1-flash-image-preview
  • --base-url
    :可选,覆盖配置中的 base URL
  • --api-key
    :可选,覆盖配置中的 token
  • --prompt
    : Required, instruction for image generation or editing
  • --input
    : Can be passed repeatedly, one or more reference images
  • --output
    : Optional, output file path
  • --aspect-ratio
    : Optional, default is
    16:9
  • --image-size
    : Optional, default is
    1K
  • --model
    : Optional, defaults to reading configuration, fallback to
    gemini-3.1-flash-image-preview
  • --base-url
    : Optional, overrides the base URL in configuration
  • --api-key
    : Optional, overrides the token in configuration

工作流

Workflow

  1. 收集用户的 prompt、参考图、输出路径和画幅要求。
  2. 运行
    scripts/sofunny-image.js
  3. 脚本会直接调用:
    • {BASE_URL}/v1beta/models/{MODEL}:generateContent
  4. 脚本从响应中提取最后一个
    inlineData.data
    ,并将其视为最终图片保存到本地。
  5. 把保存路径返回给用户。
  1. Collect the user's prompt, reference images, output path, and aspect ratio requirements.
  2. Run
    scripts/sofunny-image.js
    .
  3. The script will directly call:
    • {BASE_URL}/v1beta/models/{MODEL}:generateContent
  4. The script extracts the last
    inlineData.data
    from the response and saves it as the final image locally.
  5. Return the save path to the user.

注意事项

Notes

  • 本 skill 默认不附带
    tools
    thinking
    ,避免图片模型在工具模式下失败。
  • BASE_URL
    应为服务根地址,不要手动带
    /v1
  • 若未指定输出路径,脚本默认保存到:
    • 当前工作目录
  • ~/.sofunny-image.env
    中只应使用
    SOFUNNY_*
    变量,避免旧配置混入导致行为不一致。
  • 如果 Gemini 在同一次响应中返回多张图片,脚本默认只保存最后一张,前面的图片视为中间产物。
  • This skill does not include
    tools
    and
    thinking
    by default to avoid failures of the image model in tool mode.
  • BASE_URL
    should be the root address of the service, do not manually add
    /v1
    .
  • If no output path is specified, the script will save the image by default to:
    • Current working directory
  • Only use
    SOFUNNY_*
    variables in
    ~/.sofunny-image.env
    to avoid inconsistent behavior caused by mixing old configurations.
  • If Gemini returns multiple images in the same response, the script will only save the last one by default, and previous images are considered intermediate products.