We introduce a method to restore digital images with contaminated pixels. One particular characteristic of this method is that it does not change the pixels that are not considered contaminated, thus avoiding excessive intervening of the original image. Each pixel is analyzed by studying its eight point neighborhood. A cluster analysis is performed on the group of eight pixels contained in the neighborhood. After deciding how many clusters there are in the neighborhood, a decision is made whether the center pixel is an outlier or not. If so, to assign a new value, another decision is made, on a probabilistic basis, as to which cluster it belongs.This method can be applied to black and white images as well as to color and multiphase images.