Skip to content

Memory map rotated TIFF images at stored size - #10222

Open
lazerg wants to merge 1 commit into
python-pillow:mainfrom
lazerg:fix/issue-10220-mmap-orientation
Open

lazerg wants to merge 1 commit into
python-pillow:mainfrom
lazerg:fix/issue-10220-mmap-orientation

Conversation

@lazerg

@lazerg lazerg commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

An uncompressed single-strip TIFF with Orientation 5-8 that isn't square comes out scrambled when opened by filename. Since #8390, size is the displayed (transposed) size and _tile_size holds the stored size, but the mmap branch of ImageFile.load() still mapped the buffer at self.size, so the stored rows were read at the wrong width before load_end() transposed them.

This maps the buffer, and runs the length check from #10147, at _tile_size when the image has one. Added a test for orientations 5-8.

Fixes #10220

@radarhere radarhere added the TIFF label Oct 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rotated TIFF gets scrambled when opened by filename

2 participants