The extremum and median filter can not only preserve the details of image as much as possible but also remove the noise when the grayscale changed gently. But, it''''s not very effective when processing those images including extremum areas. A new algorithm is presented in this paper and it solves the problem existing in former filter. The experimental results show that the method is quite effective on most images and has better performance.