We develop a pH sensor film that can be coated on an implant surface and imaged using a combination of X-ray excitation and visible spectroscopy to monitor bacterial infection and treatment of implanted medical devices (IMDs) through tissue. X-ray scintillators in the pH sensor film generate light when an X-ray beam irradiates them. This light first passes through a layer containing pH indicator that alters the spectrum according to pH, then passes through tissue where it is detected by a spectrometer. A reference region on the film is used to account for spectral distortion from wavelength-dependent absorption and scattering in the tissue. pH images are acquired by moving the sample relative to the X-ray beam and collecting a spectrum at each location, with a spatial resolution limited by the X-ray beam width. Using this X-ray excited luminescence chemical imaging (XELCI) to map pH through porcine tissue, we detected a pH drop during normal bacterial growth on the sensor surface, and a restoration of the pH to the bulk value during antibiotic treatment over the course of hours with millimeter resolution. Overall, XELCI provides a novel approach to noninvasively image surface pH for studying implant infections and treatments.