Microscopic imaging of uneven surfaces is difficult because of the limited depth of field. In this study, we developed a rapid auto‐focus method for uneven surfaces based on image fusion. The Prewitt operator was used to detect the vertical edges of the images. Then, the focus position was theoretically calculated using a Gaussian function, and image fusion was applied to obtain the final in‐focus image. An experiment was designed to verify the developed method. The results revealed that this method is effective for printed circuit boards.