After aluminum plate is welded, X-ray can be used to detect the internal defects of weld. Due to the problems of noise, low contrast, fuzzy edge of weld area and uneven brightness distribution in X-ray image, the effect of traditional edge detection method is not good. Therefore, this paper proposes a method to automatically extract weld area and improve its contrast. Through the steps of denoising, edge detection and morphology operation, the weld area position is finally determined, and the pixel value in the weld area is linearly transformed to improve the contrast of the weld area. The experimental results show that this method can automatically improve the contrast of weld area for a large number of aluminum plate X-ray images, and has good robustness and accuracy.