Inpainting is a technique for dealing with gaps in time series data, as frequently occurs in asteroseismology data, that may generate spurious peaks in the power spectrum, thus limiting the analysis of the data. The inpainting method, based on a sparsity prior, judiciously fills in gaps in the data, preserving the asteroseismic signal as far as possible. This method can be applied both on ground and space-based data. The inpainting technique improves the oscillation modes detection and estimation, the impact of the observational window function is reduced, and the interpretation of the power spectrum is simplified. K-Inpainting can be used to study very long time series of many stars because its computation is very fast.