MCPcopy
hub / github.com/python-pillow/Pillow / test_g4_write

Method test_g4_write

Tests/test_file_libtiff.py:130–147  ·  view source on GitHub ↗

Checking to see that the saved image is the same as what we wrote

(self, tmp_path: Path)

Source from the content-addressed store, hash-verified

128 assert_image_equal_tofile(g4, "Tests/images/g4-fillorder-test.png")
129
130 def test_g4_write(self, tmp_path: Path) -> None:
131 """Checking to see that the saved image is the same as what we wrote"""
132 test_file = "Tests/images/hopper_g4_500.tif"
133 with Image.open(test_file) as orig:
134 out = tmp_path / "temp.tif"
135 rot = orig.transpose(Image.Transpose.ROTATE_90)
136 assert rot.size == (500, 500)
137 rot.save(out)
138
139 with Image.open(out) as reread:
140 assert reread.size == (500, 500)
141 self._assert_noerr(tmp_path, reread)
142 assert_image_equal(reread, rot)
143 assert reread.info["compression"] == "group4"
144
145 assert reread.info["compression"] == orig.info["compression"]
146
147 assert orig.tobytes() != reread.tobytes()
148
149 def test_adobe_deflate_tiff(self) -> None:
150 test_file = "Tests/images/tiff_adobe_deflate.tif"

Callers

nothing calls this directly

Calls 6

assert_image_equalFunction · 0.85
transposeMethod · 0.80
_assert_noerrMethod · 0.80
openMethod · 0.45
saveMethod · 0.45
tobytesMethod · 0.45

Tested by

no test coverage detected