{"_id":"@chrxmvtik/background-removal","_rev":"13-a3c0efea1bdac6b1975aa492291bc6a5","time":{"created":"2023-07-13T21:27:12.161Z","1.0.3":"2023-07-07T17:54:00.244Z","modified":"2023-07-14T01:28:07.462Z","1.0.4":"2023-07-07T18:08:30.198Z","1.0.5":"2023-07-07T18:19:17.425Z","1.0.6":"2023-07-07T18:27:04.735Z","1.0.0":"2023-07-08T00:05:42.830Z","0.0.1":"2023-07-13T21:27:12.872Z","0.0.2":"2023-07-13T23:12:32.231Z","0.0.3":"2023-07-14T01:28:07.301Z"},"name":"@chrxmvtik/background-removal","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@chrxmvtik/background-removal","version":"0.0.1","description":"Background Removal in the Browser/Node","keywords":["background-removal","client-side","data-privacy","image-segmentation","image-matting","onnx"],"repository":{"type":"git","url":"git+https://github.com/imgly/background-removal-js.git"},"license":"SEE LICENSE IN LICENSE.md","author":{"name":"IMG.LY GmbH","email":"support@img.ly","url":"https://img.ly"},"bugs":{"email":"support@img.ly"},"main":"./dist/browser.js","module":"./dist/browser.mjs","browser":"./dist/browser.js","homepage":"https://img.ly/showcases/cesdk/web/background-removal/web","types":"./dist/browser.d.ts","scripts":{"start":"npm run clean; npm run watch","clean":"npx rimraf dist","test":"true","build":"npm run clean; npx webpack --mode production","watch":"npm run clean; npx webpack --watch --mode development","publish:public":"npm run build && npm publish --access public","lint":"npx prettier --write ."},"devDependencies":{"@types/lodash":"^4.14.195","@types/node":"^20.3.1","assert":"^2.0.0","lodash":"^4.17.21","onnxruntime-web":"^1.15.1","ts-loader":"^9.4.3","tslib":"^2.5.3","typescript":"^5.1.3","util":"^0.12.5","wasm-feature-detect":"^1.5.1","webpack":"^5.85.1","webpack-cli":"^5.1.4","zod":"^3.21.4"},"gitHead":"a3c722f19f29080ac30efb04a5c7e9010c94c3bb","_id":"@chrxmvtik/background-removal@0.0.1","_nodeVersion":"20.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-QhYXDBNhzNs52mEKF1G0a6LxrX8Y7IoKMZWuapqYoBH9iD5htU1Xhi/VCuHFT2fWbO4EZVxJL48Qp28CLCtNCQ==","shasum":"b90854e75628dea4563709de81d556de11f64bf1","tarball":"https://registry.npmjs.org/@chrxmvtik/background-removal/-/background-removal-0.0.1.tgz","fileCount":24,"unpackedSize":80560868,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjmaWSyPFoaqhyMNauiQOru9Uu12Al1vPQmS49lt/qBwIhAKVVsjNDEkDQDscbjl4/+bNCslSeWK8Lx/E7bxu2lOg9"}]},"_npmUser":{"name":"chrxmvtik","email":"chrxmvtik@gmail.com"},"directories":{},"maintainers":[{"name":"chrxmvtik","email":"chrxmvtik@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/background-removal_0.0.1_1689283632256_0.9739357067628216"},"_hasShrinkwrap":false},"0.0.2":{"name":"@chrxmvtik/background-removal","version":"0.0.2","description":"Background Removal in the Browser/Node","keywords":["background-removal","client-side","data-privacy","image-segmentation","image-matting","onnx"],"repository":{"type":"git","url":"git+https://github.com/imgly/background-removal-js.git"},"license":"SEE LICENSE IN LICENSE.md","author":{"name":"IMG.LY GmbH","email":"support@img.ly","url":"https://img.ly"},"bugs":{"email":"support@img.ly"},"main":"./dist/browser.js","module":"./dist/browser.mjs","browser":{"fs":false,"os":false,"path":false},"homepage":"https://img.ly/showcases/cesdk/web/background-removal/web","types":"./dist/browser.d.ts","scripts":{"start":"npm run clean; npm run watch","clean":"npx rimraf dist","test":"true","build":"npm run clean; npx webpack --mode production","watch":"npm run clean; npx webpack --watch --mode development","publish:public":"npm run build && npm publish --access public","lint":"npx prettier --write ."},"devDependencies":{"@types/lodash":"^4.14.195","@types/node":"^20.3.1","assert":"^2.0.0","lodash":"^4.17.21","onnxruntime-web":"^1.15.1","ts-loader":"^9.4.3","tslib":"^2.5.3","typescript":"^5.1.3","util":"^0.12.5","wasm-feature-detect":"^1.5.1","webpack":"^5.85.1","webpack-cli":"^5.1.4","zod":"^3.21.4"},"gitHead":"a3c722f19f29080ac30efb04a5c7e9010c94c3bb","_id":"@chrxmvtik/background-removal@0.0.2","_nodeVersion":"20.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-hi1MHEBSsa6AV1vtWhtoe7N59oJNYKTAowiBxsV/N3HZu5QhREFMyAzw2sowbuzQcIa62nTo/phdxShhWm58vA==","shasum":"d16c85be8abafa696d066333cb58b9e0f11b6361","tarball":"https://registry.npmjs.org/@chrxmvtik/background-removal/-/background-removal-0.0.2.tgz","fileCount":24,"unpackedSize":213091385,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCvhEPpzDXVib/nNYEzXno4I4Oy/rGfD4IlIveadZHbIwIgbmWIFZdpm72OmDo7q2Rm1ntMMdrRA0C/VT6PPJnYmMc="}]},"_npmUser":{"name":"chrxmvtik","email":"chrxmvtik@gmail.com"},"directories":{},"maintainers":[{"name":"chrxmvtik","email":"chrxmvtik@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/background-removal_0.0.2_1689289950467_0.45415575863083646"},"_hasShrinkwrap":false},"0.0.3":{"name":"@chrxmvtik/background-removal","version":"0.0.3","description":"Background Removal in the Browser/Node","keywords":["background-removal","client-side","data-privacy","image-segmentation","image-matting","onnx"],"repository":{"type":"git","url":"git+https://github.com/chrxmvtik/background-removal-js.git"},"license":"SEE LICENSE IN LICENSE.md","author":{"name":"IMG.LY GmbH","email":"support@img.ly","url":"https://img.ly"},"bugs":{"email":"support@img.ly"},"main":"./dist/browser.js","module":"./dist/browser.mjs","browser":{"fs":false,"os":false,"path":false},"homepage":"https://img.ly/showcases/cesdk/web/background-removal/web","types":"./dist/browser.d.ts","scripts":{"start":"npm run clean; npm run watch","clean":"npx rimraf dist","test":"true","build":"npm run clean; npx webpack --mode production","watch":"npm run clean; npx webpack --watch --mode development","publish:public":"npm run build && npm publish --access public","lint":"npx prettier --write ."},"devDependencies":{"@types/lodash":"^4.14.195","@types/node":"^20.3.1","assert":"^2.0.0","lodash":"^4.17.21","onnxruntime-web":"^1.15.1","ts-loader":"^9.4.3","tslib":"^2.5.3","typescript":"^5.1.3","util":"^0.12.5","wasm-feature-detect":"^1.5.1","webpack":"^5.85.1","webpack-cli":"^5.1.4","zod":"^3.21.4"},"gitHead":"c20a1990dd6f9e4c560bf5496b556cb56f2f1a6d","_id":"@chrxmvtik/background-removal@0.0.3","_nodeVersion":"20.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-4iQiNrO5E7kUuQC9kU94a+LrcFVbdXQ5sHC47OzGlptTysPP1wlwR7sWiIbL/haeKdzGeYFUbwhPosRVNMBVyQ==","shasum":"cc0fc7ec465bc7760a033d46fa4010c772c3f7e5","tarball":"https://registry.npmjs.org/@chrxmvtik/background-removal/-/background-removal-0.0.3.tgz","fileCount":24,"unpackedSize":213091480,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtgCFf0eYhDZllitSi7Aj81ADfCUouV8xjvx7THtNm9QIgRC0UyqwqNmbfD0FJvdvemm1POz7DJyNNe+5WgYCkS+g="}]},"_npmUser":{"name":"chrxmvtik","email":"chrxmvtik@gmail.com"},"directories":{},"maintainers":[{"name":"chrxmvtik","email":"chrxmvtik@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/background-removal_0.0.3_1689298085788_0.7023834662628565"},"_hasShrinkwrap":false}},"maintainers":[{"name":"chrxmvtik","email":"chrxmvtik@gmail.com"}],"description":"Background Removal in the Browser/Node","homepage":"https://img.ly/showcases/cesdk/web/background-removal/web","keywords":["background-removal","client-side","data-privacy","image-segmentation","image-matting","onnx"],"repository":{"type":"git","url":"git+https://github.com/chrxmvtik/background-removal-js.git"},"author":{"name":"IMG.LY GmbH","email":"support@img.ly","url":"https://img.ly"},"bugs":{"email":"support@img.ly"},"license":"SEE LICENSE IN LICENSE.md","readme":"# Background Removal in the Browser\n\n<p align=\"center\">\n  <img src=\"https://img.ly/static/background-removal-js-logo.png?utm_source=github&utm_medium=project&utm_campaign=bg-removal\" width=\"100\" height=\"100\" alt=\"\" />\n</p>\n\nRemove backgrounds from images directly in the browser environment with ease and no additional costs or privacy concerns.\nExplore an [interactive demo](https://img.ly/showcases/cesdk/web/background-removal/web?utm_source=github&utm_medium=project&utm_campaign=bg-removal).\n\n## Info\n\nThis is a fork of @imgly/background-removal with base adjusted to work with node\n\n## News\n\n- **`June 28th, 2023`:** We released the code of Background Removal JS.\n\n## Overview\n\n`@imgly/background-removal` is a powerful npm package that allows developers to seamlessly remove the background from images directly in the browser. With its unique features and capabilities, this package offers an innovative and cost-effective solution for background removal tasks without compromising data privacy.\n\nThe key features of `@imgly/background-removal` are:\n\n- **In-Browser Background Removal**: Our one-of-a-kind solution performs the entire background removal process directly in the user's browser, eliminating the need for additional server costs. By leveraging the computing power of the local device, users can enjoy a fast and efficient background removal process.\n\n- **Data Protection**: As `@imgly/background-removal` runs entirely in the browser, users can have peace of mind knowing that their images and sensitive information remain secure within their own devices. With no data transfers to external servers, data privacy concerns are effectively mitigated.\n\n- **Seamless Integration with IMG.LY's CE.SDK**: `@imgly/background-removal` provides seamless integration with [IMG.LY's CE.SDK](https://img.ly/products/creative-sdk?utm_source=github&utm_medium=project&utm_campaign=bg-removal), allowing developers to easily incorporate powerful in-browser image matting and background removal capabilities into their projects.\n\nThe Neural Network ([ONNX model](https://onnx.ai/)) and WASM files used by `@imgly/background-removal` are hosted on [UNPKG](https://www.unpkg.com/), making it readily available for download to all users of the library. See the section Custom Asset Serving if you want to host data on your own servers.\n\n<p align=\"center\">\n<img src=\"https://img.ly/showcases/cesdk/web/s/case-thumbnail/background-removal/background-removal-0.png?utm_source=github&utm_medium=project&utm_campaign=bg-removal\" alt=\"background removal js showcase\" />\n\n</p>\n\n## Installation\n\nYou can install `@imgly/background-removal` via npm or yarn. Use the following commands to install the package:\n\n### NPM\n\n```shell\nnpm install @imgly/background-removal\n```\n\n## Usage\n\n```typescript\nimport imglyRemoveBackground from \"@imgly/background-removal\"\n\nlet image_src: ImageData | ArrayBuffer | Uint8Array | Blob | URL | string = ...;\n\nimglyRemoveBackground(image_src).then((blob: Blob) => {\n  // The result is a blob encoded as PNG. It can be converted to an URL to be used as HTMLImage.src\n  const url = URL.createObjectURL(blob);\n})\n```\n\nNote: On the first run the wasm and onnx model files are fetched. This might, depending on the bandwidth, take time. Therefore, the first run takes proportionally longer than each consecutive run. Also, all files are cached by the browser and an additional model cache.\n\n## Advanced Configuration\n\nThe library does not need any configuration to get started. However, there are optional parameters that influence the behaviour and give more control over the library.\n\n```typescript\ntype Config = {\n  publicPath: string; // The public path used for model and wasm files\n  debug: bool; // enable or disable useful console.log outputs\n  proxyToWorker: bool; // Whether to proxy the calculations to a web worker. (Default true)\n  model: 'small' | 'medium'; // The model to use. (Default \"medium\")\n};\n```\n\n### Download Size vs Quality\n\nThe onnx model is shipped in various sizes and needs.\n\n- small (~40 MB) is the smallest model and is in most cases working fine but sometimes shows some artifacts. It's a quantized model.\n- medium (~80MB) is the default model.\n\n### Download Progress Monitoring\n\nOn the first run, the necessary data will be fetched and stored in the browser cache. Since the download might take some time, you have the option to tap into the download progress.\n\n```typescript\nlet config: Config = {\n  progress: (key, current, total) => {\n    console.log(`Downloading ${key}: ${current} of ${total}`);\n  }\n};\n```\n\n### Performance\n\nThe performance is largely dependent on the feature set available. Most prominently, ensure that `SharedArrayBuffer` is available [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer). Due to the security requirements of `SharedArrayBuffer` two headers need to be set to cross-origin isolate your site:\n\n```typescript\n'Cross-Origin-Opener-Policy': 'same-origin',\n'Cross-Origin-Embedder-Policy': 'require-corp'\n```\n\n### Custom Asset Serving\n\nCurrently, the wasm and onnx neural networks are served via unpkg. For production use, we advise you to host them yourself. Therefore, copy all .wasm and .onnx files to your public path `$PUBLIC_PATH` and reconfigure the library.\n\n```shell\ncp node_modules/@imgly/background-removal/dist/*.wasm $PUBLIC_PATH\ncp node_modules/@imgly/background-removal/dist/*.onnx $PUBLIC_PATH\n```\n\n```typescript\nimport imglyRemoveBackground, {Config} from \"@imgly/background-removal\"\n\nconst public_path = \"https://example.com/assets/\" ; // the path assets are served from\n\nlet config: Config =  {\n  publicPath: public_path, // path to the wasm files\n};\n\nlet image_src: ImageData | ArrayBuffer | Uint8Array | Blob | URL | string = ...;\n\nimglyRemoveBackground(image_src, config).then((blob: Blob) => {\n  // result is a blob encoded as PNG.\n  // It can be converted to an URL to be used as HTMLImage.src\n  const url = URL.createObjectURL(blob);\n})\n```\n\n### Debug Outputs\n\nEnable debug outputs and logging to the console\n\n```typescript\nlet config: Config = {\n  debug: true\n};\n```\n\n### Cross-Origin Resource Sharing (CORS)\n\nIf you are running into CORS issues you might want to pass additional parameters to the fetch function via\n\n```typescript\nlet config: Config = {\n  fetchArgs: {\n    mode: 'no-cors'\n  }\n};\n```\n\n`fetchArgs` are passed as second parameters to the fetch function as described in [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).\n\n## Who is it for?\n\n`@imgly/background-removal` is ideal for developers and projects that require efficient and cost-effective background removal directly in the browser. It caters to a wide range of use cases, including but not limited to:\n\n- _E-commerce applications_ that need to remove backgrounds from product images in real time.\n\n- _Image editing applications_ that require background removal capabilities for enhancing user experience.\n\n- _Web-based graphic design tools_ that aim to simplify the creative process with in-browser background removal.\n\nWhether you are a professional developer or a hobbyist, `@imgly/background-removal` empowers you to deliver impressive applications and services with ease.\n\n## License\n\nThe software is free for use under the GPL License. Please contact [support@img.ly](mailto:support@img.ly?subject=Background-Removal%20License) for questions about other licensing options.\n\n## Authors & Contributors\n\nThis library is made by IMG.LY shipping the world's premier SDKs for building creative applications.\nStart your trial of the [CreativeEditor SDK](https://img.ly/products/creative-sdk?utm_source=github&utm_medium=project&utm_campaign=bg-removal), [PhotoEditor SDK](https://img.ly/products/photo-sdk?utm_source=github&utm_medium=project&utm_campaign=bg-removal) & [VideoEditor SDK](https://img.ly/products/video-sdk?utm_source=github&utm_medium=project&utm_campaign=bg-removal).\n","readmeFilename":"README.md"}