One of the important research areas in imaging is the formation of images, which plays an important role in many different applications, including surveillance, control, and security affairs. On the other hand, high spatial resolution is one of the most important factors for increasing image quality, but it increases the amount of storage memory. Based on this, it is expected that the processing methods will be concentrated in this area. In face recognition systems, one of the existing challenges is maintaining the image recognition rate. These images in the recognition system may affect the efficiency of the system, and as a result, it may be inferred that the percentage of recognition is found. Proposing a method that at least does not reduce detection rates would be very desirable. This article investigates how to compress facial images with high spatial resolution using innovative algorithms to reduce or even increase their accuracy as much as possible. In this article, meta-heuristic algorithms (genetics and gray wolf) are used in a way that they are responsible for identifying the important and similar areas of matching macroblocks in the whole image segmentation. So how arranging the length of the bit string of each block is appropriate to achieve the target estimation to achieve the highest recognition accuracy value, PSNR value, and SSIM value of the image set? In the simulation and evaluation section, the facial images of the CIE and FEI databases have been examined as a selective study, and the recognition efficiency of the images for the conditions without/with compression and the common SPIHT and JPEG coding methods and compared with the proposed method. The simulation results show the significant impact of the proposed methods using meta-heuristic algorithms in increasing the quality of PSNR and SSIM in contrast to the recognition efficiency. According to the proposed method, the larger the value of dividing the blocks, the better the average PSNR and SSIM, assuming the highest recognition accuracy can be reached in both meta-heuristic algorithms. In general, depending on the type of application of the problem, there is a compromise to achieve the highest average PSNR or SSIM, using a genetic algorithm or gray wolf. The gray wolf algorithm, however, reaches its optimal answer much faster than the genetic algorithm.