Skip to content

Mention that tobytes() with the raw encoder uses Pack.c#8878

Merged
wiredfool merged 1 commit intopython-pillow:mainfrom
radarhere:raw
May 30, 2025
Merged

Mention that tobytes() with the raw encoder uses Pack.c#8878
wiredfool merged 1 commit intopython-pillow:mainfrom
radarhere:raw

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Apr 10, 2025

Alternative to #8777

In that PR, a user read https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.tobytes
Screenshot 2025-04-10 at 8 51 07 pm

and interpreted it as "tobytes() will return data exactly matching Pillow's internal storage".

This isn't always true for the raw encoder, and it definitely isn't true for the other encoders.

I've tried to clarify that here by updating the documentation to say that the method returns "raw image data derived from Pillow's internal storage". I've also mentioned Pack.c as the user suggested.

@wiredfool wiredfool merged commit e16f387 into python-pillow:main May 30, 2025
64 of 66 checks passed
@radarhere radarhere deleted the raw branch May 30, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants