  In this work a set of simulations that aim at the optimization of gaseous
detectors for applications in X-ray fluorescence imaging in the energy range of
3 -- 30keV is presented. By studying the statistical distribution of the
radiation interactions with gases, the energy resolution limits after charge
multiplication for 6keV X-ray photons in Ar/CO$_2$(70/30) and Kr/CO$_2$(90/10)
were calculated, obtaining energy resolutions of 15.4(4)% and 14.6(2)%
respectively. The detector design was also studied to reduce the presence of
escape peaks and complement a model to evaluate the inevitable X-ray
fluorescence of copper generated by the conductive materials inside the
detector.
