From inputted multilevel image data it is generated, for each pixel, image
area information constituted by an image area component indicating
whether the pixel exists in a character.cndot.line drawing area or
halftone area and an image area component indicating whether the pixel is
chromatic or achromatic. The information is encoded by a lossless
encoding unit on a block basis and stored, and an amount of code is
monitored. When the amount of code exceeds a target amount, the lossless
encoding unit performs encoding upon changing image area components, of
subsequently input image area components, which coincide with a
condition. The codes that have already been stored are temporarily
decoded by a lossless code re-encoding unit, and the above image area
components are changed. The resultant data is then re-encoded and stored.