imagesavealpha

Supported Versions: PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8
Whether to retain full alpha channel information when saving images
<?php imagesavealpha(GdImage $image, bool $enable): bool
<?php             imagecolortransparent($modified, $transColor);

        } else {

            imagealphablending($modified, false);

            imagesavealpha($modified, true);

        }
<?php         $height = imagesy($core);

        $clone = imagecreatetruecolor($width, $height);

        imagealphablending($clone, false);

        imagesavealpha($clone, true);

        $transparency = imagecolorallocatealpha($clone, 0, 0, 0, 127);

        imagefill($clone, 0, 0, $transparency);

        
<?php         ob_start();

        $resource = $this->image->getCore();

        imagealphablending($resource, false);

        imagesavealpha($resource, true);

        imagepng($resource, null, -1);

        $this->image->mime = image_type_to_mime_type(IMAGETYPE_PNG);

        $buffer = ob_get_contents();
<?php         ob_start();

        imagepalettetotruecolor($this->image->getCore());

        imagealphablending($this->image->getCore(), true);

        imagesavealpha($this->image->getCore(), true);

        imagewebp($this->image->getCore(), null, $this->quality);

        $this->image->mime = defined('IMAGETYPE_WEBP') ? image_type_to_mime_type(IMAGETYPE_WEBP) : 'image/webp';

        $buffer = ob_get_contents();