Hi, I am creating thumbnails with PHP, the problem is when I upload a transparent image, it makes a really bad thumbnail. I would like to set a solid color as the background, how do I do this? My thumbnail code is: function thumbnail($imagename) { list($width, $height, $type) = getimagesize("photos/$imagename"); if ($type == 1) $img = imagecreatefromgif("photos/$imagename"); else if ($type == 2) $img = imagecreatefromjpeg("photos/$imagename"); else if ($type == 3) $img = imagecreatefrompng("photos/$imagename"); if ($width > $height && $width >= 150) { $diff = $width/150; $width = 150; $height = $height/$diff; } else if ($width < $height && $height >= 150) { $diff = $height/150; $height = 150; $width = $width/$diff; } $dstimg = imagecreate($width,$height); imagecopyresized($dstimg,$img, 0,0,0,0,$width,$height,imagesx($img),imagesy($img)); if ($type == 1) $img = imagegif($dstimg, "thumbnails/$imagename"); else if ($type == 2) $img = imagejpeg($dstimg, "thumbnails/$imagename"); else if ($type == 3) $img = imagepng($dstimg, "thumbnails/$imagename"); } PHP: