A convective eddy imposed on an initially uniform magnetic field in a highly conducting fluid distorts the lines of force and amplifies the field. Flux is concentrated outside the eddy; within it, the field grows and its scale of variation decreases until resistive effects become important. Closed lines of force are then formed by reconnexion. The central field decays and a steady state is reached. Within a period, small compared with the characteristic time for resistive decay, magnetic flux is almost entirely expelled from regions of rapid motion and concentrated at the edges of convection cells. This process is demonstrated from numerical experiments. The results are applied to the sun, where the concentrated fields are strong enough to inhibit convection locally.