For downloading images, an extraneous library is used; the image is saved in several extensions with regard to proportions; this does not work well. But Google shows that the image can be optimized. Yes, this is true, but you cannot lose in quality at all. This library is currently used.
How to optimize the image without losing quality?