Defect quantification is a very important aspect in nondestructive testing (NDT) as it helps in the analysis and prediction of a structure's integrity and lifespan. In this paper, we propose a gradient feature extraction for the quantification of complex defect using topographic primal sketch (TPS) in magnetic flux leakage (MFL) testing. This method uses four excitation patterns so as to obtain MFL images from experiment; a mean image is then produced, assuming it has 80–90% the properties of all four images. A gradient manipulation is then performed on the mean image using a novel least-squares minimization (LSM) approach, for which, pixels with large gradient values (considered as possible defect pixels) are extracted. These pixels are then mapped so as to get the actual defect geometry/shape within the sample. This map is now traced using a TPS for a precise quantification. Results have shown the ability of the method to extract and quantify defects with high precision given its perimeter, area, and depth. This significantly eliminates errors associated with output analysis as results can be clearly seen, interpreted, and understood.