imagecolorsforindex

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Get the colors for an index
<?php imagecolorsforindex(GdImage $image, int $color): array
<?php         $color = imagecolorat($image->getCore(), $x, $y);



        if ( ! imageistruecolor($image->getCore())) {

            $color = imagecolorsforindex($image->getCore(), $color);

            $color['alpha'] = round(1 - $color['alpha'] / 127, 2);

        }
<?php         $transIndex = imagecolortransparent($resource);



        if ($transIndex != -1) {

            $rgba = imagecolorsforindex($modified, $transIndex);

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

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

            imagecolortransparent($modified, $transColor);