Shaping Single Photons