An image processing apparatus adapted to detect a unique portion extending in a predetermined direction in an image printed from input image data having pixels arranged in a first direction and a second direction intersecting with the first direction, wherein the unique portion is a stripe defect in the printed image, and the predetermined direction along which the unique portion extends is a direction corresponding to the first direction, the image processing apparatus comprising: a generating means (S3) configured to generate inspection target image data from a difference between the input image data and read image data resulting from reading (S2) the printed image; a setting means (S4) configured to set inspection target areas in the inspection target image data, wherein the setting means obtains (S405) the number of edge pixels corresponding to edge portions of the input image data for each of the multiple inspection candidate areas obtained by dividing an image area corresponding to the input image data into multiple inspection candidate areas in the first direction and the second direction, respectively, and sets (S406), as the inspection target areas, areas in the inspection target image data corresponding to inspection candidate areas in the input image data where the number of edge pixels is smallest among inspection candidate areas in the first direction; and an extracting means (S6) configured to perform an image processing for extracting the unique portion from the inspection target areas set by the setting means, wherein the setting means sets the inspection target areas so as to make coordinates of the inspection target areas at which the inspection target areas are arranged with respect to an entire image area of the inspection target image data mutually different in the second direction, and so as to make a ratio of an area occupied by the inspection target areas to the entire image area of the inspection target image data in the first direction less than 100% and a ratio of an area occupied by the inspection target areas to the entire image area of the inspection target image data in the second direction equal to 100%. a generating means (S3) configured to generate inspection target image data from a difference between the input image data and read image data resulting from reading (S2) the printed image; a setting means (S4) configured to set inspection target areas in the inspection target image data, wherein the setting means obtains (S405) the number of edge pixels corresponding to edge portions of the input image data for each of the multiple inspection candidate areas obtained by dividing an image area corresponding to the input image data into multiple inspection candidate areas in the first direction and the second direction, respectively, and sets (S406), as the inspection target areas, areas in the inspection target image data corresponding to inspection candidate areas in the input image data where the number of edge pixels is smallest among inspection candidate areas in the first direction; and an extracting means (S6) configured to perform an image processing for extracting the unique portion from the inspection target areas set by the setting means, wherein the setting means sets the inspection target areas so as to make coordinates of the inspection target areas at which the inspection target areas are arranged with respect to an entire image area of the inspection target image data mutually different in the second direction, and so as to make a ratio of an area occupied by the inspection target areas to the entire image area of the inspection target image data in the first direction less than 100% and a ratio of an area occupied by the inspection target areas to the entire image area of the inspection target image data in the second direction equal to 100%. <EOS>