On the basis of the analysis of the principle of OSTU algorithm, an improved method for gray images is presented. The algorithm overcomes the weakness of searching an optimal threshold in the whole gray-level, and reduces the number of calculating square error. Experiments show that the method can produce ideal binary images.