A new method for removing impulse noises from images is proposed. The filtering scheme is based on replacing the central pixel value by the generalized mean value of all pixels inside a sliding window. The concepts of thresholding and complementation which are shown to improve the performance of the generalized mean filter are introduced. The threshold is derived using a statistical theory. The actual performance of the proposed filter is compared with that of file commonly used median filter by filtering noise corrupted real images. The hardware complexity of the two types of filters are also compared indicating the advantages of the generalized mean filter.