An image processing apparatus successively counts numbers of continuous
blocks starting from a left end in view of a number of color(s) forming
each block and the color of a preceding block. In this counting, when a
first block formed of two colors is input, then second block formed of
one of the two colors of the first block is input and then blocks formed
of the same one color as the second block are continuously input (second
to fourth), the image processing apparatus handles the second to fourth
blocks as one-color blocks continuing after the two-color block, and
encodes the first to fourth blocks into a code indicating identification
information to the effect, a continuation number of the two-color block,
color information of each color, information specifying the color of the
one-color block being one of the two colors, and the continuation number
of the one-color blocks.