Maximizing Brightness in Photoinjectors