Skip to content

Commit d177fd6

Browse files
committed
fix: GDHandler::save() remove transparency
1 parent d554e20 commit d177fd6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

system/Images/Handlers/GDHandler.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ public function save(?string $target = null, int $quality = 90): bool
225225

226226
$this->ensureResource();
227227

228+
// for png and webp we can actually preserve transparency
229+
if (in_array($this->image()->imageType, $this->supportTransparency, true)) {
230+
imagealphablending($this->resource, false);
231+
imagesavealpha($this->resource, true);
232+
}
233+
228234
switch ($this->image()->imageType) {
229235
case IMAGETYPE_GIF:
230236
if (! function_exists('imagegif')) {

0 commit comments

Comments
 (0)