In this paper, we design phase-only and quantized diffractive optical elements to transfer a field with circular Gaussian intensity distribution to an expanded squared uniform distribution based on the Fresnel diffraction theorem. The simulated annealing algorithm was used to design these elements. Many different cost functions were defined, applied and compared in this algorithm. Besides, we found that dark area expansion in the target patterns can improve the uniformity of designed results. However, there are no improvements when the bright area is smaller than an eight in one dimension of the total diffraction field. In addition, the uniformity can be improved at the expense of decreased diffraction efficiency.