I see.
Why, the tiles are wall/no-wall rather than dungeon/non-dungeon.
For the later we'd have to redraw the tiles.
Alternatively you can figure out which cell is an edge in a separate step - each cell that has any dungeon neighbour that is a non-dungeon would be a wall; set them on a separate layer.
---
> However it sounds like in need two layers - one to fill in just the edges/corners on an upper layer and another under it for the inner layers for the floor?
I think this is consistent with what's in my head:
- LAYER ABOVE: walls
- LAYER BELOW: floors