A non-transitory computer-readable recording medium, storing a plurality of executable codes, after an electronic device reads the executable codes and executes, when there is a human being identified in an initial image by artificial intelligence, cropping to the initial image from a first aspect ratio is executed to crop a cropped final image that meets a second aspect ratio, comprising the following steps:
- calculating a human body coverage area:
- identifying coordinates of the human being in the initial image to define a human body coverage area, and defining a center point of the human body coverage area as a first focal coordinate;
- calculating a cropping ratio:
- using the first focal coordinate as a center point to define a cropping frame, the cropping frame has the second aspect ratio, and the cropping frame corresponds to the human body coverage area and is enlarged according to a ratio parameter;
- calculating a face coverage area:
- identifying coordinates of a face of the human being in the initial image to define a facial coverage area, and defining a second focal coordinate of a center point of the facial coverage area;
- and
- alignment and cropping:
- defining a center point of the cropping frame as a third focal coordinate, moving the center point of the cropping frame from the third focal coordinate to coincide with the second focal coordinate, and when it is judged that the cropping frame is covered within the initial image, an image of the cropping frame is selected as the cropped final image.