We describe the response of magnetic flux leakage measurements obtained in wellbore casings and detail an analytical approach for inverting the data to construct a 3D image of metal loss for the general case in which the magnetic permeability of the casing is unknown. This approach contrasts with current practice which assumes a defect shape and attempts to deduce metal loss from one or more response metrics matched to a library of defects generated under laboratory conditions for that shape. The traditional approach breaks down where defects do not conform to the assumed shape and when the properties of the laboratory casing are not the same as the properties of the installed casing. Moreover, there is no direct way to know whether magnetic flux in the casing is at saturation level; thus, the measurement could be operating in a nonlinear part of the magnetization curve whose shape also is unknown. The new method makes no assumptions about defect shape and approximates the relevant part of the magnetization curve within an inversion process that transforms the flux scan into a metal loss scan showing the shape and depth of metal loss. The approach is validated using data from simulations, laboratory tests, and field operations. Unlike images of flux distribution, thickness profiles reconstructed from the results of the inversion reflect the actual distribution of metal loss to a useful level of accuracy and thereby enable the casing’s mechanical integrity to be assessed with greater confidence.