Changing of colors in image on server (PHP)
<p>i need to do this. I have got an image with 2 colors. One of them is black and the second is white transparent. I need to change this colors. Black into black transparent and white transparent into white non-transparent. I do this php script (function), but it doesn't work. Any ideas?</p>

<pre><code>&lt;?php
function conversion($input_file,$output_file){
// loading of image 
$img = @imagecreatefrompng($input_file);
//high quality of image
imagealphablending($img, true); 
imagesavealpha($img, true);
//defining of colors
$black = imagecolorallocate($img, 0, 0, 0);
$white = imagecolorallocate($img, 255, 255, 255);
//all black change into black transparent
imagecolortransparent($img, $black);
//all white on white non-transparent
ImageColorSet($img, $white, 255, 255, 255);
//save image
imagepng($img, $output_file);
imagedestroy($img);
}
conversion('http://imageshack.us/a/img849/3654/wholehand.png', './image3.png');
?&gt;
</code></pre>
