Convert Text Maze to fancy graphic

I am writing a game using Swift and SpriteKit. the game mechanics are not the issue. the problem is the “maze” is stored as a ASCII text file using “#” to denote walls. The first version simply replaced each “#” with a single sprite which looks like this

I want a more fluid display that looks more like this

the way I am doing this is by analyzing all the “neighbors” of a given “#” and coverting that to a number between 0 and 255. The based on that number, choosing the correct wall sprite.

This is working quite well , but I the only way I can achieve a smooth image is using 45 different sprites. However it seems all the existing programs use only 16. I can’t figure how those handle all the diverse corner patterns. And I can’t find any “code” examples that show how it might be done

Seems the best solution is to NOT look at all 8 neighbors, but only the 4 up/down ones. This then uses only 16 sprites, and the only downside is a “divot” that appears , but that is acceptable
Screenshot 2023-08-13 at 9.38.52 AM