Coherent shaping of photons using electromagnetically induced transparency