In this paper, we propose an image compression-encryption method based on two-dimensional (2D) sparse representation and chaotic system. In the first step of this method, the input image is extended in a transform domain to obtain a sparse representation. To achieve better performance of image compression by 2D sparse recovery, the sparse representation is scrambled via a chaotic confusion. This step helps the satisfaction of the uniqueness conditions for sparse recovery, and the security level of encryption is increased. Then, two orthogonal measurement matrices are generated using the chaotic time series. The singular value decomposition is used to compress the sparse scrambled representation in two dimensions. Finally, to reduce the correlation between adjacent pixels in the compressed matrix, and obtain a uniform distribution in the encrypted image, a compressed scrambling matrix based on chaotic confusion is used. Then, XOR operation is applied for final encryption. In the decryption process, to improve the compression efficiency, the total variation constraint is added to the 2D sparse recovery problem based on the smoothed norm. The simulation results demonstrate the satisfying performance of the proposed method for different compression ratios. Security analysis describes the effectiveness of the proposed encryption approach.