An image forming apparatus, comprising: a conveying mechanism comprising a conveying roller configured to convey a recording medium; a printing unit configured to perform printing on the recording medium; an origin detection unit provided on the conveying mechanism; an image capturing unit configured to capture an image of the recording medium; a movement-amount calculation unit configured to: calculate movement amounts of the recording medium based on correlations between captured images of the recording medium captured at different times with the image capturing unit; and perform accumulation processing on the movement amounts of the recording medium to calculate a cumulative movement amount; a correction unit configured to: perform correction for causing the cumulative movement amount to coincide with a reference movement amount of the recording medium for a predetermined cycle obtained from an integer multiple of a circumference of the conveying roller, for each predetermined cycle of the conveying mechanism detected by the origin detection unit; and a control unit (110F30) configured to: control the conveying mechanism, based on a corrected value of the cumulative movement amount obtained by the correction of the correction unit, to perform conveyance control of the recording medium; and control the printing unit to perform printing on the recording medium that is conveyed under the conveyance control. a conveying mechanism comprising a conveying roller configured to convey a recording medium; a printing unit configured to perform printing on the recording medium; an origin detection unit provided on the conveying mechanism; an image capturing unit configured to capture an image of the recording medium; a movement-amount calculation unit configured to: calculate movement amounts of the recording medium based on correlations between captured images of the recording medium captured at different times with the image capturing unit; and perform accumulation processing on the movement amounts of the recording medium to calculate a cumulative movement amount; calculate movement amounts of the recording medium based on correlations between captured images of the recording medium captured at different times with the image capturing unit; and perform accumulation processing on the movement amounts of the recording medium to calculate a cumulative movement amount; a correction unit configured to: perform correction for causing the cumulative movement amount to coincide with a reference movement amount of the recording medium for a predetermined cycle obtained from an integer multiple of a circumference of the conveying roller, for each predetermined cycle of the conveying mechanism detected by the origin detection unit; and perform correction for causing the cumulative movement amount to coincide with a reference movement amount of the recording medium for a predetermined cycle obtained from an integer multiple of a circumference of the conveying roller, for each predetermined cycle of the conveying mechanism detected by the origin detection unit; and a control unit (110F30) configured to: control the conveying mechanism, based on a corrected value of the cumulative movement amount obtained by the correction of the correction unit, to perform conveyance control of the recording medium; and control the printing unit to perform printing on the recording medium that is conveyed under the conveyance control. control the conveying mechanism, based on a corrected value of the cumulative movement amount obtained by the correction of the correction unit, to perform conveyance control of the recording medium; and control the printing unit to perform printing on the recording medium that is conveyed under the conveyance control.