Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

Calculate fuzz percent when removing background

Samir Jafferali3b12ae90a26b
diff --git a/endpoints/subscription/add.php b/endpoints/subscription/add.php
index 0c4e3c1..1071d83 100644
--- a/endpoints/subscription/add.php
+++ b/endpoints/subscription/add.php
@@ -46,7 +46,8 @@
$imagick = new Imagick($tempFile);
if ($removeBackground) {
- $imagick->transparentPaintImage("rgb(247, 247, 247)", 0, 102, false);
+ $fuzz = Imagick::getQuantum() * 0.1; // 10%
+ $imagick->transparentPaintImage("rgb(247, 247, 247)", 0, $fuzz, false);
}
$imagick->setImageFormat('png');
$imagick->writeImage($uploadFile);
@@ -202,4 +203,4 @@
}
}
$db->close();
-?>
\ No newline at end of file
+?>