Skip to content

Conversation

@radarhere
Copy link
Member

# FIXME: add memory map support
mode = "I"
rawmode = "I;16B"

This FIXME can be resolved by changing the mode to match the rawmode.

Pillow/src/PIL/Image.py

Lines 276 to 278 in a370209

# raw modes that may be memory mapped. NOTE: if you change this, you
# may have to modify the stride calculation in map.c too!
_MAPMODES = ("L", "P", "RGBX", "RGBA", "CMYK", "I;16", "I;16L", "I;16B")

Pillow/src/PIL/ImageFile.py

Lines 308 to 316 in a370209

if (
decoder_name == "raw"
and isinstance(args, tuple)
and len(args) >= 3
and args[0] == self.mode
and args[0] in Image._MAPMODES
):
try:
# use mmap, if possible

@hugovk hugovk merged commit a2fbd58 into python-pillow:main Jun 29, 2025
57 checks passed
@radarhere radarhere deleted the fixme branch June 29, 2025 12:39
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