This paper presents a method for effective detection and removal of random valued impulse noise in digital images, focusing on median filtering with detail preservation. The proposed technique utilizes adaptive threshold filtering, which successfully identifies noisy pixels and replaces them to enhance image quality, particularly at high noise levels ranging from 50% to 90%. Results demonstrate that this method outperforms traditional filtering techniques in terms of peak signal-to-noise ratio (PSNR) and mean square error (MSE).