This paper presents algorithm ingenerating trajectory for sealant process using captured image. Cartesian robot as auto-sealant in manufacturing process has increased productivity, reduces human error and saves time. But, different sealant path in many engine models means not only different trajectory but also different program. Therefore robot with detection ability to generate its own trajectory is needed. This paper describes best lighting technique in capturing image and applies edge detection in trajectory generation as the solution. The algorithm comprises image capturing, Canny edge detection, integral projection in localizing outer most edge, scanning coordinates, and generating vector direction codes. The experiment results show that the best technique is diffuse lighting at 10 Cd. The developed method gives connected point to point trajectory which forms sealant path with a point to next point distance is equal to 90° motor rotation. Directional movement for point to point trajectory is controlled by generated codes which are ready to be sent by serial communication to robot controller as instruction for motors which actuate axes X and Y directions.