I used the following method to turn the entire transparent image into black.
$path_1 = './image/1.jpg';
// Picture 2
$path_2 = './image/2.jpg'; ;
//Create image object
$image_1 = imagecreatefromjpeg($path_1);
$image_x1 =imagecreatetruecolor(525, 525);
imagecopyresampled($image_x1, $image_1, 0, 0, 0, 0,525,525,imagesx($image_1), imagesy($image_1));