The component doesn’t perform any modifications or compression apart from applying the watermark.
Discourse already preprocesses the image first (using squoosh library) → the watermark is applied → The image is uploaded to the server. That would be how it works.