We propose an image encryption algorithm by using random position scrambling of the amplitude and phase functions in the frequency domain of optical transform. The positions of amplitude and phase data are scrambled randomly in the horizontal or vertical direction. The random position orders can be regarded as the key of the algorithm. Moreover, random phase encoding is not used in the proposed algorithm. A feasible optical implementation of the encryption algorithm is given. Some numerical simulations have demonstrated the capability of the algorithm.