Skip to content

Commit 95603e9

Browse files
authored
Use ImageFile.MAXBLOCK in tobytes() (#8906)
1 parent 892fd2c commit 95603e9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/PIL/Image.py

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

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

807809
output = []
808810
while True:

0 commit comments

Comments
 (0)