From 3b12ae90a26b2e3566b6a06fa184c749bf9a6046 Mon Sep 17 00:00:00 2001 From: Samir Jafferali Date: Fri, 17 Nov 2023 12:23:48 -0800 Subject: [PATCH] Calculate fuzz percent when removing background --- endpoints/subscription/add.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 +?>