A New algorithm for the restoration of gray scale and color images are highly corrupted by impulse noise (salt and pepper noise) is proposed in this paper. This proposed algorithm shows better results than the Standard Median Filter (SMF), Decision Based Median Filter (DBMF), Modified Decision Based Median Filter (MDBMF), Progressive Switched Median Filter (PSMF) and Modified Decision Based Unsymmetrical Trimmed Median Filter (MDBUTMF). The proposed algorithm replaces the noisy pixel by trimmed median value when other pixel values, 0's and 255's are present in the selected window and when all the pixel values are 0's and 255's then the noise pixel is replaced by increasing window size and finding trimmed mean based on algorithm. Different grayscale and color images are tested by using the proposed algorithm and found to produce better Peak Signal to Noise Ratio (PSNR) and Image Enhancement Factor (IEF). © 2005 - 2013 JATIT & LLS.