Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6667.
Changes proposed in this pull request:
ImagingLineBoxBlur16()toBoxBlur.c, and allow I;16, I;16L, I;16B and I;16N images inImagingBoxBlur(). SinceGaussianBluris built from box blurs, this means that bothImageFilter.BoxBlurandImageFilter.GaussianBlurnow work with I;16 images.acc * wwcan be as large as 65535 << 24.kernel_i16()inFilter.c, so I;16B (and I;16N on big-endian machines) is read and written big-endian.UnsharpMaskalso callsImagingGaussianBlur(), but its sharpening loop only handles 8-bit data. So that it doesn't silently produce garbage now that the blur accepts I;16, it explicitly rejects non-8-bit images, with the same "image has wrong mode"ValueErroras before.assert_blur()intest_box_blur.pynow also checks the four I;16 modes, so every existing radius/passes case runs against them. As those values are all below 256, the results should match L exactly.test_i16_high_valuesuses values up to 65535 and compares a radius 1 blur against a 3x3 mean computed in Python, within 1.test_i16_max_valuechecks that a 65535 image stays 65535 with a large radius and 3 passes. This fails if the accumulators are 32-bit.test_blur_i16intest_image_filter.pychecks thatGaussianBlurandBoxBluronhopper("L").convert(mode)give the same result as onhopper("L").test_unsharp_mask_i16checks thatUnsharpMaskstill raisesValueErrorfor I;16.docs/releasenotes/13.1.0.rst.Testing:
main(41 failures, allValueError: image has wrong mode) and pass with this change.python3 -m pytest Tests -n 8: everything passes excepttest_imagegrab.py::TestImageGrab::test_grab, which fails locally becausescreencaptureisn't permitted in the environment it was run in. That is unrelated to this change.pre-commit run --all-filesandmypy(with.ci/requirements-mypy.txt, as intox -e mypy) pass.