1. An image forming apparatus comprising: an image forming unit that forms a pattern image for image quality adjustment on an image carrier; a detection unit that detects the pattern image for the image quality adjustment; an image quality adjustment control unit that controls an image quality adjustment process in accordance with a result of detection of the detection unit; a reception unit that receives a color mode selected from among a plurality of kinds of color modes whose number of colors used for forming an image is different; and a calculation unit that calculates a total pattern length so that a total length of the pattern image for the image quality adjustment in a sub-scanning direction is equal in any of the color modes, wherein the image forming unit forms the pattern image for the image quality adjustment so that the total length of the pattern image for the image quality adjustment is equal to the calculated total pattern length.