Pick a target size in KB and I find the best quality that fits. For upload forms that reject anything over 200 KB.
WebP usually wins on size. PNGs become JPG or WebP because lossless formats can't trade quality for size.
QUESTIONS NOBODY ASKED ยท ANSWERED ANYWAY
No. Everything happens in your browser with the Canvas API. Close the tab and it is gone.
It binary searches the encoder quality until the file fits your target, then keeps the best looking result that still fits. If even the lowest quality is too big, it scales the image down.
PNG is lossless, so it has no quality knob to turn. To hit a size target it has to become a lossy format.