Skip to content

Repository files navigation

LumaCut icon
LumaCut

Studio-grade background removal tool β€” entirely in your browser.
Zero uploads. Zero servers. Zero cost per image. Just unmistakable clarity.

Next.js 16 WASM IndexedDB Privacy MIT


✨ What is LumaCut?

LumaCut is a zero-server, zero-latency AI background removal tool that runs the entire inference pipeline directly inside your web browser using WebAssembly and ONNX Runtime Web.

Most background-removal tools upload your images to a cloud server, charge per API call, and introduce latency and privacy risks. LumaCut flips that model completely β€” the AI model is downloaded once to your device (~40 MB, cached forever), and every subsequent cut happens locally, instantly, and for free.


πŸ–ΌοΈ Before & After

Demo 1 β€” Anime illustration

Before After
Original girl with parasol Background removed
Original .jpg β€” full background intact Transparent .png β€” subject isolated with hair-fine edge precision

Demo 2 β€” Real-world photo (Lewis Hamilton)

Before After
Lewis Hamilton original Lewis Hamilton cut out
Original .jpg β€” complex background with crowd and environment Transparent .png β€” subject perfectly separated, even across complex edges

Both cuts were made using LumaCut in a standard browser window β€” no server, no API key, no upload.


πŸš€ Features

🧠 In-Browser WASM Inference

The AI model (@imgly/background-removal powered by ONNX Runtime Web) runs entirely inside a WebWorker in your browser. Your images never leave your device β€” not even for a millisecond. This is privacy by architecture, not by policy.

πŸ“¦ Batch Processing

Drop an entire folder of images at once. LumaCut accepts multiple files simultaneously and processes them sequentially in a FIFO queue. A real-time "Processing 2 of 5…" indicator keeps you informed while the queue drains.

πŸ“₯ Individual & ZIP Download

  • Each processed image has its own Download PNG button β€” one click, instant save.
  • When a batch finishes, a "Download All as ZIP" button appears, bundling every transparent PNG into a single archive using jszip β€” generated entirely in memory, no server required.

πŸ•˜ Persistent Session History

