Mass spectrometry imaging (MSI) data often consist of tens of thousands of mass spectra collected from a sample surface. During the time necessary to perform a single acquisition, it is likely that uncontrollable factors alter the validity of the initial mass calibration of the instrument, resulting in mass errors of magnitude significantly larger than their nominal values. This phenomenon has a two-fold detrimental effect: a) it reduces the ability to interpret the results based on the observed signals, b) it can affect the quality of the observed signal spatial distributions. Here, we present a post-acquisition computational method capable of reducing the observed mass drift in biological samples, exploiting the presence of typical molecules with a known mass-to-charge ratio. The method is tested on time-of-flight and Orbitrap mass spectrometry analyzers interfaced to a desorption electrospray ionization (DESI) source.