When deforming a first image into a second image and generating a third image which contains the second image, coordinate values indicating a position of each of a plurality of grid points after deformation disposed in the second image are stored, and it is determined whether or not a pixel of interest in the third image locates in the second image, based on the stored coordinate values.