  This paper focuses on the ultimate limit theory of image compression. It
proves that for an image source, there exists a coding method with shapes that
can achieve the entropy rate under a certain condition where the shape-pixel
ratio in the encoder/decoder is $O({1 \over {\log t}})$. Based on the new
finding, an image coding framework with shapes is proposed and proved to be
asymptotically optimal for stationary and ergodic processes. Moreover, the
condition $O({1 \over {\log t}})$ of shape-pixel ratio in the encoder/decoder
has been confirmed in the image database MNIST, which illustrates the soft
compression with shape coding is a near-optimal scheme for lossless compression
of images.
