Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't use transparent background with imagecopymerge

I am calling imagecopymerge($dst_r, $logo, 0, 0, 0, 0, $LogoX, $LogoY, 100); where $logo is a png file with transparent background. From some reason the background comes out white instead.

What am I doing wrong?

Thanks.

like image 553
AYBABTU Avatar asked Apr 03 '11 11:04

AYBABTU


1 Answers

You need to use imagealphablending($dst_r, TRUE); to allow copying with retaining the transparent colors. Many more comments (...) in the manual suggest using imagecopy instead, because imagecopymerge was never intended to be used with transparency. If you use pct=100 anyway, then the normal imagecopy might be an option.

like image 107
mario Avatar answered Sep 17 '22 05:09

mario