Let's Build: background remover with Transloadit
Remove the background from a local product photo or portrait and save the result as a PNG. This example uploads one image to Transloadit, waits for processing, and downloads the result to a new local file.
What we’re building
The command accepts a nonempty PNG or JPEG file of up to 20 MiB and requires an explicit output path
ending in .png. These are limits of this tutorial runner. The original file stays unchanged; you
inspect the saved image before using it in a catalog or design.
Background removal is billed. You need an existing Transloadit Workspace Auth Key and Secret, and an image you have permission to upload. No separate AI provider credentials are needed. The recipe leaves provider selection at the Robot’s automatic default; the program does not create or change credentials. Review pricing before running it on more files.
Pipeline overview
The 🤖 /image/bgremove Robot takes the uploaded image and produces the PNG. The runner then saves the result locally, so you do not need to keep a temporary result URL.
Local PNG or JPEG → upload → /image/bgremove → download → result.png
Assembly snippet
The downloadable program exports its recipe as example. From the project layout below, this
TypeScript reads the same Assembly Instructions
used by the command, without submitting an Assembly:
import { example } from './background-remover/run.ts'
const steps = example.steps()
Its remove_background Step uses :original, sets format: 'png', and marks the output with
result: true. Keep changes in the downloaded recipe if you adapt the pipeline, so the command and
your application use the same instructions.
Try the example app
Install Node.js 26,
Corepack, and cURL first. Node.js 26.12.1 was the tested
runtime; use a maintained patch of Node.js 26 for new installations. Corepack is a separate
prerequisite. Start in a new empty directory outside an existing Node project and follow the
example README to install and download the app. It
pins Yarn 4.12.0, @transloadit/node 4.14.0, zod 3.25.76, and zod-to-json-schema 3.25.2 as a
tested combination, rather than claiming these are the latest packages. Run the installation commands
one at a time, stopping if any command fails.
Download both background-remover/run.ts and shared/runtime.ts using the README’s commands.
Their relative layout matters: the program imports ../shared/runtime.ts. Run the README’s
--help command before configuring access; it works without credentials. Keep the generated lockfile
if you adapt the example.
In the same shell, export your existing credentials, replacing the placeholders locally:
export TRANSLOADIT_AUTH_KEY='YOUR_AUTH_KEY'
export TRANSLOADIT_AUTH_SECRET='YOUR_AUTH_SECRET'
Keep the Secret out of source control and browser code. The program reads these environment variables directly; it does not load an environment file.
Place your image at input.jpg, or replace the input argument with its path. Choose an output
filename that does not exist. Running this command authorizes billed processing:
node background-remover/run.ts --input ./input.jpg --output ./result.png
On success, the terminal prints Saved followed by the local
output path. Open result.png in an image editor that displays transparency, or place it over a
contrasting background. Check that the background became transparent and that the subject, edges,
and fine details remain usable. A completed Assembly and a valid PNG alone do not establish a good
cutout.
The runner refuses an existing destination before submitting an Assembly, so a rerun needs a new output filename. It limits the downloaded result to 20 MiB, allows up to five minutes for processing, and gives the result download a separate 30-second timeout. If a run fails after printing an Assembly ID, inspect that Assembly in the Console before retrying. A local timeout or interruption does not establish that remote processing stopped, and failed processing can still be billed. The runner does not automatically retry an Assembly.
Suggested inputs for visuals
Start with a non-sensitive product photo with a clear outline, or a portrait you may upload. Compare the saved PNG against the original at the same scale. Hair, translucent materials, shadows, and foreground objects that resemble the background need close inspection; choose another input if the cutout removes something you need.
Next steps
After inspecting the cutout, you can extend the downloaded recipe with resizing or thumbnail Steps. The Robot documentation describes the available background-removal options. Keep the local PNG as your reviewed result before building a larger upload workflow.
