We propose and demonstrate a new photonic approach for triangular waveform generation. Based on an optical signal with sinusoidal envelope, an injection-locking process in a distributed-feedback semiconductor laser diode is employed to carry out the desired harmonic signal generation, and then the tailored signal is synthesized by the superimposition of these signals with proper power ratio and time delay. In this method, the conventional spectral line manipulating is transferred to individual signal envelope control, which reduces the technical requirement while the flexibility and accuracy is improved. In the experiment demonstration, triangular waveforms with the repetition frequencies of 9, 10, and 12 GHz are successfully generated. The results well agree with the theoretical predication and show great potential to realize arbitrary waveform generation.