PHP Image change type

// Create a new image in the memory from the file 
$png_image = imagecreatefrompng( "input.png" );
// Save the image as output.jpg
imagejpeg( $png_image, "output.jpg" );
// Clear the memory of the tempory image 
imagedestroy( $png_image );