Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Use ImageFile.MAXBLOCK in tobytes()#8906

Merged
radarhere merged 1 commit into
python-pillow:mainpython-pillow/Pillow:mainfrom
radarhere:maxblockradarhere/Pillow:maxblockCopy head branch name to clipboard
Jun 2, 2025
Merged

Use ImageFile.MAXBLOCK in tobytes()#8906
radarhere merged 1 commit into
python-pillow:mainpython-pillow/Pillow:mainfrom
radarhere:maxblockradarhere/Pillow:maxblockCopy head branch name to clipboard

Conversation

@radarhere

Copy link
Copy Markdown
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
@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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.