We propose a patch-based image compression framework inspired by the inpainting techniques. The repeated patterns in one image are exploited for compression in a non-parametric manner, i.e., directly sampling image patches and encoding the similarity between them. We show how this idea leads to an assisted inpainting method, and how the inpainting method can be integrated into a patch-based image compression framework in a rate–distortion (R–D) optimal fashion. Two specific techniques – assisted inpainting for decoding, and R–D optimization for encoding by mode selection or image analysis – are presented in this paper. Experimental results show that compared with standard H.264 intra coding, our system (1) achieves up to 0.85 dB gain when optimized for objective quality and (2) saves as much as 25% bit-rate at similar subjective quality levels.