[GIS] Convert TIF to PNG without normalizing alpha

elevationgdalgeotiff-tiffpngqgis

I'm trying to make some height maps with elevation data from https://earthexplorer.usgs.gov/. Since they give you assets in separate TIF tiles, I need to convert them to PNG and stitch them together to the area of land that I'm trying to extrude in Blender. The only problem is, once I run

gdal_translate -of PNG -ot Byte -scale input.tif output.png

with QGIS's terminal, the output png has all it's values 'normalized'. It end up looking like this in photoshop when I try to put the tiles together.

enter image description here

I partially can get around that by tediously adjusting contrast for each tile so they look normal to the eye, but it's always got artifacts in it. Is there a way to avoid this when converting with gdal?

Best Answer

It is not about the contrast, the elevation in each scene is different. In other words, the minimum and maximum elevation is different in each scene. The only solution to this problem is that you need to mosaic the DEM scene first to get a the correct elevation.

You need to use Merge tool from Processing toolbox -> GDAL/OGR -> Miscellaneous -> Merge

enter image description here

Make sure to select the proper rater type from the input data. You can check that from Properties -> Metadata and scroll down until you see the Data Type.

Related Question