Beam driven wakefield acceleration is one of the most advanced novel accelerator concepts. This process occurs in a plasma or a slow-wave structure in which the drive beam deposits energy in the form of a wake and the main beam is accelerated by this wake. For efficient acceleration, it is important to shape the drive beam current and to increase the so-called transformer ratio: the energy gain by the main beam to the energy loss of the drive beam. Triangular bunch shapes are among the most promising distributions considered for increasing the transformer ratio. In most cases, the drive beam is shaped with the help of electron beam phase space manipulation along with removal of portions of the beam with a scraper. This type of shaping is complicated by itself, causing charge loss and thermal heating, but also leads to beam instabilities due to the altered phase space of the beam. In this paper, we demonstrate experimentally the shaping of picosecond laser pulses in the form of a triangle with the help of a spatial light modulator. Such laser pulses can be used to generate a triangular electron bunch from a photoinjector. Considerations on the required pulse profile, comparison to other shaping methods, experimental results, and numerical analysis of the impact of pulse shaper parameters on the reproducibility of the triangular laser pulse shape are presented.