1. An image forming apparatus comprising: a control device for reading a predetermined image pattern formed on an image forming medium using an optical sensor and for controlling image forming conditions based on information on the predetermined image pattern thus read; and a setting device for setting an accumulation time of the optical sensor for reading the predetermined image pattern in accordance with a color, a density, or both a color and a density of the predetermined image pattern, wherein the setting of the accumulation time occurs prior to the optical sensor reading the predetermined image pattern, wherein the accumulation time is a duration of time between a timing of a read-start signal, which starts charge storage for reading the predetermined image pattern, and a timing of a read-stop signal, which completes charge storage for reading the predetermined image pattern, and wherein the setting device further is for setting different accumulation times for reading different predetermined image patterns.