A new magnetic resonance (MR) imaging technique, opposite-polarity pulsed-field-gradient technique, with which the effects of background magnetic field gradients can be separated from the effects of diffusion, is described. It is based on the processing of two sets of diffusion-weighted images, the acquisition parameters of which differ only in the polarity of the applied diffusion pulses. The two effects can be separated because the cross term (bc) of the gradient factor function is antisymmetric with respect to reversal of the sign of the applied diffusion pulses. The technique permits simultaneous measurement of the spatial distribution of both the diffusion constants and background magnetic field gradients, with the same spatial resolution as the parent images from which they were derived. The technique has been validated with a phantom in which the spatial distribution of susceptibility-induced background gradients is known, the results showing excellent agreement with theory. The technique was applied to two systems in which the spatial distribution of the background gradient is unknown. Sources of error in the measurement of background gradients and (unrestricted) diffusion constants are analyzed, including the effects of voxel size, partial volumes, and interactions between background and imaging gradients.