Machine Learning analysis of X-ray spectroscopy images