The present teaching relates to methods, systems, and apparatus for X-ray imaging with a detector capable of resolving photon energy. In one example, an X-ray microscope is disclosed. The X-ray microscope comprises an X-ray source and a detector. The X-ray source is configured for irradiating X-ray to a sample. The detector is configured for: detecting X-ray photons from the irradiated X-ray, determining energy of each of the detected X-ray photons, and generating an image of the sample based on detected X-ray photons that have energies in a predetermined range.