1. An image processing apparatus that generates a halftone image of an input image by performing quantization, comprising: a holding unit configured to hold a threshold value matrix in which different threshold values are arranged; a pixel position determination unit configured to determine a candidate of a pixel position whose threshold value is to be rewritten based on each pixel value of a plurality of pixels included in a predetermined area for the predetermined area in the input image; and a threshold value determination unit configured to determine a threshold value of the pixel position determined to be the candidate by using at least one threshold value of a plurality of threshold values corresponding to the predetermined area.