Most "compress your image" sites still work the same way: you upload the file, a server does the work, you download the result. For a 4 MB photo that's two network trips and a queue, plus your file sitting on someone else's disk.

You don't need any of it. The browser has shipped everything required for this since about 2012.

The basic...