An image forming apparatus, comprising: an image bearing member to bear a toner image on a surface thereof; a transfer member disposed opposite the image bearing member to contact the surface of the image bearing member to form a transfer nip; a power source to output a voltage to transfer the toner image from the image bearing member onto a recording medium interposed in the transfer nip, the voltage including a first voltage in a transfer direction in which the toner image is transferred from the image bearing member to the recording medium and a second voltage having a polarity opposite that of the first voltage, and the first voltage and the second voltage alternating upon transfer of the toner image from the image bearing member to the recording medium; a controller operatively connected to the power source, to control the power source, wherein a time-averaged value (Vave) of the voltage has a polarity in the transfer direction, and an absolute value of the time-averaged value (Vave) is greater than a midpoint value (Voff) of the voltage intermediate between a maximum value and a minimum value of the voltage; and a selection device to select a type of the recording medium, wherein the controller controls the power source to reduce the duty ratio (Duty) as the roughness of the recording medium selected by the selection device increases, characterized in that as a roughness of the recording medium increases, the controller controls the power source to reduce a duty ratio (Duty) expressed by A / (A+B), where A is an area of an alternating waveform of the voltage in one cycle in a return direction opposite the transfer direction relative to the midpoint value Voff and B is an area in the transfer direction relative to the midpoint value Voff. an image bearing member to bear a toner image on a surface thereof; a transfer member disposed opposite the image bearing member to contact the surface of the image bearing member to form a transfer nip; a power source to output a voltage to transfer the toner image from the image bearing member onto a recording medium interposed in the transfer nip, the voltage including a first voltage in a transfer direction in which the toner image is transferred from the image bearing member to the recording medium and a second voltage having a polarity opposite that of the first voltage, and the first voltage and the second voltage alternating upon transfer of the toner image from the image bearing member to the recording medium; a controller operatively connected to the power source, to control the power source, wherein a time-averaged value (Vave) of the voltage has a polarity in the transfer direction, and an absolute value of the time-averaged value (Vave) is greater than a midpoint value (Voff) of the voltage intermediate between a maximum value and a minimum value of the voltage; and a selection device to select a type of the recording medium, wherein the controller controls the power source to reduce the duty ratio (Duty) as the roughness of the recording medium selected by the selection device increases, characterized in that as a roughness of the recording medium increases, the controller controls the power source to reduce a duty ratio (Duty) expressed by A / (A+B), where A is an area of an alternating waveform of the voltage in one cycle in a return direction opposite the transfer direction relative to the midpoint value Voff and B is an area in the transfer direction relative to the midpoint value Voff.