Skip to content

Commit f8a9e53

Browse files
committed
Use ImageFile.MAXBLOCK in tobytes()
1 parent 3d41195 commit f8a9e53

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/PIL/Image.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,9 @@ def tobytes(self, encoder_name: str = "raw", *args: Any) -> bytes:
800800
e = _getencoder(self.mode, encoder_name, encoder_args)
801801
e.setimage(self.im)
802802

803-
bufsize = max(65536, self.size[0] * 4) # see RawEncode.c
803+
from . import ImageFile
804+
805+
bufsize = max(ImageFile.MAXBLOCK, self.size[0] * 4) # see RawEncode.c
804806

805807
output = []
806808
while True:

0 commit comments

Comments
 (0)