
I was also looking for a solution while colorizing some line art and created a small test app. Initially, I also thought of the GIMP/colorize mask approach that uses edge detection/watershed to segment the image after I found the link (https://girinstud.io/news/2019/02/smart-colorization-in-gimp/) that @raghukamath posted above.
But then I thought of another solution: 2D Raytracing. It uses Bresenham’s line algorithm for line art detection and the gap is detected by comparing and limiting the ray length of adjacent rays.
I wrote a small app in the same Framwork as Krita (Qt) and C++.
It can even fill multiple gaps but still needs a few optimizations for e.g. non-trivial-shapes.
