1. An image processing apparatus comprising: at least one processor configured to implement: a color-information extracting unit that extracts color information from an electronic document; a compression setting unit that determines a color value that most frequently appears in the electronic document, determines color values that most frequently appear in the electronic document based on the color value, determines a proportion of the color values that most frequently appear in the electronic document to all color values that appear in the electronic document, determines whether the proportion exceeds a threshold, and sets: a first compression format in which a number of colors contained in the electronic document is reduced to a predetermined number of colors, in response to determining that the proportion exceeds the threshold, and a second compression format in which the number of colors in the electronic document is reduced to greater than the predetermined number of colors used in the first compression format, in response to determining that the proportion is equal to or smaller than the threshold.