I will use the following image(cc0 license, created by me):

As you can see it is not yet tileable:

I will use Gimp to fix it.
I will open the image with the program, go to Filters->Map->Tile Seamless -> OK button
Export the image (I saved it in jpg format) and that's it's!



The algorithm works for two simple dimensions, it can be used for floors or walls, but to build for example a tileable cube problems will occur. But, actually can still be used on cubic geometries if the texturing program has an algorithm that solves such problems, such as 3dcoat.
I don't know any perfect and exact viable solution to this problem based on algorithms like substance painter, foundry mari or 3dcoat, or even blender itself. The only viable solution for the cubic problem that I know and learned on my own it's the mirror effect occupying the same coordinates, rotating inversely proportional some angles of the UV coordinates, scaling the face of the uv or geometry by -1(mirror effect) so that it is inversely proportional to the adjacent face of the geometry:




I can't repeat the effect using quads, so I also have to divide the geometry in triangles occupying the same UV position in all of them, although the difference is in their mirror rotation (scaling the geometry to -1).
(Quad example:)

This way, since there are no known programs that do it automatically, it is more difficult to do everything manually while observing.