In order to avoid the problem that the weak gradient edge information is smoothed and the noise texture information is retained due to the strong gradient characteristics similar to the structure pixels, a global optimization algorithm framework is proposed. By calculating the similarity between the current pixel in the image and the pixel in the local neighborhood, the method initially determines whether the pixel to be processes is located in the structure area. Based on this, the two weights after the sub-item are designed to constrain the pixel to be processed to be similar to the original image or similar to the filtering result, so as to realize the retention of structural information and the smoothing of unstructured information. Due to its strong flexibility, the framwork is suitable for most global optimization algorithms. Finally, the framework is applied to the smoothing algorithm example based on L2
, and to conduct comprehensive comparison experiments with other algorithms, and PSNR and SSIM evaluation indexes are used to evaluate each algorithm on the BSD300 data set, which verifies the practicality of the proposed framework, and the improved algorithm can not only keep the weak gradient structure information, but also maintain the structure information. The image smoothing effect is better than the original algorithm.