0
我有透明png圖像(它的單色),並且我應用colourise php GD濾鏡。所以現在它的顏色,但我無法應用白色背景來擺脫透明度。任何幫助整理出來,因爲我不能再看到了。 謝謝在GD之後應用背景到PNG透明圖像IMG_FILTER_COLORIZE
list($r,$g,$b) = array_map('hexdec',str_split($ColourPrimary,2));
$r = $r - 52;
$g = $g - 52;
$b = $b - 52;
imagesavealpha($im, true);
imagefilter($im, IMG_FILTER_COLORIZE, $r, $g, $b);
$bw = imagesx($im);
$bh = imagesy($im);
$background = imagecreatetruecolor($bw,$bh);
$bkwhite = imagecolorallocate($background, 255, 255, 255);
imagefill($background,0,0,$bkwhite);
imagecopy($background, $im, 0, 0, 0, 0, $bw, $bh);