1. An image forming apparatus comprising: a plurality of nozzle row groups including a first nozzle row group and a second nozzle row group, wherein: the first nozzle row group is positioned shifted to one side in a predetermined direction with respect to the second nozzle row group, each nozzle row group includes a plurality of nozzle rows extending in an intersecting direction that intersects the predetermined direction, a plurality of nozzles ejecting ink are lined up in the predetermined direction in each of the nozzle rows, wherein the plurality of nozzles in each of the nozzle rows communicate with a common ink chamber; and a control unit repeatedly performing: an ejection operation ejecting the ink from the nozzles while relatively moving the plurality of nozzle row groups and a medium in the intersecting direction, and a transport operation moving a relative position of the medium with respect to the plurality of nozzle row groups to one side in the predetermined direction, wherein the image forming apparatus is provided with: a first mode, in which: ink forming a main image is filled into the common ink chamber communicating with the plurality of nozzles belonging to a first nozzle row in the first nozzle row group, ink forming a background image of the main image is filled into the common ink chamber communicating with the plurality of nozzles belonging to a second nozzle row in the second nozzle row group, and the first nozzle row group and the second nozzle row group are used to form the background image before the main image with respect to a predetermined region of the medium, and a second mode, in which: ink forming the background image is filled into the common ink chamber communicating with the plurality of nozzles belonging to the first nozzle row, ink forming the main image is filled into the common ink chamber communicating with the plurality of nozzles belonging to the second nozzle row, and the first nozzle row group and the second nozzle row group are used to form the main image before the background image with respect to a predetermined region of the medium.