Skip to content

Conversation

radarhere
Copy link
Member

tobytes() sets a buffer size when encoding.

bufsize = max(65536, self.size[0] * 4) # see RawEncode.c

ImageFile also does this when saving an image, but the 65536 value is configurable.

MAXBLOCK = 65536

bufsize = max(MAXBLOCK, bufsize, im.size[0] * 4) # see RawEncode.c

Perhaps we should use ImageFile.MAXBLOCK in tobytes() as well?

@radarhere radarhere merged commit 95603e9 into python-pillow:main Jun 2, 2025
71 of 72 checks passed
@radarhere radarhere deleted the maxblock branch June 2, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants