Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

modern-rembg

qq15725122MIT0.1.2TypeScript support: included

A remove image background javascript lib. only ESM.

background-removal, client-side, data-privacy, image-segmentation, image-matting, onnx

readme

modern-rembg

Minzip Version Downloads Issues License

📦 Install

npm i modern-rembg

# peerDependencies
npm i onnxruntime-web@1.18.0

🦄 Usage

import { removeBackground } from 'modern-rembg'

removeBackground('/example.jpg').then(blob => {
  window.open(URL.createObjectURL(blob))
})

Use custom model

import { removeBackground } from 'modern-rembg'

removeBackground('/example.jpg', {
  debug: true,
  model: '/you-custom-model.onnx', // default use u2netp.onnx
  resolution: 320, // model resolution
}).then(blob => {
  window.open(URL.createObjectURL(blob))
})

Open source models

Output Model Resolution Size(MB) From
| |
u2net.onnx 320 168 danielgatis/rembg
u2netp.onnx 320 4 danielgatis/rembg
u2net_human_seg.onnx 320 168 danielgatis/rembg
u2net_cloth_seg.onnx 768 168 danielgatis/rembg
silueta.onnx 320 42 danielgatis/rembg
isnet-general-use.onnx 320 170 danielgatis/rembg
isnet-anime.onnx 1024 168 danielgatis/rembg
large 1024 176 imgly/background-removal-js
medium 1024 88 imgly/background-removal-js
small 1024 44 imgly/background-removal-js
PPModnet_MobileNetV2.onnx 320 26 PaddlePaddle/FastDeploy

changelog

0.1.2 (2024-05-27)

0.1.1 (2024-05-27)

0.1.0 (2024-05-27)

Bug Fixes

  • onnxruntime-web peer dependency version (061f4ba)

0.0.2 (2023-12-07)

Bug Fixes

0.0.1 (2023-12-06)