transform-remove-background-with-transloadit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInputs
输入项
- Absolute path to a local input image
- Optional output path; default to an explicit sibling
.png
- 本地输入图片的绝对路径
- 可选输出路径;默认生成同级的指定文件
.png
Prepare Instructions
准备步骤
Resolve credentials in this order:
- Shell environment variables
- The current working directory only
.env ~/.transloadit/credentials
If your lives in a parent directory, export the variables into the shell first.
.envCreate in the current working directory.
steps.jsonImportant:
- For the current CLI, the file passed to must be a flat object keyed by step name.
--steps - Do not wrap the steps under a top-level key.
"steps"
json
{
":original": {
"robot": "/upload/handle"
},
"background_removed": {
"use": ":original",
"robot": "/image/bgremove",
"format": "png",
"result": true
}
}按以下顺序获取凭证:
- Shell环境变量
- 仅当前工作目录下的文件
.env ~/.transloadit/credentials
如果你的文件位于上级目录,请先将变量导出到Shell中。
.env在当前工作目录创建文件。
steps.json重要提示:
- 对于当前版本的CLI,传递给的文件必须是按步骤名称作为键的扁平对象。
--steps - 不要将步骤包裹在顶层的键下。
"steps"
json
{
":original": {
"robot": "/upload/handle"
},
"background_removed": {
"use": ":original",
"robot": "/image/bgremove",
"format": "png",
"result": true
}
}Run (Local Input Image)
运行(本地输入图片)
bash
npx -y @transloadit/node assemblies create \
--steps ./steps.json \
-i ./input/source.jpg \
-o ./out/result.pngReplace with your real input image path when needed.
./input/source.jpgAfter the command finishes, confirm the PNG exists at the expected output path.
bash
npx -y @transloadit/node assemblies create \
--steps ./steps.json \
-i ./input/source.jpg \
-o ./out/result.png必要时将替换为你的实际输入图片路径。
./input/source.jpg命令执行完成后,确认PNG文件已存在于预期的输出路径。
Debug If It Fails
失败时调试
bash
npx -y @transloadit/node assemblies get <assemblyIdOrUrl> -jNotes:
- Keep so the downloaded output preserves transparency.
format: "png" - Prefer as the default fallback when you want a reusable user-level setup.
~/.transloadit/credentials - A current-directory still takes precedence, so avoid it when deterministic account selection matters.
.env - If credentials only exist in a repo-root , run the command from that directory or export the variables first.
.env - Prefer an explicit PNG filename like . With the current CLI, using a directory output for a single result may preserve the input path instead of giving you a
./out/result.pngfilename..png - Prefer a clear foreground subject photo; background removal quality depends on the source image.
bash
npx -y @transloadit/node assemblies get <assemblyIdOrUrl> -j注意事项:
- 保留,这样下载的输出文件会保留透明效果。
format: "png" - 如果你需要可复用的用户级配置,优先使用作为默认备用选项。
~/.transloadit/credentials - 当前目录下的仍具有更高优先级,因此当需要确定账户选择时,请避免使用它。
.env - 如果凭证仅存在于仓库根目录的中,请从该目录运行命令,或先导出变量。
.env - 优先使用明确的PNG文件名,如。在当前版本的CLI中,对单个结果使用目录输出可能会保留输入路径,而不是生成
./out/result.png文件名。.png - 优先选择前景主体清晰的照片;背景移除的质量取决于源图片。