1. An image processing apparatus that generates recording data in which, in each of a plurality of relative scanning operations, which are performed, by a recording head including a discharge port column in which discharge ports for discharging ink are arranged in a certain direction, in a unit area of a recording medium in a direction perpendicular to the certain direction, whether or not to discharge ink from each of a plurality of discharge port groups, which are obtained by dividing the discharge port column in the certain direction, is specified for each of pixel areas in the unit area corresponding to pixels, the image processing apparatus comprising: a first obtaining unit configured to obtain information regarding a plurality of density values in an image recorded by each of the plurality of discharge port groups; a second obtaining unit configured to obtain image data corresponding to an image recorded in the unit area; a third obtaining unit configured to obtain information regarding an attribute of the image recorded in the unit area; a selection unit configured to select one of a plurality of mask pattern groups, each including a plurality of mask patterns corresponding to the plurality of scanning operations, on the basis of the attribute of the image indicated by the information obtained by the third obtaining unit; a fourth obtaining unit configured to obtain information regarding a plurality of contribution ratios of each of the plurality of discharge port groups on the basis of the mask pattern group selected by the selection unit, the plurality of contribution ratios being ratios of contribution of each of the plurality of discharge port groups to the recording in the unit area; a first generation unit configured to generate a correction value for correcting the image data on the basis of the plurality of density values indicated by the information obtained by the first obtaining unit and the plurality of contribution ratios indicated by the information obtained by the fourth obtaining unit; a second generation unit configured to generate corrected data corresponding to the image recorded in the unit area on the basis of the image data obtained by the second obtaining unit and the correction value generated by the first generation unit; a third generation unit configured to generate quantized data corresponding to the image recorded in the unit area by quantizing the corrected data generated by the second generation unit; and a fourth generation unit configured to generate the recording data on the basis of the quantized data generated by the third generation unit and the mask pattern group selected by the selection unit.