title: How to remove png image white background color using php?
body: <p>I have to remove image background color and make that transparent. I am using below code to make image transparent but that is not working.</p>
  
  <pre><code>function transparent_background($filename, $color) 
  {
      $img = imagecreatefrompng('image.png'); //or whatever loading function you need
      $colors = explode(',', $color);
      $remove = imagecolorallocate($img, $colors[0], $colors[1], $colors[2]);
      imagecolortransparent($img, $remove);
      imagepng($img, $_SERVER['DOCUMENT_ROOT'].'/'.$filename);
  }
  
  transparent_background('logo_100x100.png', '255,255,255');
  </code></pre>
  
  <p>Please see screenshot for better understanding that what I am trying to do.</p>
  
  <p><a href="https://i.stack.imgur.com/VLUf9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VLUf9.png" alt="enter image description here"></a></p>
  
  <p>Thanks in advance...</p>