eXorithm – Execute Algorithm: View / Run Algorithm image_create_alpha

Logo Beta

function image_create_alpha ($width$height

{

  // Create a normal image and apply required settings

  $img = imagecreatetruecolor$width$height);

  imagealphablending$img, false);

  imagesavealpha$img, true);

  

  // Apply the transparent background

  $trans = imagecolorallocatealpha$img, 0, 0, 0, 127);

  for ($x = 0; $x < $width$x++)

  {

    for ($y = 0; $y < $height$y++)

    {

      imagesetpixel$img$x$y$trans);

    }

  }

  

  return $img