a :jg[0ã @sÎdZddlmZdgd¢gd¢gdœdgd¢gd¢gdœdgd ¢gd ¢gdœdgd ¢gd ¢gdœdgd ¢gd¢gdœdgd¢gd¢gdœdgd¢gd¢gdœdgd¢gd¢gdœdgd ¢gd¢gdœdœ ZdS)u JPEG quality settings equivalent to the Photoshop settings. Can be used when saving JPEG files. The following presets are available by default: ``web_low``, ``web_medium``, ``web_high``, ``web_very_high``, ``web_maximum``, ``low``, ``medium``, ``high``, ``maximum``. More presets can be added to the :py:data:`presets` dict if needed. To apply the preset, specify:: quality="preset_name" To apply only the quantization table:: qtables="preset_name" To apply only the subsampling setting:: subsampling="preset_name" Example:: im.save("image_name.jpg", quality="web_high") Subsampling ----------- 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 :func:`.JpegImagePlugin.get_sampling` function. In JPEG compressed data a JPEG marker is used instead of an EXIF tag. (ref.: https://exiv2.org/tags.html) Quantization tables ------------------- 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:: im.quantization 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 é)Ú annotationsé)@éééé'é2é.é>éDrééé&ré5éAr rr érrrr r rrrrrr r r rrrrr r r r r rrr r r r r r rr r r r r r r r r r r r r r )@éré ré6r r r réérrr r r rrré+éBr r r rrrrr r r r rrrr r r r r r r r r r r r r r r r r r r r r r r r r r r r r )Z subsamplingZ quantization)@ré rrr éréré rérr r rrré rr éé#é/rrrr ré%r!é@r rr r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