We present a non standard approach for image inpainting, based on the crack localization problem. It can be solved using the Dirichlet to Neumann approach and the topological gradient. In a similar way, we can define a Dirichlet and a Neumann inpainting problem. Then we define a cost function measuring the discrepancy between the two corresponding solutions. The minimization is done using the topological asymptotic analysis, and is most of the time performed in only one iteration. The optimal solution provides the best localization of the missing edges,
and it is then possible to quickly inpaint the holes. Thanks to appropriate preconditioning, this can be done in real time.