Every endpoint that re-encodes lossily takes a quality between 1 and 100.
One scale for every format
The scale is perceptual and anchored to JPEG: the same number means about
the same visual quality in every format. Glimpse translates the value to
each encoder's own scale for you. So quality: 60 in AVIF looks about the
same as quality: 60 in JPEG, even though the encoders use very different
numbers internally.
- The default is 85. For most photos you will not see a difference, and the files get much smaller.
- Thumbnails default to 60. At thumbnail sizes you cannot see the artifacts, and the savings are big.
- Below about 40 the artifacts become visible. Use that range only when size matters more than looks.
The optimizer never makes a file bigger
Wherever the optimizer runs (optimize: true on convert and resize, or the
optimize endpoint itself), the result is never
larger than without it. If a re-encode would grow the image, you get the
smaller version instead. So it is always safe to pass optimize: true.
For WebP and AVIF there is one more rule: a re-encode is kept only when it saves more than a threshold (2 percent of the input size by default). A tiny saving is not worth another lossy generation. See Optimize for what this means when you run it repeatedly.
quality only applies when the optimizer runs. On convert and resize it
needs optimize: true, and when you omit it, the default of 85 is used.