An X-ray imaging method comprises a first step of providing a training set comprising one or more sample materials and/or different thicknesses for the material(s). X-ray images of the training samples are obtained with a pixelated detector. A database 18 of simulated scatter kernels is built with variable parameters for each sample, generating a transfer function 19 between observed and simulated parameters, which is independent from sample type and thickness. Subsequently, a second X-ray image 20 for a material similar to the first sample is acquired. A scatter estimate for the second image is computed with optical path ray tracing 22, predicting the direct radiation for each scatter kernel. The transfer function is applied to the scatter estimate and the direct radiation or the inverse of the transfer function to the observed intensity values. Where Z (observed intensity values) - S (scattered radiation with transfer function applied) - D (direct radiation with transfer function applied) is less than a given threshold 24, S is subtracted from Z to provide a scatter-free image 24. The variable parameters may be the energy in kV, filtering or sample position. Part of the scattered radiation may be added to the direct radiation 25.