Hello @mf279, and welcome to the forum!
You can use the plugin created by @AkiR in form of a script collection which you would have to put together yourself, alternatively you can use the ready-made and directly installable & usable plugin I combined from these scripts.
It can be downloaded from here:
Alternatively, you can wait until the release of Krita 5.3.x where this functionality will be implemented natively, but it will be not as freely configurable as with this plugin.
Michelist