Photos straight from a phone or camera are far larger than any website or email needs. A single image can run to several megabytes, which slows pages down and fills inboxes. Compressing an image strips out that excess weight while keeping the picture looking the same to the eye, so pages load faster and files travel easily.
At sensible settings the change is very hard to see, while the file becomes far smaller. Stronger settings trade visible detail for size.
The usual web image formats are supported, including JPG, PNG and WebP.
Photographs often shrink by more than half. Simple graphics with flat colours shrink less because they are already small.
Ordinary photos process quickly. Very large images simply take a little longer.