Skip to content

Commit 13bffef

Browse files
committed
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'.
1 parent e3c0ee6 commit 13bffef

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/libImaging/JpegEncode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes) {
173173
/* Use custom quantization tables */
174174
if (context->qtables) {
175175
int i;
176-
int quality = 100;
176+
int quality = 50;
177177
int last_q = 0;
178178
if (context->quality != -1) {
179179
quality = context->quality;

0 commit comments

Comments
 (0)