A chain code is a lossless compression algorithm for monochrome images. The basic principle of chain codes is to separately encode each connected component, or 'blob', in the image. A chain code is a lossless compression algorithm for monochrome images. The basic principle of chain codes is to separately encode each connected component, or 'blob', in the image.