As an important component of Atomic Force Microscope (AFM), piezo-scanner exhibits some undesired nonlinear characteristics, among which the inherent hysteresis largely decreases the scanning rate and resolution of AFM. To alleviate this problem, an image-based approach is proposed in this paper to model and then compensate for the hysteresis behavior of the piezo-scanner. Specifically, some scanning images over calibration grating are utilized to identify the parameters of the classical Preisach model (CPM) of hysteresis. Based on the obtained model, an inversion-based technique is adopted to design a compensator for the hysteresis of piezo-scanner. The proposed algorithm presents such advantages of low cost and little complexity since no nano-sensor is required to collect identification data. Some simulation results are included to demonstrate the performance of the proposed strategy.