This plugin automatically chooeses the right tile number for an given tile.
The left is the input and the right part is what the autotiler makes of it. You can check out an demo here: https://data.bureaubureau.de/philip/autotiling/
Or grab the Code on Github: https://github.com/Houly/Impact-Autotiling