mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Merge pull request #1 from radarhere/patch-2
Added test and flush file pointer
This commit is contained in:
commit
c42e6bab1c
|
@ -73,6 +73,13 @@ def test_write(tmp_path):
|
|||
img.save(out, format="sgi")
|
||||
assert_image_equal_tofile(img, out)
|
||||
|
||||
out = str(tmp_path / "fp.sgi")
|
||||
with open(out, "wb") as fp:
|
||||
img.save(fp)
|
||||
assert_image_equal_tofile(img, out)
|
||||
|
||||
assert not fp.closed
|
||||
|
||||
for mode in ("L", "RGB", "RGBA"):
|
||||
roundtrip(hopper(mode))
|
||||
|
||||
|
|
|
@ -193,6 +193,9 @@ def _save(im, fp, filename):
|
|||
for channel in im.split():
|
||||
fp.write(channel.tobytes("raw", rawmode, 0, orientation))
|
||||
|
||||
if hasattr(fp, "flush"):
|
||||
fp.flush()
|
||||
|
||||
|
||||
class SGI16Decoder(ImageFile.PyDecoder):
|
||||
_pulls_fd = True
|
||||
|
|
Loading…
Reference in New Issue
Block a user