1. An image processing apparatus comprising: an extractor, arranged to extract DC components of an image; a calculator arranged to calculate code amounts of encoded data generated upon encoding the image; a generator, arranged to generate a histogram of the DC components extracted by said extractor; and a detector, arranged to detect a background level of the image based on the histogram, wherein said generator generates said histogram of DC components from DC components which have corresponding code amounts calculated by said calculator not more than a predetermined amount.