The shapelets method for image analysis is based around the decomposition of localised objects into an orthonormal basis set with particularly convenient mathematical properties. It provides a compact representation of typical galaxy shapes, and an intuitive physical interpretation of components with different rotational symmetries. Psf deconvolution can be performed analytically. Shapelets has been applied to Hubble Space Telescope images from the COSMOS survey in order to quantitatively classify galaxy morphologies, and to measure the distortions induced in these galaxy shapes by weak gravitational lensing. The images of distant galaxies are "lensed" and sheared if their light passes near foreground mass concentrations on the way to a telescope. The observed distortion field therefore maps out the large-scale distribution of mass in the nearby universe, including contributions from dark matter and other components that can not be seen directly.