A non-transitory computer-readable storage medium storing a program which, when read and executed by a computer, causes the computer to execute the steps of a method of controlling an image processing apparatus that is to be connected to a printing apparatus, that sequentially receives a plurality of recording media on which printing was performed by the printing apparatus, and that inspects a quality of images formed on the recording media, the method comprising:
- (a) receiving a reference image;
- (b) acquiring a plurality of scanned images by sequentially scanning the recording media output from the printing apparatus and having the images to be inspected recorded thereon;
- (c) receiving phase information of an image bearing member of the printing apparatus;
- (d) for each of the scanned images, detecting a defect on the scanned image by comparing a pixel value of the reference image and a pixel value of the scanned image;
- and
- (e) determining whether a defect has reproducibility based on positions of defects on the recording media calculated from the phase information.