MCPcopy Index your code
hub / github.com/python-pillow/Pillow / test_quad

Method test_quad

Tests/test_image_transform.py:72–90  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

70 assert_image_similar(transformed, scaled, 23)
71
72 def test_quad(self) -> None:
73 # one simple quad transform, equivalent to scale & crop upper left quad
74 im = hopper("RGB")
75 w, h = im.size
76 transformed = im.transform(
77 im.size,
78 Image.Transform.QUAD,
79 (0, 0, 0, h // 2, w // 2, h // 2, w // 2, 0), # ul -> ccw around quad
80 Image.Resampling.BILINEAR,
81 )
82
83 scaled = im.transform(
84 (w, h),
85 Image.Transform.AFFINE,
86 (0.5, 0, 0, 0, 0.5, 0),
87 Image.Resampling.BILINEAR,
88 )
89
90 assert_image_equal(transformed, scaled)
91
92 @pytest.mark.parametrize(
93 "mode, expected_pixel",

Callers

nothing calls this directly

Calls 3

hopperFunction · 0.85
assert_image_equalFunction · 0.85
transformMethod · 0.45

Tested by

no test coverage detected