An exponential contrast stretching (ECS) technique is developed to reduce the charging effects on scanning electron microscope images. Compared to some of the conventional histogram equalization methods, such as bi-histogram equalization and recursive mean-separate histogram equalization, the proposed ECS method yields better image compensation. Diode sample chips with insulating and conductive surfaces are used as test samples to evaluate the efficiency of the developed algorithm. The algorithm is implemented in software with a frame grabber card, forming the front-end video capture element.