We have designed a computational tool for generating X-ray photon spectra for a range of applications both in diagnostic radiology and mammography. As a library, we have adapted the spectral data based on the interpolating polynomials methods by Boone et al [5,6] as well as the computer data files given by Cranley et al . The attenuated spectra for element or compound materials can be calculated based on the mass-attenuation coefficients from NIST (National Institute of Science and Technology), which were also incorporated as a database. Furthermore, a function that a user can generate any filter material by editing the NIST data has been implemented. Parameters related to the beam quality, such as mean photon energy, fluence, exposure, half-value layer (HVL), etc., are considered as important outputs. All of functions and database are integrated in a form of graphical user interface (GUI) by using Microsoft Visual C++TM. This self-developed spectrum-generating code can be usefully served to design X-ray sensors. In this study, we have applied the code to estimate quantum efficiency and charge collection efficiency in various detector materials.