Deprecate getdata(), in favour of new get_flattened_data()#9292
Merged
radarhere merged 2 commits intopython-pillow:mainfrom Jan 1, 2026
Merged
Deprecate getdata(), in favour of new get_flattened_data()#9292radarhere merged 2 commits intopython-pillow:mainfrom
radarhere merged 2 commits intopython-pillow:mainfrom
Conversation
042abcf to
2dfca16
Compare
e513b4c to
9ef11ec
Compare
9ef11ec to
d15c30a
Compare
hugovk
reviewed
Jan 1, 2026
Member
hugovk
left a comment
There was a problem hiding this comment.
Do we have an idea of how widely used getdata is?
docs/deprecations.rst
Outdated
| Image getdata() | ||
| ~~~~~~~~~~~~~~~ | ||
|
|
||
| .. deprecated:: 12.2.0 |
Member
There was a problem hiding this comment.
Suggested change
| .. deprecated:: 12.2.0 | |
| .. deprecated:: 12.1.0 |
And update from docs/releasenotes/12.2.0.rst
Member
Author
|
|
hugovk
approved these changes
Jan 1, 2026
Member
hugovk
left a comment
There was a problem hiding this comment.
That is quite a lot, but we can try it and see how it goes.
luketainton
pushed a commit
to luketainton/repos_webexmemebot
that referenced
this pull request
Jan 5, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [pillow](https://github.com/python-pillow/Pillow) ([changelog](https://github.com/python-pillow/Pillow/releases)) | `<12.0.1,>=12.0.0` → `<12.1.1,>=12.1.0` |  |  | --- ### Release Notes <details> <summary>python-pillow/Pillow (pillow)</summary> ### [`v12.1.0`](https://github.com/python-pillow/Pillow/releases/tag/12.1.0) [Compare Source](python-pillow/Pillow@12.0.0...12.1.0) <https://pillow.readthedocs.io/en/stable/releasenotes/12.1.0.html> #### Deprecations - Deprecate getdata(), in favour of new get\_flattened\_data() [#​9292](python-pillow/Pillow#9292) \[[@​radarhere](https://github.com/radarhere)] #### Documentation - Specify APNG duration type when opening [#​9368](python-pillow/Pillow#9368) \[[@​radarhere](https://github.com/radarhere)] - Added release notes for [#​9350](python-pillow/Pillow#9350) [#​9366](python-pillow/Pillow#9366) \[[@​radarhere](https://github.com/radarhere)] - Update ImageMorph documentation [#​9349](python-pillow/Pillow#9349) \[[@​radarhere](https://github.com/radarhere)] - Docs: update major bump cadence [#​9334](python-pillow/Pillow#9334) \[[@​hugovk](https://github.com/hugovk)] - Add release notes for [#​9070](python-pillow/Pillow#9070) [#​9320](python-pillow/Pillow#9320) \[[@​radarhere](https://github.com/radarhere)] - Updated Ubuntu version [#​9306](python-pillow/Pillow#9306) \[[@​radarhere](https://github.com/radarhere)] - Update macOS tested Pillow versions [#​9265](python-pillow/Pillow#9265) \[[@​radarhere](https://github.com/radarhere)] #### Dependencies - Update harfbuzz to 12.3.0 [#​9355](python-pillow/Pillow#9355) \[[@​radarhere](https://github.com/radarhere)] - Update xz to 5.8.2 [#​9343](python-pillow/Pillow#9343) \[[@​radarhere](https://github.com/radarhere)] - Updated libjpeg-turbo to 3.1.3 [#​9333](python-pillow/Pillow#9333) \[[@​radarhere](https://github.com/radarhere)] - Updated zlib-ng to 2.3.2 [#​9324](python-pillow/Pillow#9324) \[[@​radarhere](https://github.com/radarhere)] - Updated libpng to 1.6.53 [#​9325](python-pillow/Pillow#9325) \[[@​radarhere](https://github.com/radarhere)] - Update actions/checkout action to v6 [#​9323](python-pillow/Pillow#9323) \[@​[renovate\[bot\]](https://github.com/apps/renovate)] - Update dependency mypy to v1.19.0 [#​9322](python-pillow/Pillow#9322) \[@​[renovate\[bot\]](https://github.com/apps/renovate)] - Updated libpng to 1.6.51 [#​9305](python-pillow/Pillow#9305) \[[@​radarhere](https://github.com/radarhere)] - Updated brotli to 1.2.0 [#​9284](python-pillow/Pillow#9284) \[[@​radarhere](https://github.com/radarhere)] - Update libimagequant to 4.4.1 [#​9301](python-pillow/Pillow#9301) \[[@​radarhere](https://github.com/radarhere)] - Update zlib-ng to 2.3.1, except on manylinux2014 aarch64 [#​9312](python-pillow/Pillow#9312) \[[@​radarhere](https://github.com/radarhere)] - Updated harfbuzz to 12.2.0 [#​9289](python-pillow/Pillow#9289) \[[@​radarhere](https://github.com/radarhere)] - Update github-actions [#​9277](python-pillow/Pillow#9277) \[@​[renovate\[bot\]](https://github.com/apps/renovate)] #### Testing - Replace pre-commit with prek [#​9360](python-pillow/Pillow#9360) \[[@​hugovk](https://github.com/hugovk)] - Test PyQt6 on Python 3.14 on Windows [#​9353](python-pillow/Pillow#9353) \[[@​radarhere](https://github.com/radarhere)] - Test 32-bit Windows on Windows Server 2022 [#​9345](python-pillow/Pillow#9345) \[[@​radarhere](https://github.com/radarhere)] - Correct variable type [#​9335](python-pillow/Pillow#9335) \[[@​radarhere](https://github.com/radarhere)] - Fix `ResourceWarning`s in `selftest.py` [#​9332](python-pillow/Pillow#9332) \[[@​hugovk](https://github.com/hugovk)] - Fix testing good P mode BMP images [#​9319](python-pillow/Pillow#9319) \[[@​radarhere](https://github.com/radarhere)] - Test Python 3.15 pre-release [#​9331](python-pillow/Pillow#9331) \[[@​hugovk](https://github.com/hugovk)] - Test ImageFont.ImageFont, in case freetype2 is not supported [#​9287](python-pillow/Pillow#9287) \[[@​radarhere](https://github.com/radarhere)] - Add Fedora 43 [#​9290](python-pillow/Pillow#9290) \[[@​radarhere](https://github.com/radarhere)] - Remove Fedora 41 [#​9260](python-pillow/Pillow#9260) \[[@​radarhere](https://github.com/radarhere)] #### Type hints - Add ImageFile context manager [#​9367](python-pillow/Pillow#9367) \[[@​radarhere](https://github.com/radarhere)] - Assert fp is not None [#​8617](python-pillow/Pillow#8617) \[[@​radarhere](https://github.com/radarhere)] - Added return type to ImageFile \_close\_fp() [#​9356](python-pillow/Pillow#9356) \[[@​radarhere](https://github.com/radarhere)] - Use different variables for Image and ImageFile instances [#​9316](python-pillow/Pillow#9316) \[[@​radarhere](https://github.com/radarhere)] - Correct variable type [#​9335](python-pillow/Pillow#9335) \[[@​radarhere](https://github.com/radarhere)] - Improve type hints [#​9317](python-pillow/Pillow#9317) \[[@​radarhere](https://github.com/radarhere)] - Use different variables for Image and ImageFile instances [#​9268](python-pillow/Pillow#9268) \[[@​radarhere](https://github.com/radarhere)] - Added type hints [#​9269](python-pillow/Pillow#9269) \[[@​radarhere](https://github.com/radarhere)] - Correct **getitem** return type [#​9264](python-pillow/Pillow#9264) \[[@​radarhere](https://github.com/radarhere)] #### Other changes - Simplify band splitting [#​9291](python-pillow/Pillow#9291) \[[@​radarhere](https://github.com/radarhere)] - Support saving APNG float durations [#​9365](python-pillow/Pillow#9365) \[[@​radarhere](https://github.com/radarhere)] - Allow 1 mode images in MorphOp [#​9348](python-pillow/Pillow#9348) \[[@​radarhere](https://github.com/radarhere)] - Use minimum supported Python version for Lint [#​9364](python-pillow/Pillow#9364) \[[@​radarhere](https://github.com/radarhere)] - Allow for duplicate font variation styles [#​9362](python-pillow/Pillow#9362) \[[@​radarhere](https://github.com/radarhere)] - Call parent verify method [#​9357](python-pillow/Pillow#9357) \[[@​radarhere](https://github.com/radarhere)] - Return LUT from LutBuilder build\_default\_lut() [#​9350](python-pillow/Pillow#9350) \[[@​radarhere](https://github.com/radarhere)] - Simplify WebP code [#​9329](python-pillow/Pillow#9329) \[[@​radarhere](https://github.com/radarhere)] - Use unsigned long for DWORD [#​9352](python-pillow/Pillow#9352) \[[@​radarhere](https://github.com/radarhere)] - Cast to UINT32 before shifting bits [#​9347](python-pillow/Pillow#9347) \[[@​radarhere](https://github.com/radarhere)] - \[pre-commit.ci] pre-commit autoupdate [#​9318](python-pillow/Pillow#9318) \[@​[pre-commit-ci\[bot\]](https://github.com/apps/pre-commit-ci)] - Allow window ID to be passed to ImageGrab.grab() on macOS [#​9070](python-pillow/Pillow#9070) \[[@​yankeguo](https://github.com/yankeguo)] - Apply encoder options when saving multiple PNG frames [#​9300](python-pillow/Pillow#9300) \[[@​radarhere](https://github.com/radarhere)] - Read all non-zero transparency from mode 1 PNG images as 255 [#​9282](python-pillow/Pillow#9282) \[[@​radarhere](https://github.com/radarhere)] - Support writing IFD, SIGNED\_RATIONAL and InkNames TIFF tags [#​9276](python-pillow/Pillow#9276) \[[@​radarhere](https://github.com/radarhere)] - Remove unused modes [#​9275](python-pillow/Pillow#9275) \[[@​radarhere](https://github.com/radarhere)] - Correct allocating new color to RGBA palette [#​9313](python-pillow/Pillow#9313) \[[@​radarhere](https://github.com/radarhere)] - Close image on ImageFont exception [#​9304](python-pillow/Pillow#9304) \[[@​radarhere](https://github.com/radarhere)] - Reapply "Use macos-latest for iOS arm64 simulator" [#​9259](python-pillow/Pillow#9259) \[[@​radarhere](https://github.com/radarhere)] - Escape period in pre-commit-config [#​9036](python-pillow/Pillow#9036) \[[@​radarhere](https://github.com/radarhere)] - Add Apache-2.0 notice to IcoImagePlugin [#​8947](python-pillow/Pillow#8947) \[[@​stefan6419846](https://github.com/stefan6419846)] - \[pre-commit.ci] pre-commit autoupdate [#​9288](python-pillow/Pillow#9288) \[@​[pre-commit-ci\[bot\]](https://github.com/apps/pre-commit-ci)] - Simplify code now that I;16\* modes are the only IMAGING\_TYPE\_SPECIAL [#​9263](python-pillow/Pillow#9263) \[[@​radarhere](https://github.com/radarhere)] - Remove BytesIO from DdsImagePlugin [#​9273](python-pillow/Pillow#9273) \[[@​radarhere](https://github.com/radarhere)] - Fix ZeroDivisionError in DdsImagePlugin [#​9272](python-pillow/Pillow#9272) \[[@​radarhere](https://github.com/radarhere)] - Fix warnings [#​9257](python-pillow/Pillow#9257) \[[@​radarhere](https://github.com/radarhere)] </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi42OS4yIiwidXBkYXRlZEluVmVyIjoiNDIuNjkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsidHlwZS9kZXBlbmRlbmNpZXMiXX0=--> Reviewed-on: https://git.tainton.uk/repos/webexmemebot/pulls/542 Co-authored-by: renovate[bot] <[email protected]> Co-committed-by: renovate[bot] <[email protected]>
KiaraGrouwstra
added a commit
to KiaraGrouwstra/term-image
that referenced
this pull request
Feb 7, 2026
addresses Pillow's deprecation of `getdata`. see: python-pillow/Pillow#9292 Signed-off-by: cinereal <[email protected]>
This was referenced Feb 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#9261 reports that pyright has a problem when iterating over the core Imaging instance returned from
im.getdata().There is already a comment in our codebase that returning a core Imaging instance from
getdata()is a potential pitfall.Pillow/src/PIL/Image.py
Line 1447 in 76f04b4
It would be better for users not to be given a C object they are unfamiliar with.
While users could adapt their code to
getchannel()andtobytes()with some manipulation instead, I expect there would be pushback against removing this method entirely.In practice, I expect that we could just change the output to a tuple, and most if not all code would continue to work, but I understand that changing the return type suddenly is not great in theory.
So this PR suggests deprecating the method, as a replacement, I have added
get_flattened_data(), converting the core Imaging instance to a tuple.