Skip to content

Commit

Permalink
Fix bug in Cloner::cloneEmpty()
Browse files Browse the repository at this point in the history
If an image was cloned with cloneEmpty() and a fully transparent color
for exampe "rgba(255, 255, 255, 0)" the turned out as white background.

This patch sets the background color as fully transparent if it has an
alpha channel value of 0 i.e. 100% transparent (clear).
  • Loading branch information
olivervogel committed Aug 5, 2024
1 parent 9564d59 commit cee93bd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Drivers/Gd/Cloner.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public static function cloneEmpty(
imagealphablending($clone, true);
imagesavealpha($clone, true);

if ($background->isClear()) {
imagecolortransparent($clone, $processor->colorToNative($background));
}

return $clone;
}

Expand Down

0 comments on commit cee93bd

Please sign in to comment.