gd - PHP - incorrect colors when using imagecopy -


i have couple of png images generate so:

$img = imagecreatefrompng($full_path_to_file); imagealphablending($img , true); // setting alpha blending on imagesavealpha($img , true); // save alphablending setting 

the images come out fine, right colors , transparent background.

i need combine these images one. following:

  1. create blank image right dimensions

    $full_image = imagecreate($full_width, $full_height);

  2. copy png images 1 one onto blank image

    imagecopy($full_image, $src, $dest_x, $dest_y, 0, 0, $src_width, $src_height)

the images combined ok. background transparent, the colors not correct.

how can make sure right colors?

update: suggested, fix use imagecreatetruecolor also, need set second parameter imagealphablending false. when creating png images , creating full_image, call

imagealphablending($img , false); // updated false imagesavealpha($img , true);  

documentation imagesavealpha says:

you have unset alphablending (imagealphablending($im, false)), use it.

try using: imagecreatetruecolor instead of imagecreate.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -