The accuracy of the pulsar period estimation directly affects the restoration effect of the signal profile. A more accurate pulsar profile will help improve the accuracy of pulsar delay estimation and thereby improve the performance of X-ray pulsar navigation. This paper proposes a pulsar period estimation method based on photon energy distribution folding and image template matching (PETM). This method uses the probability distribution information of photon energy for weighted epoch folding. The one-dimensional (1D) profile information was converted into two-dimensional (2D) image information through reverse space-filling curve (SFC) encoding. Then, a feature matching was performed between the target structure and the template structure. At the same time, the criterion of Pearson correlation coefficient (PCC) was used to quantitatively evaluate the matching effect to estimate the optimal period. The simulation results show that the period estimation accuracy of the PETM method is significantly improved, as compared with the traditional \( method. This work also analyzes the folding effect based on the photon energy distribution model and conducts simulation experiments and comparisons on influencing factors, such as noise interference and data quality. At the same time, we also specifically demonstrated the effectiveness of the PETM method for the glitch phenomenon (i.e., a sudden change in period) of pulsar periods. Finally, we also used China's XPNAV-1 satellite to conduct experiments and analysis of the actual observation data of PSR B0531+21 pulsar within a fixed period of time. The results show that the period estimation accuracy of this method is 4.8190$ns$, which is 50.23<!PCT!> higher than the traditional \( method. The method proposed in this article has the advantages of high estimation accuracy, stable estimation performance, strong anti-interference ability, and excellent dynamic period estimation performance. Therefore, it can further improve the navigation performance of X-ray pulsars.