A new image encoding scheme for simultaneous encryption and compression applications, which is based on random convolution and random subsampling, is proposed. In comparison with the existing joint optical encryption and compression schemes tailored for multiple images, the proposed scheme can process a single image and achieve a robust reconstruction. The scheme with the architecture of double random masks is somewhat similar to double random phase encoding. However, the latter has no compression capability and the proposed scheme remedies this defect.