How do i get a transparent background after rotaing a png image with php?

前端 未结 7 1234
天命终不由人
天命终不由人 2020-12-19 10:38

So I have png image and I rotate it but i get a black background.. or if i do the color code ofr white i get white.. I tried doing this..

$trans = imagecol         


        
相关标签:
7条回答
  • 2020-12-19 11:06
            // Turn off transparency blending (temporarily)
            imagealphablending($image, false);
    
            // Create a new transparent color for image
            $color = imagecolorallocatealpha($image, 0, 0, 0, 127);
    
            // Completely fill the background of the new image with allocated color.
            imagefill($image, 0, 0, $color);
    
            // Restore transparency blending
            imagesavealpha($image, true);
    
    0 讨论(0)
提交回复
热议问题