This package removes backgrounds from images. Currently supporting only removing backgrounds from signatures.
npm i remove-signature-bg
# or
yarn add remove-signature-bg
Set these environment variables before using the package.
-
BG_REMOVER_API_URL
: Background Remover API URL -
BG_REMOVER_API_KEY
: Background Remover secret API key
import { cleanSignature, isValidImage } from 'remove-signature-bg';
// Read signature from express-fileupload
const { signature } = req.files;
// Validate if the signature is actually an image
const isValid = isValidImage(signature.mimetype);
// Remove background from signature
// Accepts buffer and return buffer
await cleanSignature(signature.data);
The package has a Postman collection that use can you to test the implementation.
Start the local server with npm run dev
and enjoy.