I have a GIF with a transparent background. I then use some PHP to copy a section of it out. The transparent regions then turn black.
//variables are all properly defined elsewhere
$target_id = imagecreatetruecolor($dest_x, $dest_y);
$target_pic = imagecopyresampled($target_id,$source_id_original, 0, 0, 0, 0, $dest_x, $dest_y, $size[0],$size[1]);
$thumblink = $thumb_dir.$prefix.$name;
if (ereg("\.gif$", $name))
{
$source_id = imagegif($target_id,$thumblink, $quality);
$source_id_original = imagecreatefromgif($thumblink);
}