Long time ago opit had pieced together a Python script that inpainted holes in arrays, based on Davide Lasagna’s code.

Someone working in Antarctic ice research found it useful despite its bad shape, so she cleaned it up, put it on Github and added an example. Slow and might be optimised, but perfect is the biggest enemy of finished, and so on. You’ll have to play around with the kernel size/type, standard deviation, tolerance, iterations number, etc. to fit your particular goal.

Here’s an Gaussian image with a few pixels masked off:

The array healed using a local mean, i.e. a sort of a moving averaging window:

Same with a Gaussian kernel: