Automatize Importing Heightmaps from blueprints UE 4.27 and UE5

Hi, I need to generate different landscapes importing different height maps in unreal engine 5 (one at a time) from editor or in runtime. I know that it can be done with the option “import from file” inside the terrain editor. But my problem is that I need to automate this process, since I have to load more than 100 different maps, take a picture and load the next one. I have tried with the blueprint “Landscape Import Heightmap from RenderTarget” it works, but it produces a strong terrace or step effect (The texture is in 16 bits and does not produce this effect when I import it by hand from the LandScape menu) I have also tried all possible compression settings when importing the image and I don’t know where the error is.
Any idea on how to automate the heightmap loading step?
Thank you very much.