ساخت عکس شفاف transparent

1p30

Member
سلام دوستان
من یه کد دارم که عکس های معمولی می سازه حالا می خوام transparent بسازه و الفا هم بگیره اگه یه کمک کنید که مشکل حل بشه
الان وقتی کد معمولی رو می گیره می سازه ولی با transparent و الفا مشکی می شه منون
PHP:
	$data = explode(",", $_POST['pixels']);
	$width = $_POST['width'];
	$height = $_POST['height'];
	$image=imagecreatetruecolor( $width ,$height );
	$background = imagecolorallocate( $image ,0 , 0 , 0 );
	//Copy pixels
	$i = 0;
	for($x=0; $x<=$width; $x++){
		for($y=0; $y<=$height; $y++){
			$int = hexdec($data[$i++]);
			$color = ImageColorAllocate ($image, 0xFF & ($int >> 0x10), 0xFF & ($int >> 0x8), 0xFF & $int);
			imagesetpixel ( $image , $x , $y , $color );
		}
	}
	//Output image and clean
	Imagepng($image,"output.png");
	imagedestroy( $image );
 

جدیدترین ارسال ها

بالا