Varied line spacing plane gratings have the features of self-focusing , aberration-reduced and easy manufacturing ,which are widely applied in synchrotron radiation, plasma physics and space astronomy, and other fields. In the study of diffracting imaging , the optical path function is expanded into maclaurin series, aberrations are expressed by the coefficient of series, most of the aberration coefficients are similar and the category is more, can't directly reflects image quality in whole. The paper will study on diffraction imaging of the varied line spacing plane gratings by using computer simulation technology, for a method judging the image quality visibly. In this paper, light beam from some object points on the same object plane are analyzed and simulated by ray trace method , the evaluation function is set up, which can fully scale the image quality. In addition, based on the evaluation function, the best image plane is found by search algorithm .