1. An image processing apparatus having first compression means for performing lossless compression on image data, which is suitable to one kind or image, and second compression means for performing lossy compression on image data, which is suitable to a different kind of image, comprising: allocation means for adaptively allocating a target code amount of object image data to be coded in accordance with a code amount of other image data that has been coded; estimating means for estimating a code amount of compressed object image data when the object image data is compressed by said first compression means; and selection means for selecting either one of outputs of said first and second compression means as compressed data of the object image data so that a code amount of the compressed data is less than the target code amount, in accordance with the estimated code amount by said estimation means, wherein said selection means preferentially selects the output of said first compression means over the output of said second compression means, the compression performed by said first and second compression means maintains a resolution of the object image data, and when the lossy compression and an expansion have been performed on image data, the one kind of image has a characteristic that deterioration of image quality is conspicuous, and the different kind of image has a characteristic that the deterioration of image quality is not conspicuous.