What the Quality Number Really Controls
Lossy compression works by discarding the parts of an image your eyes notice least. Fine color variations in busy areas, subtle gradients, and high-frequency detail can be simplified dramatically before anyone sees a difference, and that simplification is where the file size savings come from.
The quality setting from 1 to 100 controls how aggressive that discarding is. It is not a percentage of pixels kept, every pixel stays, it is a knob on how much detail the encoder is allowed to throw away. At 80, photos typically shrink to a fraction of their size while looking untouched in normal viewing. Below about 50, smooth areas start to band and edges grow halos. Above 90, files balloon quickly for gains you will struggle to see.
Photos tolerate compression well because they are full of natural texture that hides the simplification. Sharp-edged graphics, screenshots, and text suffer sooner, artifacts cluster exactly at hard edges. For those, keep the quality high or stick with lossless formats.