Patent ID: 8870336

Claim:
An image-forming device comprising: a recording means that forms an image on a medium; an optical sensor that outputs an output value in response to existence or non-existence of the medium; a first moving means that is relatively movable for the optical sensor and the medium by moving at least one of the optical sensor and the medium in a predetermined first direction; an edge part candidate detection means that performs an edge part candidate detection process to detect at a point immediately before output changes as an edge part candidate of the medium when more than one change point, which changes from a condition that the output of the optical sensor indicates an existence of the medium to a condition that the output of the optical sensor indicates a non-existence of the medium while the optical sensor and the medium are relatively moved by the first moving means, is detected, and the output of the optical sensor continuously indicates non-existence of the medium while the optical sensor and the medium relatively move for a predetermined moving amount from the detected change point along the first direction; and an edge part judgment means that performs an edge part judgment process to judge an edge part of the medium based on the detected edge candidate.