Imagecolortransparent in PHP not working

I want to change the white color in the image ( http://www.arso.gov.si/vreme/napovedi%20in%20podatki/radar.gif ) to transparent. I think the code looks correct, there are no error logs, but the image remains unchanged. I double-checked whether the color in the image is really white, and it is. Please, help.

<?php
    $im = imagecreatefromgif("http://www.arso.gov.si/vreme/napovedi%20in%20podatki/radar.gif");

    imagealphablending($im, false);
    imagesavealpha($im, true);

    $white = imagecolorallocate($im, 255, 255, 255);

    imagecolortransparent($im, $white);

    imagegif($im, './image_radar_tran.gif');
    imagedestroy($im);
?>
<body style="background-color: lightgoldenrodyellow;">
    <img src="./image_radar_tran.gif" />
</body>
+5
source share
1 answer

Edit:

$white = imagecolorallocate($im, 255, 255, 255);

To:

$white = imagecolorexact($im, 255, 255, 255);

. , "" gif, , . , imagecolorexact, , .

+4

All Articles