For experiments with ions confined in a Paul trap, minimization of micromotion is often essential. In order to diagnose and compensate micromotion we have implemented a method that allows for finding the position of the radio-frequency (rf) null reliably and efficiently, in principle, without any variation of direct current (dc) voltages. We apply a trap modulation technique and focus-scanning imaging to extract three-dimensional ion positions for various rf drive powers and analyze the power dependence of the equilibrium position of the trapped ion. In contrast to commonly used methods, the search algorithm directly makes use of a physical effect as opposed to efficient numerical minimization in a high-dimensional parameter space. Using this method we achieve a compensation of the residual electric field that causes excess micromotion in the radial plane of a linear Paul trap down to 0.09 V/m. Additionally, the precise position determination of a single harmonically trapped ion employed here can also be utilized for the detection of small forces. This is demonstrated by determining light pressure forces with a precision of 135 yN. As the method is based on imaging only, it can be applied to several ions simultaneously and is independent of laser direction and thus well-suited to be used with, for example, surface-electrode traps.