Background Removal Provider
Interface
Section titled “Interface”interface BackgroundRemovalProvider { remove( input: string | Blob, opts?: { signal?: AbortSignal; onProgress?: (pct: number) => void }, ): Promise<Blob>}Default
Section titled “Default”createImglyBackgroundRemoval() — lazy-imports @imgly/background-removal
(an optional peer dep) and runs entirely in the browser. If the peer dep
isn’t installed, the provider throws on first use.
npm install @imgly/background-removalExample: server-side service
Section titled “Example: server-side service”import type { BackgroundRemovalProvider } from '@fastlabai/design-editor'
export function createServerBgRemoval(): BackgroundRemovalProvider { return { async remove(input) { const blob = typeof input === 'string' ? await fetch(input).then((r) => r.blob()) : input const fd = new FormData() fd.append('image', blob) const r = await fetch('/api/bg-remove', { method: 'POST', body: fd }) return r.blob() }, }}