In this paper, a novel method for X-ray imaging system is proposed. The proposed algorithm automatically recognizes and removes the background from the X-ray images which caused by non-uniform illumination of X-ray source. By three major steps, the background can be removed without losing information of the desired region. In the first step, the pattern recognition is performed to determine the threshold of each square region of the X-ray image. Second, signal processing algorithm is applied to detect the edge of background and desired region. Third, adaptive parameter adjustments are used to finalize the background pixels and remove these pixels from the X-ray image. With this novel algorithm implemented in a picture archiving and communication system (PACS), the background of an X-ray image can be removed without losing any valid image information as shown in the simulation results.