An image processing apparatus includes a wavelet transformation unit for
wavelet-transforming input image data on a per-image basis, and an encoder
for changing transformation coefficients, which have been obtained by the
transformation, to bit planes from higher- to lower-order bits, and
encoding the bit planes one bit plane at a time. A code-quantity
prediction unit determines whether all encoded data of each of the image
data that have been encoded can be stored in the memory when the encoded
data obtained by the encoder is stored in the memory image by image. If
all of the encoded data cannot be stored, the encoded data that overflows
the memory is divided and the divided encoded data is stored in the memory
by writing the divided encoded data equally over storage areas of the
lower-order bit planes of each of the image.