protected function preserveAlpha()
{
if ($this->format == 'PNG' && $this->options['preserveAlpha'] === true) {
imagealphablending($this->workingImage, false);
$colorTransparent = imagecolorallocatealpha($this->workingImage, $this->options['alphaMaskColor'][0], $this->options['alphaMaskColor'][1], $this->options['alphaMaskColor'][2], 0);
imagefill($this->workingImage, 0, 0, $colorTransparent);
imagesavealpha($this->workingImage, true);
}
// preserve transparency in GIFs... this is usually pretty rough tho
if ($this->format == 'GIF' && $this->options['preserveTransparency'] === true) {
$colorTransparent = imagecolorallocate($this->workingImage, $this->options['transparencyMaskColor'][0], $this->options['transparencyMaskColor'][1], $this->options['transparencyMaskColor'][2]);
imagecolortransparent($this->workingImage, $colorTransparent);
imagetruecolortopalette($this->workingImage, true, 256);
}
}