Ramanujan sums (RS) have been found to be very successful in signal processing recently. However, as far as we know, the RS have not been applied to image analysis. In this paper, we propose two novel algorithms for image analysis, including moment invariants and pattern recognition. Our algorithms are invariant to the translation, rotation and scaling of the 2D shapes. The RS are robust to Gaussian white noise and occlusion as well. Our algorithms compare favourably to the dual-tree complex wavelet (DTCWT) moments and the Zernike’s moments in terms of correct classification rates for three well-known shape datasets.