Every successful cut is automatically saved to IndexedDB via localforage. Your session history survives page reloads, browser restarts, and even device reboots (as long as you're on the same browser). The history card in the Ledger section shows your 5 most recent before/after pairs with relative timestamps.

πŸ“Š Model Download Overlay

The very first time you process an image, the browser downloads the ONNX model (~40 MB). LumaCut shows a prominent, frosted-glass loading overlay with a progress bar and byte counter so you always know what's happening. After that, the model is cached in the browser's Cache API and loads instantly forever.

🎨 Premium Aesthetics

Built with a dark-first editorial design system:

  • Glassmorphism cards with backdrop-blur and layered transparency
  • Cursor-reveal animation on the Hero β€” move your mouse to unveil the before/after split with a slanted, spring-eased reveal strip
  • Sticky parallax hero β€” the hero blurs and scales away as you scroll, revealing the workspace beneath
  • Fraunces + Inter typography for that editorial editorial premium feel
  • Smooth-scroll navigation throughout

πŸ”’ Zero-Trust Privacy Model

Concern LumaCut's Answer
Where does my image go? Nowhere. It stays in RAM.
Does it need an account? No.
Does it have usage limits? No.
Does it work offline? Yes, after the first model download.
Is the model stored forever? Yes, in your browser's Cache API.

πŸ—οΈ Architecture

Browser
β”œβ”€β”€ Next.js 16 (Turbopack)
β”‚   β”œβ”€β”€ app/page.tsx              ← 3-slide page layout
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ hero-slide.tsx        ← Cursor-reveal hero
β”‚   β”‚   β”œβ”€β”€ workspace-slide.tsx   ← Processing orchestrator
β”‚   β”‚   β”‚   β”œβ”€β”€ dropzone.tsx      ← Multi-file DnD zone
β”‚   β”‚   β”‚   β”œβ”€β”€ result-card.tsx   ← Before/after card
β”‚   β”‚   β”‚   β”œβ”€β”€ model-loader-overlay.tsx
β”‚   β”‚   β”‚   └── batch-progress-bar.tsx
β”‚   β”‚   └── features-slide.tsx    ← Ledger / session history
β”‚   └── lib/
β”‚       β”œβ”€β”€ bg-removal.ts         ← @imgly wrapper + progress aggregation
β”‚       └── session-store.ts      ← localforage IndexedDB layer
β”‚
β”œβ”€β”€ @imgly/background-removal     ← ONNX Runtime Web (WASM)
β”‚   └── Fetches model from CDN once, caches in Cache API
β”‚
β”œβ”€β”€ jszip                         ← In-memory ZIP generation
└── localforage                   ← IndexedDB abstraction (session history)

Processing Pipeline

Drop image(s)
     β”‚
     β–Ό
Add to queue (status: "queued")
     β”‚
     β–Ό
processOne() β€” calls removeBackground(file, { progress })
     β”‚         β”œβ”€β”€ First call: download ONNX model (~40MB) β†’ ModelLoaderOverlay
     β”‚         └── Cached calls: load from Cache API β†’ instant
     β”‚
     β–Ό
Blob + DataURL returned
     β”‚
     β”œβ”€β”€ Save to IndexedDB (input + output DataURL)
     β”œβ”€β”€ Update item status β†’ "done"
     └── Drain queue β†’ processOne(next item)

πŸ› οΈ Tech Stack

Layer Technology
Framework Next.js 16 with Turbopack
Language TypeScript
Styling Tailwind CSS v4
AI Engine @imgly/background-removal (ONNX Runtime Web)
ZIP Export jszip
Persistence localforage (IndexedDB)
Fonts Inter (UI) + Fraunces (editorial serif) via next/font/google
Icons lucide-react

🚦 Getting Started

Prerequisites

  • Node.js 18+
  • npm, pnpm, or yarn

Installation

# Clone the repository
git clone https://github.com/your-username/lumacut.git
cd lumacut

# Install dependencies
npm install

# Start the development server
npm run dev

Open http://localhost:3000 in your browser.

First Use

  1. The Hero loads instantly β€” move your cursor to see the before/after cursor-reveal
  2. Click "Start your cut" or scroll down to the Workspace section
  3. Drag one or more images onto the drop zone (or click to browse)
  4. On your very first image: a loading overlay appears while the AI model downloads (~40 MB, one-time only)
  5. The background is removed and a transparent PNG result appears
  6. Click the ⬇ download button on any result card, or wait for the full batch then click "Download All as ZIP"
  7. Scroll to the Ledger section to see your session history (persists across reloads)

Build for Production

npm run build
npm start

πŸ”§ Configuration

next.config.mjs

turbopack: {
  resolveAlias: {
    // Prevents Turbopack from bundling Node.js-only ONNX backend in browser bundle
    'sharp': './lib/empty-shim.js',
    'onnxruntime-node': './lib/empty-shim.js',
  },
},

COOP/COEP Headers (Optional)

@imgly/background-removal performs best with SharedArrayBuffer enabled, which requires:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

These are intentionally omitted in the default config to avoid breaking cross-origin assets. The library falls back gracefully to single-threaded WASM, which works excellently for most images. If you need maximum performance for very high-resolution batch processing, you can add these headers selectively to the / route in next.config.mjs.


πŸ“‚ Project Structure

lumacut/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ globals.css          ← Design tokens, mesh-checker, animations
β”‚   β”œβ”€β”€ layout.tsx           ← Font loading, metadata, viewport
β”‚   └── page.tsx             ← 3-section page layout
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ hero-slide.tsx        ← Slide 1: Cursor-reveal hero
β”‚   β”œβ”€β”€ workspace-slide.tsx   ← Slide 2: Processing pipeline orchestrator
β”‚   β”œβ”€β”€ features-slide.tsx    ← Slide 3: Ledger (history + why Luma Cut)
β”‚   β”œβ”€β”€ site-nav.tsx          ← Sticky glassmorphism navigation
β”‚   β”œβ”€β”€ dropzone.tsx          ← Multi-file drag-and-drop zone
β”‚   β”œβ”€β”€ result-card.tsx       ← Before/after comparison card
β”‚   β”œβ”€β”€ model-loader-overlay.tsx ← First-run model download overlay
β”‚   └── batch-progress-bar.tsx   ← Sequential batch progress indicator
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ bg-removal.ts         ← @imgly wrapper with progress aggregation
β”‚   β”œβ”€β”€ session-store.ts      ← localforage IndexedDB CRUD
β”‚   └── empty-shim.js         ← Browser stub for Node.js packages
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ girl_2.jpg            ← Hero demo image (original)
β”‚   └── girl_bgremoved.png    ← Hero demo image (background removed)
└── beforeafter/
    β”œβ”€β”€ 8692651.jpg           ← Lewis Hamilton demo (original)
    └── lumacut_8692651.png   ← Lewis Hamilton demo (cut out)

🀝 Contributing

Pull requests are welcome. For major changes, please open an issue first.

  1. Fork the repo
  2. Create your feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature/my-feature
  5. Open a Pull Request

πŸ“„ License

MIT Β© LumaCut contributors


Made with β™₯ and WebAssembly Β Β·Β  No servers were harmed in the making of this tool.

About

LumaCut is a studio-grade AI background removal tool that runs entirely in your web browser using WebAssembly and ONNX Runtime Web. It features complete privacy with zero image uploads, batch processing, ZIP exports, and IndexedDB session history, all built on Next.js 16.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages