1. A method of grayscale compensation to defects on a display panel, comprising: (A) obtaining a set of coordination of the defect on the display panel, and determining a defect area where the defect locates based on the set of coordination; (B) obtaining a gamma curve of the defect, a gamma curve of a background of the defect area, and a standard gamma curve of the background of the display panel; (C) obtaining a standard gamma curve of the defect and a standard gamma curve of the background of the defect area, based on the gamma curve of the defect, the gamma curve of the background of the defect area, and the standard gamma curve of the background of the display panel; and (D) calculating a grayscale-compensation value for each grayscale of the defect, based on the standard gamma curve and the standard gamma curve of the background of the defect area.