We present a general approach for optimizing the diffraction efficiency of a phase-type spatial light modulator (SLM). While the SLM displays a one-dimensional phase grating, the phase shift of one pixel in the grating is varied and the first-order diffraction efficiency is measured. This is repeated pixel-by-pixel to find the...