OptionalbackgroundThe background color to combine with transparent pixels, since JPEG doesn't support transparency. Opaque images are encoded as they are
OptionalgainWhether to write the image's Image.gainMap (an Ultra HDR JPEG, brighter on HDR displays), or how.
OptionalmetadataMetadata to include, see Metadata
OptionalprogressiveWhether to write a progressive JPEG: the picture first appears blurry as a whole and sharpens while it loads, and the file is about 3% smaller for photos. The pixels are the same, and encoding takes 1.1 to 1.3 times as long. An embedded gain map stays a baseline JPEG
OptionalqualityThe JPEG quality (0-100, 0 is the same as 1)
OptionalquantizationThe quantization tables, which decide how coarsely each frequency is stored (not the colors, as in
Image.quantize): 'standard' (the JPEG standard's) stores fine detail more coarsely than smooth areas,
which softens sharp edges and text first; 'flat' uses the same step for every frequency, which keeps edges and
text clearer with fewer visible artifacts. At the same PSNR, files with 'flat' were 3 to 30% smaller in a test of
photos and a screenshot; at the same SSIM they ranged from 21% smaller to 15% larger (a photo at a low quality).
The same quality makes a larger file with 'flat': lower it until the size matches (by about 15 to 25 around
quality 60 for photos). Qualities 96 to 100 give the same 'flat' file. Not used for the gain map
OptionalsubsamplingHow much color detail to keep: '4:4:4' keeps it all; '4:2:0' stores less color detail to make a smaller
file (often hard to notice in photos, but more visible around colored edges)
Options of Image.encodeJPEG