In a sky shot, when a closing and opening detection unit detects the opening of a document cover, contour detecting means detects as a probable edge point a pixel thought to be a document edge point, a contour correction unit determines whether the probable edge point is a document edge or not, and an image forming unit forms image data of a document on the basis of the document edge point.