An image forming apparatus includes a cleaning apparatus, which
electrostatically removes toner remaining on the image bearing member
after a toner image formed on the image bearing member is transferred
onto a recording medium or the like; and a detecting device, which may be
an optical sensor, which detects the toner image on the image bearing
member. A detecting device adjuster adjusts at least a light quantity or
gain of the detecting device.