The quick advancement of multimedia technology has led to the widespread utilization of digital images across various industries. Meanwhile, image security has become an urgent issue in need of resolution. To guarantee image security as well fulfill the requirements of real-time image cryptosystems, a novel image encryption algorithm is proposed based on the designed improved iterative chaotic map with infinite collapses (ICMIC), Gray code and semi-pixel level permutation and diffusion. Firstly, two chaotic sequences are produced using the improved ICMIC and then they are used to perform scrambling and diffusion operations. Secondly, the plain image is encoded using Gray code and then we convert each Gray code into two semi-pixels. Thirdly, the designed semipixel
level permutation is used to scramble the semi-pixel vector. Finally, the scrambled semi-pixel vector is diffused using the designed dynamic semi-pixel level diffusion. The performance analyses illustrate that the proposed algorithm possesses robust security and high efficiency, making it ideally suited for application in real-time image cryptosystems.