rn-remove-image-bg 0.0.27 → 0.0.28

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.
@@ -23,7 +23,9 @@ export async function compressImage(uri, options) {
23
23
  if (!ctx) {
24
24
  throw new Error('Canvas 2D context not available');
25
25
  }
26
- // Draw image
26
+ // Clear canvas with transparent pixels (preserve alpha channel)
27
+ ctx.clearRect(0, 0, width, height);
28
+ // Draw image (preserves transparency from source)
27
29
  ctx.drawImage(img, 0, 0, width, height);
28
30
  // Export
29
31
  // Note: quality (0-1) is ignored for PNG
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rn-remove-image-bg",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "description": "rn-remove-image-bg",
5
5
  "homepage": "https://github.com/a-eid/rn-remove-image-bg",
6
6
  "main": "lib/index",
@@ -28,7 +28,10 @@ export async function compressImage(uri: string, options: CompressImageOptions):
28
28
  throw new Error('Canvas 2D context not available');
29
29
  }
30
30
 
31
- // Draw image
31
+ // Clear canvas with transparent pixels (preserve alpha channel)
32
+ ctx.clearRect(0, 0, width, height);
33
+
34
+ // Draw image (preserves transparency from source)
32
35
  ctx.drawImage(img, 0, 0, width, height);
33
36
 
34
37
  // Export