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

Method encode_to_file

src/PIL/ImageFile.py:924–938  ·  view source on GitHub ↗

:param fh: File handle. :param bufsize: Buffer size. :returns: If finished successfully, return 0. Otherwise, return an error code. Err codes are from :data:`.ImageFile.ERRORS`.

(self, fh: int, bufsize: int)

Source from the content-addressed store, hash-verified

922 return bytes_consumed, errcode
923
924 def encode_to_file(self, fh: int, bufsize: int) -> int:
925 """
926 :param fh: File handle.
927 :param bufsize: Buffer size.
928
929 :returns: If finished successfully, return 0.
930 Otherwise, return an error code. Err codes are from
931 :data:`.ImageFile.ERRORS`.
932 """
933 errcode = 0
934 while errcode == 0:
935 status, errcode, buf = self.encode(bufsize)
936 if status > 0:
937 os.write(fh, buf[status:])
938 return errcode

Callers 2

test_encodeMethod · 0.95
_encode_tileFunction · 0.80

Calls 2

encodeMethod · 0.95
writeMethod · 0.45

Tested by 1

test_encodeMethod · 0.76