An image processing device for selecting an image, among a plurality of images, the image processing device comprising: a photographic subject detection unit configured to detect at least one predetermined photographic subject (61, 65) from each image in the plurality of images and to identify a photographic subject region (62, 66) that is a region on each image, the region including the detected predetermined photographic subject (61, 65); a background region identifying part configured to identify a background region (63, 67) that is a region on each image, the region being other than the photographic subject region (62, 66) identified by the photographic subject region identifying part; a sharpness identifying part configured to identify sharpness of the photographic subject region (62, 66) and sharpness of the background region (63, 67); a score calculation part configured to calculate a score, based on a difference between the sharpness of the photographic subject region (62, 66) and the sharpness of the background region (63, 67); and a determination part configured to determine each image as an optimum image, in which sharpness of the photographic subject region (62, 66) is relatively high compared with the sharpness of the background region (63, 67), when the score calculated by the score calculation part is larger than an optimum image threshold, characterised in that the score calculation part is configured to calculate the score by multiplying a weighting factor and a difference between the sharpness of the photographic subject region (62, 66) and the sharpness of the background region (63, 67), wherein the weighting factor is a value such that the value increases as the sharpness of the photographic subject region (62, 66) increases or as the sharpness of the background subject region (63, 67) decreases, the score calculation part is configured to calculate the score for each image of the plurality of images, and the determination part is configured to perform ranking of the plurality of images based on the score of each image of the plurality of images. a photographic subject detection unit configured to detect at least one predetermined photographic subject (61, 65) from each image in the plurality of images and to identify a photographic subject region (62, 66) that is a region on each image, the region including the detected predetermined photographic subject (61, 65); a background region identifying part configured to identify a background region (63, 67) that is a region on each image, the region being other than the photographic subject region (62, 66) identified by the photographic subject region identifying part; a sharpness identifying part configured to identify sharpness of the photographic subject region (62, 66) and sharpness of the background region (63, 67); a score calculation part configured to calculate a score, based on a difference between the sharpness of the photographic subject region (62, 66) and the sharpness of the background region (63, 67); and a determination part configured to determine each image as an optimum image, in which sharpness of the photographic subject region (62, 66) is relatively high compared with the sharpness of the background region (63, 67), when the score calculated by the score calculation part is larger than an optimum image threshold, characterised in that the score calculation part is configured to calculate the score by multiplying a weighting factor and a difference between the sharpness of the photographic subject region (62, 66) and the sharpness of the background region (63, 67), wherein the weighting factor is a value such that the value increases as the sharpness of the photographic subject region (62, 66) increases or as the sharpness of the background subject region (63, 67) decreases, the score calculation part is configured to calculate the score for each image of the plurality of images, and the determination part is configured to perform ranking of the plurality of images based on the score of each image of the plurality of images.