In order to achieve high-brillance and ultra-short FEL pulses, a flat current profile of the electron bunch is required. We achieve this by temporal shaping of the photo-cathode laser. From a femtosecond Gaussian pulse, we produce a picosecond long, flat-top laser pulse. At low charge, the photo-cathode laser pulse temporal profile is directly transferred into the electron bunch temporal profile. The SwissFEL photo-cathode gun laser uses the so-called pulse stacking technique: replicas of a single UV laser pulse are created by alpha-BBO crystals. The superposition of these gives the picosecond flat-top pulse. The quality of the flat top is very sensitive to the BBO crystals angles. In order to ensure uniformity, we developed an iterative optimization routine that allows direct optimization of the electron bunch temporal profile by changing the crystals angles. The routine feeds back on the streaked electron bunch temporal profile, while our algorithm adjusts the crystal angles until the desired flatness is reached.