mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-05 05:33:10 +03:00
Fix quantization table scaling when quality is applied to custom qtables
When both a custom quantization table and a quality value are provided, the quantization table should be scaled using the JPEG quality scaling factor. If quality is not explicitly set, the default base quality of 50 is used to preserve the original table. This ensures consistent behavior when saving JPEGs with custom qtables. Fixes part of the issue with applying 'quality' to 'qtables'.
This commit is contained in:
parent
e3c0ee6ae2
commit
13bffef91d
|
@ -173,7 +173,7 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes) {
|
|||
/* Use custom quantization tables */
|
||||
if (context->qtables) {
|
||||
int i;
|
||||
int quality = 100;
|
||||
int quality = 50;
|
||||
int last_q = 0;
|
||||
if (context->quality != -1) {
|
||||
quality = context->quality;
|
||||
|
|
Loading…
Reference in New Issue
Block a user