An image forming apparatus comprising: a print engine portion that performs printing on a sheet; a pyroelectric sensor; a signal generation portion that receives an output of the pyroelectric sensor to generate a different level of signal according to whether or not an output value of the pyroelectric sensor exceeds a predetermined threshold value; a recognition portion that receives the signal generated by the signal generation portion, that determines a measurement value on a speed of change of the signal, that recognizes to which of a predetermined first range and a predetermined second range different from the first range the determined measurement value belongs, and recognizes a number of times the signal has changed or a pattern of change of the signal and recognizes, either by whether or not the signal has changed a predetermined number of times or by whether or not the change of the signal is a predetermined pattern of change, whether or not a gesture indicating that power supply to the print engine portion is not restarted is performed; and a power supply portion in which, when the determined measurement value falls within the first range in a mode other than a power-saving mode, power is supplied to only part of the image forming apparatus, and the image forming apparatus is brought into the power-saving mode, and, in a case when the determined measurement value falls within the second range in the power-saving mode, when the gesture indicating that the power supply to the print engine portion is not restarted is performed, with the power supply to the print engine portion remaining stopped, the power-saving mode is cancelled whereas when the gesture indicating that the power supply to the print engine portion is not restarted is not performed, the power supply to the print engine portion is restarted and the power-saving mode is cancelled. a print engine portion that performs printing on a sheet; a pyroelectric sensor; a signal generation portion that receives an output of the pyroelectric sensor to generate a different level of signal according to whether or not an output value of the pyroelectric sensor exceeds a predetermined threshold value; a recognition portion that receives the signal generated by the signal generation portion, that determines a measurement value on a speed of change of the signal, that recognizes to which of a predetermined first range and a predetermined second range different from the first range the determined measurement value belongs, and recognizes a number of times the signal has changed or a pattern of change of the signal and recognizes, either by whether or not the signal has changed a predetermined number of times or by whether or not the change of the signal is a predetermined pattern of change, whether or not a gesture indicating that power supply to the print engine portion is not restarted is performed; and a power supply portion in which, when the determined measurement value falls within the first range in a mode other than a power-saving mode, power is supplied to only part of the image forming apparatus, and the image forming apparatus is brought into the power-saving mode, and, in a case when the determined measurement value falls within the second range in the power-saving mode, when the gesture indicating that the power supply to the print engine portion is not restarted is performed, with the power supply to the print engine portion remaining stopped, the power-saving mode is cancelled whereas when the gesture indicating that the power supply to the print engine portion is not restarted is not performed, the power supply to the print engine portion is restarted and the power-saving mode is cancelled.