To automate present Automatic Optical Inspection (AOI) systems, an intelligent method based on lightness analysis for solder joints detection is proposed in this paper. Firstly, the image taken from real printed circuit board (PCB) is preprocessed and segmented. Then, we compute the image similarity by calculating the Euclidean distance. If the similarity exceeds the threshold, we extract the lightness of solder joints by converting between RGB color mode and HLS color mode. Lastly, all the defects of solder joints are classified into several different types according to their lightness appearances. Experiment results show that the method deduced in this paper can detect accurately solder defects from different patches.