By suitably phase-encoding optical images in the pupil plane and then digitally restoring them, one can greatly improve their quality. The use of a cubic phase mask originated by Dowski and Cathey to enhance the depth of focus in the images of 3-d scenes is a classic example of this powerful approach. By using the Strehl ratio as a measure of image quality, we propose tailoring the pupil phase profile by minimizing the sensitivity of the quality of the phase-encoded image of a point source to both its lateral and longitudinal coordinates. Our approach ensures that the encoded image will be formed under a nearly shift-invariant imaging condition, which can then be digitally restored to a high overall quality nearly free from the aberrations and limited depth of focus of a traditional imaging system. We also introduce an alternative measure of sensitivity that is based on the concept of Fisher information. In order to demonstrate the validity of our general approach, we present results of computer simulations that include the limitations imposed by detector noise.© (2003) COPYRIGHT SPIE--The International Society for Optical Engineering. Downloading of the abstract is permitted for personal use only.