Skip to content

Fix Pillow 12.2 encoder compatibility in pil_to_numpy - #3783

Open
aswanth-07 wants to merge 2 commits into
nerfstudio-project:mainfrom
aswanth-07:fix/pillow-12-encoder-compat
Open

Fix Pillow 12.2 encoder compatibility in pil_to_numpy#3783
aswanth-07 wants to merge 2 commits into
nerfstudio-project:mainfrom
aswanth-07:fix/pillow-12-encoder-compat

Conversation

@aswanth-07

@aswanth-07 aswanth-07 commented Aug 28, 2026

Copy link
Copy Markdown

Summary

  • Pass explicit image extents to Pillow's raw encoder, which is accepted by older supported releases and required by Pillow 12.2.
  • Add regression coverage for writable grayscale and RGB arrays.

Fixes #3782

Validation

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 py -3.13 -m pytest -o addopts='' tests/utils/test_data_utils.py -q (2 passed with Pillow 11.0.0)
  • Direct pil_to_numpy checks passed for grayscale and RGB images with Pillow 12.2.0.
  • py -3.13 -m ruff check nerfstudio/data/utils/data_utils.py tests/utils/test_data_utils.py (passed)
  • py -3.13 -m ruff format --check nerfstudio/data/utils/data_utils.py tests/utils/test_data_utils.py (passed)
  • git diff --check (passed)
  • The exact pristine upstream commit fails under Pillow 12.2.0 with TypeError: function takes exactly 2 arguments (1 given).

AI assistance disclosure: AI-assisted development tools were used during investigation and implementation. The reported tests were run against the final diff.

@aswanth-07
aswanth-07 marked this pull request as ready for review August 28, 2026 12:12
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.

Pillow >=12 breaks pil_to_numpy() via private PIL.Image API arity change

1 participant