PHP gdLib 8-Bit PNG with alpha
Using imagesavealpha()
and a transparent bg color should do the trick...
Based on dfilkovi's code:
<?php
// Create a new true color image
$im = new imagecreatetruecolor(100, 100);
// Fill with alpha background
$alphabg = imagecolorallocatealpha($im, 0, 0, 0, 127);
imagefill($im, 0, 0, $alphabg);
// Convert to palette-based with no dithering and 255 colors with alpha
imagetruecolortopalette($im, false, 255);
imagesavealpha($im, true);
// Save the image
imagepng($im, './paletteimage.png');
imagedestroy($im);
?>