An effective method for removing heavy salt-and-pepper noise is proposed in this paper. This method includes three steps. In the first step, the noise pixels are distinguished from the signal pixels; then set initial values for noise pixels; finally, compute the output. The main difference from other switch-type filters is the means to change the values of the contaminated noise pixels. The proposed scheme is very effective, especially for heavily contaminated image. It can remove salt-and-pepper noise with a noise level as high as 95%, and it's relatively fast.