  Context: One aspect of understanding the dynamics of the quiet Sun is to
quantify the evolution of the flux within small-scale magnetic features. These
features are routinely observed in the quiet photosphere and were given various
names, such as pores, knots, magnetic patches. Aims: This work presents a new
algorithm for tracking the evolution of the broad variety of small-scale
magnetic features in the photosphere, with a precision equal to the
instrumental resolution. Methods: We have developed a new technique to track
the evolution of the individual magnetic features from magnetograms, called
"magnetic balltracking". It quantifies the flux of the tracked features, and it
can track the footpoints of magnetic field lines inferred from magnetic field
extrapolation. The algorithm can detect and quantify flux emergence, as well as
flux cancellation. Results: The capabilities of magnetic balltracking are
demonstrated with the detection and the tracking of two cases of magnetic flux
emergence that lead to the brightening of X-ray loops. The maximum emerged flux
ranges from 10^{18} Mx to 10^{19} Mx (unsigned flux) when the X-ray loops are
observed.
