A new method for smoothing images by local weighted averaging is presented. The weights are computed as strengths of links between neighbors. These link strengths are averages of the variations in gray level over paths of length 2. It is shown that the method preserves edges, thin lines, and average gray levels. Moreover, it transforms the images into slowly varying regions with sharp borders, having histograms that tend to be composed of sharp peaks.