imagecolortransparent

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Define a color as transparent
<?php imagecolortransparent(GdImage $image, ?int $color = null): int
<?php         imagefill($resource, 0, 0, $matte);




        imagecolortransparent($resource, $matte);




        imagecopy($resource, $image->getCore(), 0, 0, 0, 0, $size->width, $size->height);
<?php         $resource = $image->getCore();




        $transIndex = imagecolortransparent($resource);



        if ($transIndex != -1) {

            $rgba = imagecolorsforindex($modified, $transIndex);
<?php             $rgba = imagecolorsforindex($modified, $transIndex);

            $transColor = imagecolorallocatealpha($modified, $rgba['red'], $rgba['green'], $rgba['blue'], 127);

            imagefill($modified, 0, 0, $transColor);

            imagecolortransparent($modified, $transColor);

        } else {

            imagealphablending($modified, false);

            imagesavealpha($modified, true);
<?php         imagealphablending($canvas, false);

        $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);

        imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);

        imagecolortransparent($canvas, $transparent);

        imagealphablending($canvas, true);