Method for correcting a spectral image formed by ionizing electromagnetic radiation transmitted by an object, the object being placed between a radiation source and a detector, the radiation source being able to emit ionizing electromagnetic radiation, called incident radiation (I 0), toward the object; - the detector comprising pixels (20 i), each pixel being configured to detect radiation transmitted by the object to the detector, and to measure a spectrum (S i) thereof, the transmitted radiation comprising scattered radiation ( I diff), caused by scattering of the incident radiation (I 0) in the object, and primary radiation ( I p); - a mask being interposed between the source and the object, the mask comprising absorbent elements (15 x), which are able to attenuate one portion of the incident radiation (I 0), the projection of each absorbent element onto the detector forming one shadow region (20 x), such that the detector comprises a plurality of shadow regions that are spaced apart from one another, each shadow region (20 x) comprising at least one pixel (20 i ∈ 20 x); the method comprising: a) irradiating the object and measuring, by means of the pixels (20 i) of the detector, an energy spectrum (S i) representative of the radiation transmitted by the object; the method being characterized in that it also comprises the following steps: b) defining a spatial model ( mod K) of the spectrum of the scattered radiation, so as to obtain, for various pixels of the detector, an estimate ( S ^ i, K diff) of the spectrum of the scattered radiation detected by each pixel (20 i), the spatial model being defined by parameters; c) taking into account a cost function ( F K), the cost function being defined for various pixels and taking into account, at the level of each pixel, a spatial variation ( ∇ S ^ i, K p ′) in an estimate of the spectrum of the primary radiation transmitted by the object in the absence of the mask, the estimate ( S ^ i, K p ′) of the spectrum of the primary radiation in the absence of the mask being obtained by comparing, for each pixel: - the spectrum ( S i) measured by the pixel in step a); - an estimate ( S ^ i, K diff) of the spectrum of the scattered radiation, which estimate is obtained using the spatial model ( mod K) resulting from step b); d) determining the parameters, of the spatial model ( mod K), for which the cost function ( F K) is minimal or maximal; e) for at least one pixel (20 i), estimating the scattered-radiation spectrum reaching the pixel ( S ^ i diff), by applying the parameters of the spatial model that were determined in step d); f) for at least one pixel, correcting the spectrum (S i) measured in step a) using the estimate of the spectrum of the scattered radiation resulting from step e), so as to obtain a corrected spectrum ( S i ∗) corresponding to an estimate ( S ^ i p, S ′ ^ i p) of the spectrum of the primary radiation reaching the pixel. - the detector comprising pixels (20 i), each pixel being configured to detect radiation transmitted by the object to the detector, and to measure a spectrum (S i) thereof, the transmitted radiation comprising scattered radiation ( I diff), caused by scattering of the incident radiation (I 0) in the object, and primary radiation ( I p); - a mask being interposed between the source and the object, the mask comprising absorbent elements (15 x), which are able to attenuate one portion of the incident radiation (I 0), the projection of each absorbent element onto the detector forming one shadow region (20 x), such that the detector comprises a plurality of shadow regions that are spaced apart from one another, each shadow region (20 x) comprising at least one pixel (20 i ∈ 20 x); a) irradiating the object and measuring, by means of the pixels (20 i) of the detector, an energy spectrum (S i) representative of the radiation transmitted by the object; b) defining a spatial model ( mod K) of the spectrum of the scattered radiation, so as to obtain, for various pixels of the detector, an estimate ( S ^ i, K diff) of the spectrum of the scattered radiation detected by each pixel (20 i), the spatial model being defined by parameters; c) taking into account a cost function ( F K), the cost function being defined for various pixels and taking into account, at the level of each pixel, a spatial variation ( ∇ S ^ i, K p ′) in an estimate of the spectrum of the primary radiation transmitted by the object in the absence of the mask, the estimate ( S ^ i, K p ′) of the spectrum of the primary radiation in the absence of the mask being obtained by comparing, for each pixel: - the spectrum ( S i) measured by the pixel in step a); - an estimate ( S ^ i, K diff) of the spectrum of the scattered radiation, which estimate is obtained using the spatial model ( mod K) resulting from step b); - the spectrum ( S i) measured by the pixel in step a); - an estimate ( S ^ i, K diff) of the spectrum of the scattered radiation, which estimate is obtained using the spatial model ( mod K) resulting from step b); d) determining the parameters, of the spatial model ( mod K), for which the cost function ( F K) is minimal or maximal; e) for at least one pixel (20 i), estimating the scattered-radiation spectrum reaching the pixel ( S ^ i diff), by applying the parameters of the spatial model that were determined in step d); f) for at least one pixel, correcting the spectrum (S i) measured in step a) using the estimate of the spectrum of the scattered radiation resulting from step e), so as to obtain a corrected spectrum ( S i ∗) corresponding to an estimate ( S ^ i p, S ′ ^ i p) of the spectrum of the primary radiation reaching the pixel.