jide/nano-banana-2-bg-remove

Remove backgrounds with real alpha transparency using Nano Banana 2. Triangulation matting produces clean edges, proper semi-transparency, and accurate colors — superior to traditional background removal. Optionally specify what to isolate.

Public
24 runs

Nano Banana 2 Background Remove

Remove backgrounds from any image with real alpha transparency using Nano Banana 2 (Google Gemini 3.1 Flash Image).

Unlike traditional background removal tools (rembg, remove.bg, BiRefNet), this uses triangulation matting — the same image is rendered on white and black backgrounds, then mathematically accurate per-pixel alpha values are computed. This produces superior results for:

  • Semi-transparent elements (glass, smoke, hair, shadows)
  • Clean anti-aliased edges without halos
  • Accurate color recovery in translucent areas

How it works

  1. Your input image is fitted to the closest Nano Banana 2 output format (aspect ratio + resolution, up to 2K)
  2. Nano Banana 2 isolates foreground elements on a pure white background
  3. The white result is edited to a black background (constrained edit preserving foreground exactly)
  4. A triangulation matte computes the true alpha channel: alpha = 1 - (white - black) / 255
  5. The result is cropped back to original input dimensions

Parameters

Parameter Required Description
image Yes Input image to remove background from
prompt No Describe what to isolate (e.g. “the car”, “the person”). If empty, all foreground elements are kept
replicate_api_token Yes Your Replicate API token — the model calls Nano Banana 2 internally

Output

Always returns a PNG with alpha channel (RGBA) at the same dimensions as your input image.

Resolution

The model automatically selects the best output format (aspect ratio + resolution) to minimize padding. Images larger than 2K are scaled down and the result is scaled back up to original dimensions.

Billing

This model calls Nano Banana 2 twice per run (white + black background). You are billed for: - This model’s CPU compute time (minimal — just pixel math) - Two Nano Banana 2 runs (the main cost)

Your replicate_api_token is handled securely and never logged.

Model created
Model updated