A novel template design algorithm is presented for lossless compression of color halftone images. First, we extract the
line pattern in the neighbor local region of each bi-level pixel. Then, the representative line pattern is evaluated from
these obtained lines, using the least square error minimization. According to the evaluated line pattern and two design
constraints, therefore, the context template is shaped. With the designed template, finally, each color channel image is
compressed by a context-based binary arithmetic encoder. Based on the adaptiveness of the template to the input image,
the proposed templates yield better compression performance than the conventional JBIG templates, which saves 35% of
the JBIG bitstream.