Objective. Magnetic particle imaging (MPI) is a novel radiation-free medical imaging modality that can directly image superparamagnetic iron oxide tracers (SPIOs) with high sensitivity, temporal resolution, and good spatial resolution. The MPI reconstruction task can be formulated mathematically as a Fredholm integral problem, but the concrete inversion is not easily possible because of the particle dynamics or scanner issues. Measurement based system matrix inversion takes these factors into account, but prior measurement and calibration are time consuming. Approach. We proposed a direct imaging method based on the weighted sum of harmonic signals. The harmonic signals with spatial information are obtained by the short-time Fourier transform, and odd harmonic components are selected for recombination and then mapped to the sampling trajectory to image the concentration distribution of SPIOs. In addition, we adopt a normalized-weighted sum of harmonics to improve the resolution of the native image. Main results. The effectiveness of the proposed method is verified by simulation imaging experiments and our in-house scanner-based experiments. Quantitative evaluation results show that compared with traditional methods, the structural similarity improved by 48%, mean square error decreased by 88%, and signal-to-artifact ratio increased by 2.5 times. Significance. The proposed method can rapidly image the concentration distribution of nanoparticles without any prior calibration measurements and reduce the blur of MPI images without deconvolution, which has the potential to be implemented as a multi-patch imaging method in MPI.