rn-remove-image-bg 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +15 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -325,15 +325,18 @@ try {
325
325
  > **First-time Use**: On Android, the ML Kit model downloads automatically on first use. The library waits for the download to complete (up to ~15 seconds with retries) before processing. Subsequent calls are instant.
326
326
 
327
327
  ### Web
328
-
329
- - **Technology**: @imgly/background-removal (WebAssembly + ONNX)
330
- - **Model**: Downloads ~35MB on first use
331
- - **Output**: Data URL (`data:image/png;base64,...`) or WEBP
332
- - **Note**: Works in modern browsers with WebAssembly support
333
-
334
- > **Return Value Difference**: Web returns data URLs instead of file paths. Both work with `<Image>` components.
335
-
336
- If you don't need web support, you can tree-shake the `@imgly/background-removal` dependency.
328
+ - **Technology**: [@imgly/background-removal](https://github.com/imgly/background-removal-js) running in a **Web Worker**.
329
+ - **Performance**: Zero UI blocking. All processing happens in a background thread.
330
+ - **Implementation**:
331
+ - Uses an **Inline Worker** architecture.
332
+ - Loads the library from CDN (`jsdelivr`) automatically on first use.
333
+ - **No bundler configuration required**. Works with Metro, Webpack, Vite, etc. out of the box.
334
+ - **Requirements**:
335
+ - **Internet Connection**: Required for the first run to download the library and assets (~10MB) from CDN.
336
+ - **CORS**: Images loaded from external URLs must be CORS-enabled (`Access-Control-Allow-Origin: *`).
337
+ - **Output**: Data URL (`data:image/png;base64,...`) or WEBP Blob.
338
+
339
+ > **Note on Local Development**: If you see CSP errors, ensure your development server allows loading scripts from `cdn.jsdelivr.net`.
337
340
 
338
341
  ---
339
342
 
@@ -416,10 +419,9 @@ If you don't need web support, you can tree-shake the `@imgly/background-removal
416
419
 
417
420
  ### Web Not Working?
418
421
 
419
- 1. Check browser console for errors
420
- 2. Ensure your bundler supports WebAssembly
421
- 3. The first call downloads a ~35MB WASM model
422
- 4. CORS may block model download - check network tab
422
+ 1. **CSP Errors**: If you see "Content Security Policy" errors, ensure your app allows loading scripts/workers from `https://cdn.jsdelivr.net` and `blob:` URLs.
423
+ 2. **CORS Errors**: If loading an image from a URL, the server *must* return `Access-Control-Allow-Origin: *`. If not, download the image to a Blob first or use a proxy.
424
+ 3. **Data URL**: Remember that the web result is a `data:` URL. You can use it directly in `<Image source={{ uri: result }} />`.
423
425
 
424
426
  ### Native Module Not Found?
425
427
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-remove-image-bg",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "rn-remove-image-bg",
5
5
  "homepage": "https://github.com/a-eid/rn-remove-image-bg",
6
6
  "main": "lib/index",