An image compression divides an input image into blocks having the
predetermined number of horizontal and longitudinal pixels, and scans the
divided blocks in a main scan direction and a sub scan direction so as to
select them in order as a processing block, and selects as a reference
block a block in which positional relation with the selected block and a
relation of a pixel value satisfies a predetermined condition.
Subsequently, the pixel values of the processing block and the reference
block are subjected to an exclusive-OR (XOR) so as to generate a
differential image, and in case the differential image satisfies the
predetermined condition, the processing block is replaced with the
differential image. Further, the image including the differential image
obtained by executing the block replacement in the processing block is
encoded, and the code data obtained by executing this image encoding, the
presence or absence of replacement with the differential image of each
processing block obtained by executing the block replacement, and
positional information of the reference block are combined and outputted.
The image decoding is executed in such way that the image including the
differential image from the code data is decoded, and this decoded image
is decoded into the original image by an exclusive-OR with the processing
block which is divided into blocks and the reference block.