The proportional control based visual controller is the main method used in visual serving, but a small proportional gain results in a slow response, and a large proportional gain results in large overshoot or makes the system unstable. In order to improve the dynamic performance of visual servoing, a proportional differential (PD) visual controller in a microassembly system is proposed. In the proposed controller the proportional part makes the system respond faster and the differential part can improve the dynamic performance. The proportional and differential gains are tuned using a genetic algorithm to obtain optimal controller parameters. In this paper, affine transformation of the feature line is used to track the object. A series of experiments are performed on the peg and hole assembly to investigate the feasibility and effectiveness of this method.