JPEG quality settings equivalent to the Photoshop settings. Can be used when saving JPEG files.
The following presets are available by default:
More presets can be added to the
presets dict if needed.
To apply the preset, specify:
To apply only the quantization table:
To apply only the subsampling setting:
Subsampling is the practice of encoding images by implementing less resolution for chroma information than for luma information. (ref.: https://en.wikipedia.org/wiki/Chroma_subsampling)
Possible subsampling values are 0, 1 and 2 that correspond to 4:4:4, 4:2:2 and 4:2:0.
You can get the subsampling of a JPEG with the
In JPEG compressed data a JPEG marker is used instead of an EXIF tag. (ref.: https://exiv2.org/tags.html)
They are values use by the DCT (Discrete cosine transform) to remove unnecessary information from the image (the lossy part of the compression). (ref.: https://en.wikipedia.org/wiki/Quantization_matrix#Quantization_matrices, https://en.wikipedia.org/wiki/JPEG#Quantization)
You can get the quantization tables of a JPEG with:
This will return a dict with a number of lists. You can pass this dict directly as the qtables argument when saving a JPEG.
The quantization table format in presets is a list with sublists. These formats are interchangeable.
Libjpeg ref.: https://web.archive.org/web/20120328125543/http://www.jpegcameras.com/libjpeg/libjpeg-3.html