From 38b7bf53cc25b87a749a937532fa589c956f9b70 Mon Sep 17 00:00:00 2001 From: Tailszefox Date: Fri, 12 Feb 2021 10:16:57 +0100 Subject: [PATCH] Crop picture to remove swatch --- fusion.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fusion.php b/fusion.php index 8422ff3..f205c1b 100644 --- a/fusion.php +++ b/fusion.php @@ -37,6 +37,14 @@ for($i = 0; $i < imagecolorstotal($from); $i++) } } +// Retain transparency +imagealphablending($from, false); +imagesavealpha($from, true); +imagefill($from, 0, 0, imagecolorallocatealpha($from, 255, 255, 255, 127)); + +// Crop 1px from bottom to avoid showing swatch +$from = imagecrop($from, ['x' => 0, 'y' => 0, 'width' => imagesx($from), 'height' => imagesy($from) - 1]); + if(!$debug) { header('Content-Type: image/png');