A method and system for sorting pistons with flaws is disclosed. In an embodiment, a piston with flaws is three dimensionally scanned and compared to a reference image to detect the location and geometry of the flaws. The location and geometry of the flaws are recorded and used to generate a surface condition score. The pistons are sorted based on the surface condition score being higher or lower than a set threshold value.