Optical correction of image distortions