Growing reliance on digital communications has necessitated development of dependable and secure technologies to ensure that the transmission and reception of images over the Internet do not pose a risk to the data of individuals and governments. We propose developing a hybrid image encryption and compression algorithm by combining compressive sensing, the gray wolf algorithm, and multidimensional chaotic systems. It aims to generate a highly secure encrypted image while conserving transmission and storage resources. This algorithm overlaps several stages designed to protect vital images while minimizing size. First, the image is converted to the frequency domain using the discrete wavelet transform. Then, the discrete wavelet transform coefficients are scrambled globally using the Waleed-Ali Map and the gray wolf algorithm. Second, the confused image is measured by a parameters-controlled matrix to reduce transmission costs. The final encrypted image is obtained after performing the diffusion operation with a bitstream derived from the Nahrain chaotic map. The average peak signal-to-noise ratio score was 53.1995, and the average mean squared error score was 0.6130, demonstrating that the plaintext and decrypted images are identical. The average correlation coefficient score was −0.010095; the average entropy analysis was 7.9987; and the average number of pixel change rate and unified average changing intensity analyses were 99.60 and 33.52, respectively. The experimental results demonstrate the algorithm's efficiency and robustness, as well as the high quality of the reconstructed image.