Georeferencing PNG from bounding box in GDAL

gdalgeoreferencingpng

I have an image in PNG format and bounding box coordinates (upper left, lower right). How do I georeference it using command-line interface tools such as GDAL (or Python if it is not possible)?

In the end, I want to open the PNG image in QGIS but NOT use QGIS to georeference it (because I need to create an automation script).

for instance, the image name is image.png and the bounding box is 53.1111876266,11.7303748998,55.5611387985,13.1036943879. What should I type in my terminal?

Best Answer

gdal_translate is the tool. the command below will take the image.png, assign/georeference based on the bounding box (upper left, lower right) coordinates, and create an .aux.xml which containes the georeferencing location. Use the -a_ullr attributes. Further, read the documentation.

C:/> gdal_translate image.png output_georeferenced.png -a_ullr 53.1111876266 11.7303748998 55.5611387985 13.1036943879 -a_srs EPSG:4326