In a method and magnetic resonance (MR) apparatus to image a partial region of an examination subject by means of a multislice measurement, which partial region includes at least two measurement slices, and is located at least in part at the edge of a field of view of the magnetic resonance apparatus, for each voxel to be optimized that is located at the edge of the field of view, a gradient field is configured for each measurement slice of the partial region that is to be measured and is used to acquire magnetic resonance data in the multislice measurement. The gradient field is configured so as to cause a nonlinearity of the gradient field and a B0 field inhomogeneity to cancel at each of the aforementioned voxel to be optimized at the partial region at the edge of the field of view. An image of the partial region of the examination subject is determined from the magnetic resonance data acquired in this manner.