Most of the image encryption algorithms are the private-key cryptosystem, in which the encryption process and the decryption process employ the same keys. To enhance the security of image encryption system, an optical image compression and encryption scheme based on compressive sensing and RSA public-key cryptographic algorithm is proposed, where the optical compressive imaging system is utilized to sample the original image. In the encryption process, the Walsh-Hadamard transform and a measurement matrix are adopted to simulate the optical compressive imaging system to measure the original image, which can effectively reduce the redundant information in the original image. Then the pixel positions of the resulting image are scrambled with pseudorandom sequence generated by one-dimensional (1D) cascade chaotic system. Furthermore, deoxyribonucleic acid (DNA) sequence operations are exploited to change the pixel values. The keys used in the scheme are generated based on the original image and are protected by the RSA algorithm. Experimental results demonstrate the effectiveness and reliability of the proposed optical image compression and encryption scheme with considerable compression and security performance.