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

Method test_extent

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

Source from the content-addressed store, hash-verified

55 assert im.palette.palette == transformed.palette.palette
56
57 def test_extent(self) -> None:
58 im = hopper("RGB")
59 w, h = im.size
60 transformed = im.transform(
61 im.size,
62 Image.Transform.EXTENT,
63 (0, 0, w // 2, h // 2), # ul -> lr
64 Image.Resampling.BILINEAR,
65 )
66
67 scaled = im.resize((w * 2, h * 2), Image.Resampling.BILINEAR).crop((0, 0, w, h))
68
69 # undone -- precision?
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

Callers

nothing calls this directly

Calls 5

hopperFunction · 0.85
assert_image_similarFunction · 0.85
cropMethod · 0.80
transformMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected