We propose an optical image encryption algorithm based on Arnold transform and gyrator transform. The amplitude and phase, which are the outputs of gyrator transform, are separated into several sub-images. Arnold transform is introduced for scrambling the data of the sub-images. The random spectrum composed of the scrambled sub-images is transformed by gyrator transform. An iterative structure of the algorithm is designed for enhancing the security of the encryption algorithm. The parameters of gyrator transforms and separating scheme serve as the key of the encryption method. The encryption process can be implemented by an electro-optical setup. Some numerical simulations have been given to demonstrate the security and validity of this algorithm.