We report a technique for measuring and correcting the wavefront aberrations introduced by a biological sample using a Shack–Hartmann wavefront sensor, a fluorescent reference source, and a deformable mirror. The reference source and sample fluorescence are at different wavelengths to separate wavefront measurement and sample imaging. The measurement and correction at one wavelength improves the resolving power at a different wavelength, enabling the structure of the sample to be resolved.