1. An image processing apparatus that extracts foreground pixels of a foreground image from input image data, comprising: a classifying section that divides an image area related to the input image data into a plurality of image areas, and classifies the plurality of image areas into uniform density areas and variable density areas that are areas other than the uniform density areas, in each of the uniform density areas the difference between pixel values of pixels included therein being less than a predetermined value; a continuous variable density area extraction section that extracts a plurality of adjacent variable density areas of the variable density areas classified by said classifying section as continuous variable density areas; a color information calculation section that calculates color information of the variable density areas; and a foreground pixel extraction section that extracts foreground pixels for each of the continuous variable density areas extracted by said variable density area extraction section according to the color information calculated by said color information calculation section.