I know that the OP specifically asked for a gdal solution but may I offer another solution that works better for me ?
Here I'm using the rasterIo lib (available on both pipy and conda) to read the png, extract band information and build the output file. As it's more pythonic, I think if something goes wrong you'll have more error logs to help you.
import rasterio as rio
dataset = rio.open('input.png')
bands = [1, 2, 3] # I assume that you have only 3 band i.e. no alpha channel in your PNG
data = dataset.read(bands)
# create the output transform
west, south, east, north = (-180, -90, 180, 90)
transform = rio.transform.from_bounds(
west,
south,
east,
north,
data.shape[1],
data.shape[2]
)
# set the output image kwargs
kwargs = {
"driver": "GTiff",
"width": data.shape[1],
"height": data.shape[2],
"count": len(bands),
"dtype": data.dtype,
"nodata": 0,
"transform": transform,
"crs": "EPSG:4326"
}
with rio.open("output.tiff", "w", **kwargs) as dst:
dst.write(data, indexes=bands)
output
?