Developer Documentation

Integrate high-speed neural background removal directly into your application.

Remove Background

POST/api/v1/remove-background

This endpoint accepts any standard image file (PNG, JPEG, WebP up to 10MB) and processes it through the BRIA RMBG-1.4 model running on ONNX Runtime. The image is resized to 1024×1024, normalized, and passed through the 8-bit quantized model in a single inference pass. The resulting alpha mask is applied back to the original image and returned as a transparent PNG.

Authentication is optional — you can send requests without any credentials, or include a JWT Bearer token to link usage to your account.

AuthorizationHeader (Optional)JWT Bearer token: Bearer <token>
imageForm data (Required)Raw image file binary. Max size: 10MB. Accepted: PNG, JPEG, WebP.
ResponseBodyRaw PNG bytes. Content-Type: image/png

Code Integrations

curl -X POST http://localhost:8080/api/v1/remove-background \
  -H "Authorization: Bearer <your_token>" \
  -F "image=@photo.jpg" \
  --output result.png

Tools & Technologies

Every component of G-Remover was chosen for performance, reliability, and developer ergonomics. Here is a detailed breakdown of each tool in the stack.

Rust

Core Language

The entire backend is written in Rust, providing memory safety without garbage collection, zero-cost abstractions, and fearless concurrency. Rust compiles to native machine code, making it one of the fastest languages available for server-side workloads.

Axum (v0.7)

Web Framework

Axum is an ergonomic, modular web framework built on top of Tokio, Tower, and Hyper. It provides type-safe extractors, middleware composition, and shared state management with zero boilerplate routing.

Tokio

Async Runtime

Tokio is a multi-threaded async runtime for Rust. It powers all asynchronous I/O operations including HTTP request handling, database queries, and file operations using a work-stealing thread pool scheduler.

ONNX Runtime (ort v2.0.0-rc.12)

AI Inference Engine

ONNX Runtime is a cross-platform, high-performance inference engine developed by Microsoft. The Rust ort crate provides native bindings to execute ONNX-format deep learning models without Python dependencies.

BRIA RMBG-1.4

AI Segmentation Model

A highly accurate ISNet-based segmentation model (8-bit quantized, ~42 MB) operating at 1024×1024 resolution. Loaded once at server startup and shared across all requests. The CPU arena allocator is disabled so memory is returned to the OS immediately after each inference, keeping peak RAM under 150 MB.

MongoDB

Database

MongoDB Atlas is used as the primary document store for user credentials, session management, and activity logging. The official mongodb Rust driver provides async-native query execution with connection pooling.

Next.js 16

Frontend Framework

Next.js powers the frontend dashboard with server-side rendering, automatic code splitting, file-system routing, and optimized static generation. The App Router architecture enables clean layout composition.

TailwindCSS v4

Styling System

TailwindCSS provides the utility-first CSS framework powering the dark-mode, glassmorphic design system. All components are styled using composable utility classes for maximum design consistency.

Bcrypt + JWT

Authentication

Passwords are hashed server-side using bcrypt with configurable salt rounds. Authentication tokens are issued as signed JWTs (HMAC-SHA256) with configurable expiration, enabling stateless API authorization.

ndarray + image

Tensor & Image Processing

The ndarray crate handles N-dimensional array operations for preprocessing image tensors (resize, normalize, reshape). The image crate handles decoding input files (PNG, JPEG, WebP) and encoding the final transparent PNG output.

Inference Pipeline

1

Preprocess

The input image is resized to 1024×1024 using a Triangle filter. Pixel values are normalized to the [-0.5, +0.5] range (mean=0.5, std=1.0) and shaped into a 1×3×1024×1024 float tensor.

2

RMBG-1.4 Inference

The tensor is processed by the BRIA RMBG-1.4 8-bit quantized model (~42 MB) in a single ONNX Runtime inference pass on CPU. The model outputs a 1024×1024 raw logit mask.

3

Normalize & Composite

Raw output logits are min-max normalized to [0, 1], resized back to the original image dimensions, and applied as the alpha channel of the original (unresized) image — preserving full color fidelity in the transparent PNG output.