How do i do Autotiling

I am trying to make a 2D-Minecraft or Terraria remake.
I spawn Tiles(8x8) with a 2D noise, i have now a map its a 100x100.
But i want to make the tiles connect with tilemap system.
Something like this)–>
But with corners to so a 47grid.