sofunny-image
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesesofunny-image
sofunny-image
何时使用
When to Use
在以下场景使用本 skill:
- 用户要生成图片,而当前客户端主模型并不适合直接承担图片输出
- 用户要上传一张或多张参考图,再结合文本生成新图片
- 用户要通过 的 Gemini 原生接口出图,而不是直连 Google 官方 API
New-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
脚本按以下顺序读取配置:
~/.sofunny-image.env- 当前 shell 的环境变量
命令行参数 、、 会覆盖以上配置。
--base-url--api-key--model如果没有检测到 ,脚本会提示你创建该文件并写入所需变量模板。
~/.sofunny-image.env优先使用这些变量:
SOFUNNY_BASE_URLSOFUNNY_API_KEYSOFUNNY_MODEL
默认期望值:
SOFUNNY_BASE_URL=http://127.0.0.1:3000SOFUNNY_MODEL=gemini-3.1-flash-image-preview
The script reads configurations in the following order:
~/.sofunny-image.env- Current shell environment variables
Command-line parameters , , will override the above configurations.
--base-url--api-key--modelIf is not detected, the script will prompt you to create the file and write the required variable template.
~/.sofunny-image.envPrioritize using these variables:
SOFUNNY_BASE_URLSOFUNNY_API_KEYSOFUNNY_MODEL
Default expected values:
SOFUNNY_BASE_URL=http://127.0.0.1:3000SOFUNNY_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.pngText-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.jpgSpecify 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-ratio16:9 - :可选,默认
--image-size1K - :可选,默认读取配置,兜底为
--modelgemini-3.1-flash-image-preview - :可选,覆盖配置中的 base URL
--base-url - :可选,覆盖配置中的 token
--api-key
- : Required, instruction for image generation or editing
--prompt - : Can be passed repeatedly, one or more reference images
--input - : Optional, output file path
--output - : Optional, default is
--aspect-ratio16:9 - : Optional, default is
--image-size1K - : Optional, defaults to reading configuration, fallback to
--modelgemini-3.1-flash-image-preview - : Optional, overrides the base URL in configuration
--base-url - : Optional, overrides the token in configuration
--api-key
工作流
Workflow
- 收集用户的 prompt、参考图、输出路径和画幅要求。
- 运行 。
scripts/sofunny-image.js - 脚本会直接调用:
{BASE_URL}/v1beta/models/{MODEL}:generateContent
- 脚本从响应中提取最后一个 ,并将其视为最终图片保存到本地。
inlineData.data - 把保存路径返回给用户。
- Collect the user's prompt, reference images, output path, and aspect ratio requirements.
- Run .
scripts/sofunny-image.js - The script will directly call:
{BASE_URL}/v1beta/models/{MODEL}:generateContent
- The script extracts the last from the response and saves it as the final image locally.
inlineData.data - Return the save path to the user.
注意事项
Notes
- 本 skill 默认不附带 和
tools,避免图片模型在工具模式下失败。thinking - 应为服务根地址,不要手动带
BASE_URL。/v1 - 若未指定输出路径,脚本默认保存到:
- 当前工作目录
- 中只应使用
~/.sofunny-image.env变量,避免旧配置混入导致行为不一致。SOFUNNY_* - 如果 Gemini 在同一次响应中返回多张图片,脚本默认只保存最后一张,前面的图片视为中间产物。
- This skill does not include and
toolsby default to avoid failures of the image model in tool mode.thinking - should be the root address of the service, do not manually add
BASE_URL./v1 - If no output path is specified, the script will save the image by default to:
- Current working directory
- Only use variables in
SOFUNNY_*to avoid inconsistent behavior caused by mixing old configurations.~/.sofunny-image.env - 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.