Repository navigation
Support 16-bit images in ImageEnhance - #10549
Conversation
| if 0 in image.size: | ||
| mean = 0 | ||
| else: | ||
| value = image.resize((1, 1), Image.Resampling.BOX).getpixel((0, 0)) |
|
I separated out the |
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
a398d5f to
b991754
Compare
|
Resampling to 1x1 with Also, now that #10551 has landed, I have rebased this branch on |
b1762b8 to
fbe6bd8
Compare
fbe6bd8 to
2e060ec
Compare
969e86e to
12e4c61
Compare
Resolves #7397.
Changes:
src/PIL/ImageEnhance.py:Contrast: For 16-bit images (I;16*), calculated the image mean using box resampling (image.resize((1, 1), Image.Resampling.BOX).getpixel((0, 0))) to preserve full 16-bit precision without clipping valuesColor: For 16-bit images, maintained intermediate mode asimage.modeso that grayscale images are cleanly preserved without 8-bit quantization.Color,Brightness,Contrast, andSharpnesson 16-bit images (I;16,I;16B,I;16L,I;16N).