For extending the depth of field, we analyze the result of superimposing several snapshots, which are taken while changing the amount of focus error, at full pupil aperture. We unveil the use of a varifocal lens for controlling the amount of focus error, without modifying either the lateral magnification or light throughput. After recording a set of snapshots, we use suitable acquisition factors for shaping an optical transfer function, which has reduced sensitivity to focus errors.