A simple Next.js tool with two free, client-side photo features:
- Remove Background — AI-powered, using
@imgly/background-removal(WASM/ONNX, runs in the browser, no server, no API key, no cost). - Cartoonify — a pure canvas filter (color smoothing + posterize + edge outlines). No AI model, no network call, instant, and works completely offline.
npm install
npm run devRemove Background
- Images never leave the browser — background removal runs client-side using an ONNX model loaded from IMG.LY's CDN.
- The first run downloads the AI model (~170–180MB, full-quality version). The browser caches it, so every run after that is much faster.
- Multiple photos are processed in parallel (each gets its own Web Worker) for speed.
- Output is a transparent PNG.
Cartoonify
- Pure pixel math in
lib/cartoonify.js: box blur to flatten colors, posterize to reduce color levels, Sobel edge detection to draw outlines. - Tunable via the
optsobject incartoonify()—colorLevels(fewer = flatter look),edgeThreshold(higher = fewer/bolder lines),blurRadius(higher = flatter regions),maxDim(processing resolution, kept at 1400px for speed). - Output is a JPEG (no transparency needed since the original background stays in the image).
- Push to GitHub, then import the repo in Vercel.
- Deploy — no environment variables needed, this tool has no backend dependencies.
- Max 6 photos at once (
MAX_IMAGESinapp/page.js). next.config.jsexcludesonnxruntime-nodefrom the webpack bundle — that's a Node-only asset the background-removal library optionally references but doesn't need in the browser, and including it breaks the build.- If the cartoon effect looks too harsh or too soft, tweak
colorLevels/edgeThreshold/blurRadiusin thecartoonify()call insideapp/page.js.