X-ray photon-counting detectors are considered as next generation x-ray detectors because they offer several advantages over conventional energy-integrating detectors, such as the ability to obtain energy information due to the photon-counting capability. In addition, the contrast-to-noise ratio in a photon-counting detector is higher than that of a conventional charge-integration detector due to its direct detection of radiation. Nevertheless, it suffers from charge sharing effect which is caused by diffusion of electrons generated from incident x-rays and k-edge escape photon to other pixels. Due to these phenomena, distortion can occur in terms of the position information and the energy information. In this work, we used the time-over-threshold (ToT) and projection method to compensate for charge sharing. We projected the charge-sharing value of eight neighboring pixels to the center pixel and found the point where the photon had the highest probability of entering the center pixel. We then divided the center pixel into 3 x 3 sections and found the location where the very first x-ray photon was incident through the projection. Using a timepix chip with CdTe pixels, 50,000 images were acquired for 1.5 seconds at intervals of 30 us with the ToT method. At this time, x-ray irradiation was applied to various materials at 80 kVp and 5 uA.