Use ImageFile.MAXBLOCK in tobytes() by radarhere · Pull Request #8906 · python-pillow/Pillow
tobytes() sets a buffer size when encoding.
Line 803 in 3d41195
| bufsize = max(65536, self.size[0] * 4) # see RawEncode.c |
ImageFile also does this when saving an image, but the 65536 value is configurable.
Line 49 in 3d41195
| MAXBLOCK = 65536 |
Line 641 in 3d41195
| bufsize = max(MAXBLOCK, bufsize, im.size[0] * 4) # see RawEncode.c |
Perhaps we should use ImageFile.MAXBLOCK in tobytes() as well?